Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ign -> gz Namespace Migration : gz-transport #311

Merged
merged 28 commits into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b7723c3
Update header guards
methylDragon May 18, 2022
481885c
Migrate namespaces
methylDragon May 18, 2022
2abe365
Add migration line
methylDragon May 18, 2022
9796364
Implement deprecation trick
methylDragon May 18, 2022
12e202b
Add deprecation test
methylDragon May 18, 2022
a8e9431
Include config.hh
methylDragon May 18, 2022
2ee6c0c
Use pragma deprecation message instead
methylDragon May 19, 2022
c315bb8
Ticktock config macros
methylDragon May 19, 2022
1546644
Fix migration
methylDragon May 19, 2022
7129e27
Migrate inline namespaces
methylDragon May 20, 2022
56c1ae6
Migrate includes to gz
methylDragon May 20, 2022
1e9b32d
Mention gz headers in migration
methylDragon May 20, 2022
6ebd9b9
Update config.hh
methylDragon May 20, 2022
3a68528
Migrate Export.hh macros and update deprecated test
methylDragon May 20, 2022
362c080
Support gz-msgs hard-tock and update more macros
methylDragon May 20, 2022
8363110
Migrate github links
methylDragon May 20, 2022
6989bf0
Migrate user-facing Ignition to Gazebo
methylDragon May 20, 2022
f0d3c02
Migrate "ignition.msgs" -> "gz.msgs"
methylDragon May 21, 2022
0fcf37e
Include config.hh in recursive directories and <lib>.hh
methylDragon May 22, 2022
f1a06af
Include config.hh in .h and .hpp redirection headers
methylDragon May 22, 2022
3de2277
`Gazebo Robotics` -> `Gazebo`
methylDragon May 23, 2022
de43793
`ignitionrobotics` -> `gazebosim`
methylDragon May 23, 2022
06a1686
Rollback osrf-migration.github.io migrations
methylDragon May 24, 2022
53f081c
Migrate Ignition's -> Gazebo's
methylDragon May 25, 2022
a5bfed8
Tick-tock IGN_TRANSPORT_LOG_SQL_PATH
methylDragon May 25, 2022
7887884
Wording changes
methylDragon May 25, 2022
2d73ee6
Tick-tock usage of GZ_TRANSPORT_LOG_SQL_PATH
methylDragon May 26, 2022
f4deacb
Fix linting errors
methylDragon May 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ release will remove the deprecated code.
1. Dependency on `cli` component of `ignition-utils`.
* [GitHub pull request 229](https://github.com/ignitionrobotics/ign-transport/pull/229)

### Deprecated

1. The `ignition` namespace is deprecated and will be removed in future versions. Use `gz` instead.
chapulina marked this conversation as resolved.
Show resolved Hide resolved

## Ignition Transport 8.X to 9.X

### Removed
Expand All @@ -27,7 +31,7 @@ release will remove the deprecated code.
1. NodeShared::TriggerSubscriberCallbacks
* [BitBucket pull request 404](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-transport/pull-requests/404)

1. The discovery wire protocol changed to use ignition::msgs::Discovery
1. The discovery wire protocol changed to use gz::msgs::Discovery
instead of C-structs. The Packet.hh header file is deprecated, which
contained the Header, SubscriptionMsg, and AdvertiseMessage classes. The
version of the wire protocal has bumped from 9 to 10. This means Ignition
Expand Down
46 changes: 23 additions & 23 deletions example/bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ class FloodSub

/// \brief Dummy callback.
/// \param[in] _msg The message.
public: void OnMsg(const ignition::msgs::Bytes & /*_msg*/)
public: void OnMsg(const gz::msgs::Bytes & /*_msg*/)
{
}

/// \brief Communication node.
private: ignition::transport::Node node;
private: gz::transport::Node node;
};

/// \brief A class that publishes on a number of `/benchmark/flood/*`
Expand All @@ -112,7 +112,7 @@ class FloodPub
std::ostringstream stream;
stream << "/benchmark/flood/" << i;
this->floodPubs.push_back(
this->node.Advertise<ignition::msgs::Bytes>(stream.str()));
this->node.Advertise<gz::msgs::Bytes>(stream.str()));
}
if (!this->floodPubs.empty())
this->runThread = std::thread(&FloodPub::RunLoop, this);
Expand All @@ -135,7 +135,7 @@ class FloodPub
/// \brief Run the publishers.
private: void RunLoop()
{
ignition::msgs::Bytes msg;
gz::msgs::Bytes msg;
int size = 1000;
char *byteData = new char[size];
std::memset(byteData, '0', size);
Expand All @@ -144,7 +144,7 @@ class FloodPub
this->running = true;
while (this->running)
{
for (ignition::transport::Node::Publisher &pub : this->floodPubs)
for (gz::transport::Node::Publisher &pub : this->floodPubs)
{
pub.Publish(msg);
}
Expand All @@ -153,7 +153,7 @@ class FloodPub
}

/// \brief Communication node.
private: ignition::transport::Node node;
private: gz::transport::Node node;

/// \brief Run thread.
private: std::thread runThread;
Expand All @@ -162,7 +162,7 @@ class FloodPub
private: bool running{false};

/// \brief The publishers.
private: std::vector<ignition::transport::Node::Publisher> floodPubs;
private: std::vector<gz::transport::Node::Publisher> floodPubs;
};

/// \brief The ReplyTester subscribes to the benchmark topics, and relays
Expand All @@ -173,14 +173,14 @@ class FloodPub
/// 1. /benchmark/latency/request For latency testing
/// 2. /benchmark/throughput/request For throughput testing.
///
/// The incoming and outgoing message types are ignition::msgs::Bytes.
/// The incoming and outgoing message types are gz::msgs::Bytes.
class ReplyTester
{
/// Constructor that creates the publishers and subscribers.
public: ReplyTester()
{
// Advertise on the throughput reply topic
this->throughputPub = this->node.Advertise<ignition::msgs::Bytes>(
this->throughputPub = this->node.Advertise<gz::msgs::Bytes>(
"/benchmark/throughput/reply");
if (!this->throughputPub)
{
Expand All @@ -190,7 +190,7 @@ class ReplyTester
}

// Advertise on the latency reply topic
this->latencyPub = this->node.Advertise<ignition::msgs::Bytes>(
this->latencyPub = this->node.Advertise<gz::msgs::Bytes>(
"/benchmark/latency/reply");
if (!this->latencyPub)
{
Expand Down Expand Up @@ -225,7 +225,7 @@ class ReplyTester

/// \brief Function called each time a throughput message is received.
/// \param[in] _msg Incoming message of variable size.
private: void ThroughputCb(const ignition::msgs::Bytes &_msg)
private: void ThroughputCb(const gz::msgs::Bytes &_msg)
{
if (this->prevStamp > 0 && _msg.header().stamp().sec() != 0)
{
Expand All @@ -246,19 +246,19 @@ class ReplyTester

/// \brief Function called each time a latency message is received.
/// \param[in] _msg Incoming message of variable size.
private: void LatencyCb(const ignition::msgs::Bytes &_msg)
private: void LatencyCb(const gz::msgs::Bytes &_msg)
{
this->latencyPub.Publish(_msg);
}

/// \brief The transport node
private: ignition::transport::Node node;
private: gz::transport::Node node;

/// \brief The throughput publisher
private: ignition::transport::Node::Publisher throughputPub;
private: gz::transport::Node::Publisher throughputPub;

/// \brief The latency publisher
private: ignition::transport::Node::Publisher latencyPub;
private: gz::transport::Node::Publisher latencyPub;

private: int prevStamp = 0;
};
Expand Down Expand Up @@ -305,7 +305,7 @@ class PubTester
public: void Init()
{
// Throughput publisher
this->throughputPub = this->node.Advertise<ignition::msgs::Bytes>(
this->throughputPub = this->node.Advertise<gz::msgs::Bytes>(
"/benchmark/throughput/request");
if (!this->throughputPub)
{
Expand All @@ -315,7 +315,7 @@ class PubTester
}

// Latency publisher
this->latencyPub = this->node.Advertise<ignition::msgs::Bytes>(
this->latencyPub = this->node.Advertise<gz::msgs::Bytes>(
"/benchmark/latency/request");
if (!this->latencyPub)
{
Expand Down Expand Up @@ -535,7 +535,7 @@ class PubTester

/// \brief Callback that handles throughput replies
/// \param[in] _msg The reply message
private: void ThroughputCb(const ignition::msgs::Bytes &_msg)
private: void ThroughputCb(const gz::msgs::Bytes &_msg)
{
// Lock
std::unique_lock<std::mutex> lk(this->mutex);
Expand Down Expand Up @@ -564,7 +564,7 @@ class PubTester

/// \brief Callback that handles latency replies
/// \param[in] _msg The reply message
private: void LatencyCb(const ignition::msgs::Bytes &_msg)
private: void LatencyCb(const gz::msgs::Bytes &_msg)
{
// End the time.
this->timeEnd = std::chrono::high_resolution_clock::now();
Expand Down Expand Up @@ -604,7 +604,7 @@ class PubTester
private: std::mutex mutex;

/// \brief Message that is sent.
private: ignition::msgs::Bytes msg;
private: gz::msgs::Bytes msg;

/// \brief Size of the message currently under test
private: uint64_t dataSize = 0;
Expand All @@ -619,13 +619,13 @@ class PubTester
private: uint64_t sentMsgs = 100;

/// \brief Communication node
private: ignition::transport::Node node;
private: gz::transport::Node node;

/// \brief Throughput publisher
private: ignition::transport::Node::Publisher throughputPub;
private: gz::transport::Node::Publisher throughputPub;

/// \brief Latency publisher
private: ignition::transport::Node::Publisher latencyPub;
private: gz::transport::Node::Publisher latencyPub;

/// \brief Used to stop the test.
private: bool stop = false;
Expand Down
10 changes: 5 additions & 5 deletions example/custom_query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
//////////////////////////////////////////////////
/// \brief Query for all the topics in reverse
class AllTopicsReverse final
: public virtual ignition::transport::log::QueryOptions
: public virtual gz::transport::log::QueryOptions
{
// See documentation on QueryOptions
public: std::vector<ignition::transport::log::SqlStatement>
public: std::vector<gz::transport::log::SqlStatement>
GenerateStatements(
const ignition::transport::log::Descriptor &/*_descriptor*/)
const gz::transport::log::Descriptor &/*_descriptor*/)
const override
{
// The preamble has all the necessary joins and the correct column order
// for a SELECT statement that returns messages.
ignition::transport::log::SqlStatement statement =
gz::transport::log::SqlStatement statement =
this->StandardMessageQueryPreamble();
// Reverse the order of the messages
statement.statement += "ORDER BY messages.time_recv DESC;";
Expand All @@ -55,7 +55,7 @@ int main(int argc, char *argv[])
return -1;
}

ignition::transport::log::Log log;
gz::transport::log::Log log;
if (!log.Open(argv[1]))
{
std::cerr << "Failed to open log\n";
Expand Down
2 changes: 1 addition & 1 deletion example/playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(int argc, char *argv[])
return -1;
}

ignition::transport::log::Playback player(argv[1]);
gz::transport::log::Playback player(argv[1]);

// Playback all topics
const int64_t addTopicResult = player.AddTopic(std::regex(".*"));
Expand Down
6 changes: 3 additions & 3 deletions example/publisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ int main(int argc, char **argv)
std::signal(SIGTERM, signal_handler);

// Create a transport node and advertise a topic.
ignition::transport::Node node;
gz::transport::Node node;
std::string topic = "/foo";

auto pub = node.Advertise<ignition::msgs::StringMsg>(topic);
auto pub = node.Advertise<gz::msgs::StringMsg>(topic);
if (!pub)
{
std::cerr << "Error advertising topic [" << topic << "]" << std::endl;
return -1;
}

// Prepare the message.
ignition::msgs::StringMsg msg;
gz::msgs::StringMsg msg;
msg.set_data("HELLO");

// Publish messages at 1Hz.
Expand Down
4 changes: 2 additions & 2 deletions example/publisher_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char **argv)
const char *topic = "/foo";

// Prepare the message.
ignition::msgs::StringMsg msg;
gz::msgs::StringMsg msg;
msg.set_data("HELLO");

// Get the size of the serialized message
Expand All @@ -62,7 +62,7 @@ int main(int argc, char **argv)
msg.SerializeToArray(buffer, size);

// Prepare the message.
ignition::msgs::StringMsg msgRed;
gz::msgs::StringMsg msgRed;
msgRed.set_data("RED HELLO");

// Get the size of the serialized message
Expand Down
4 changes: 2 additions & 2 deletions example/publisher_c_fast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char **argv)
const char *topic = "/foo";

// Prepare the message.
ignition::msgs::StringMsg msg;
gz::msgs::StringMsg msg;
msg.set_data("HELLO");

// Get the size of the serialized message
Expand All @@ -58,7 +58,7 @@ int main(int argc, char **argv)
msg.SerializeToArray(buffer, size);

// Prepare the message.
ignition::msgs::StringMsg msgRed;
gz::msgs::StringMsg msgRed;
msgRed.set_data("RED HELLO");

// Get the size of the serialized message
Expand Down
2 changes: 1 addition & 1 deletion example/publisher_custom_msg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main(int argc, char **argv)
std::signal(SIGTERM, signal_handler);

// Create a transport node and advertise a topic.
ignition::transport::Node node;
gz::transport::Node node;
std::string topic = "/foo";

auto pub = node.Advertise<example::msgs::StringMsg>(topic);
Expand Down
4 changes: 2 additions & 2 deletions example/publisher_raw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ int main(int argc, char **argv)
std::signal(SIGTERM, signal_handler);

// Create a transport node and advertise a topic.
ignition::transport::Node node;
gz::transport::Node node;
std::string topic = "/foo";

ignition::msgs::StringMsg msg;
gz::msgs::StringMsg msg;
msg.set_data("HELLO");

auto pub = node.Advertise(topic, msg.GetTypeName());
Expand Down
6 changes: 3 additions & 3 deletions example/record.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char *argv[])
return -1;
}

ignition::transport::log::Recorder recorder;
gz::transport::log::Recorder recorder;

// Record all topics
const int64_t addTopicResult = recorder.AddTopic(std::regex(".*"));
Expand All @@ -49,7 +49,7 @@ int main(int argc, char *argv[])

// Begin recording, saving received messages to the given file
const auto result = recorder.Start(argv[1]);
if (ignition::transport::log::RecorderError::SUCCESS != result)
if (gz::transport::log::RecorderError::SUCCESS != result)
{
std::cerr << "Failed to start recording: " << static_cast<int64_t>(result)
<< "\n";
Expand All @@ -60,7 +60,7 @@ int main(int argc, char *argv[])
<< std::endl;

// Wait until the interrupt signal is sent.
ignition::transport::waitForShutdown();
gz::transport::waitForShutdown();

recorder.Stop();

Expand Down
6 changes: 3 additions & 3 deletions example/requester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
int main(int argc, char **argv)
{
// Create a transport node.
ignition::transport::Node node;
gz::transport::Node node;

// Prepare the input parameters.
ignition::msgs::StringMsg req;
gz::msgs::StringMsg req;
req.set_data("HELLO");

ignition::msgs::StringMsg rep;
gz::msgs::StringMsg rep;
bool result;
unsigned int timeout = 5000;

Expand Down
8 changes: 4 additions & 4 deletions example/requester_async.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

//////////////////////////////////////////////////
/// \brief Service response callback.
void responseCb(const ignition::msgs::StringMsg &_rep, const bool _result)
void responseCb(const gz::msgs::StringMsg &_rep, const bool _result)
{
if (_result)
std::cout << "Response: [" << _rep.data() << "]" << std::endl;
Expand All @@ -33,10 +33,10 @@ void responseCb(const ignition::msgs::StringMsg &_rep, const bool _result)
int main(int argc, char **argv)
{
// Create a transport node.
ignition::transport::Node node;
gz::transport::Node node;

// Prepare the input parameters.
ignition::msgs::StringMsg req;
gz::msgs::StringMsg req;
req.set_data("HELLO");

std::cout << "Press <CTRL-C> to exit" << std::endl;
Expand All @@ -45,5 +45,5 @@ int main(int argc, char **argv)
node.Request("/echo", req, responseCb);

// Zzzzzz.
ignition::transport::waitForShutdown();
gz::transport::waitForShutdown();
}
Loading