Skip to content

Commit

Permalink
ign -> gz Upstream Macro Migration : gz-launch (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
methylDragon authored Jun 18, 2022
1 parent 8aafd2f commit 29f2a47
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 91 deletions.
6 changes: 4 additions & 2 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ release will remove the deprecated code.
- Migrate `IGN_LAUNCH_PLUGIN_PATH` environment variable to `GZ_LAUNCH_PLUGIN_PATH` for finding
plugin.
With tick-tock.

- Migrate `IGN_LAUNCH_CONFIG_PATH` environment variable to `GZ_LAUNCH_CONFIG_PATH` for finding
configs.
With tick-tock.


- The default config file path has been hard-tocked to `~/.gz/launch/gui.config`.
`~/.ignition/launch/gui.config` will no longer work.

## Gazebo Launch 2.2.2

Expand Down
2 changes: 1 addition & 1 deletion plugins/gazebo_factory/GazeboFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ bool GazeboFactory::Load(const tinyxml2::XMLElement *_elem)
gzdbg << "Factory service call succeeded.\n";
if (!this->worldPerformers[msg.first].empty())
{
IGN_SLEEP_S(2);
GZ_SLEEP_S(2);
topic = std::string("/world/") + msg.first + "/level/set_performer";

for (const auto &perf : this->worldPerformers[msg.first])
Expand Down
2 changes: 1 addition & 1 deletion plugins/gazebo_factory/GazeboFactory.hh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ namespace gz
}

// Register the plugin
IGNITION_ADD_PLUGIN(gz::launch::GazeboFactory, gz::launch::Plugin)
GZ_ADD_PLUGIN(gz::launch::GazeboFactory, gz::launch::Plugin)

#endif
52 changes: 26 additions & 26 deletions plugins/gazebo_gui/GazeboGui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ bool GazeboGui::Load(const tinyxml2::XMLElement *_elem)

// Set default config file for Launch
std::string defaultConfigPath;
gz::common::env(IGN_HOMEDIR, defaultConfigPath);
gz::common::env(GZ_HOMEDIR, defaultConfigPath);
defaultConfigPath = gz::common::joinPaths(defaultConfigPath,
".ignition", "launch");
".gz", "launch");

auto defaultConfigFile = gz::common::joinPaths(defaultConfigPath,
"gui.config");

// Check if there's a default config file under
// ~/.ignition/launch and use that. If there isn't, create it
// ~/.gz/launch and use that. If there isn't, create it
if (!gz::common::exists(defaultConfigFile))
{
gz::common::createDirectories(defaultConfigPath);
Expand All @@ -64,39 +64,39 @@ bool GazeboGui::Load(const tinyxml2::XMLElement *_elem)
if (configFile.is_open())
{
configFile <<
"<window>\n" <<
" <width>1000</width>\n" <<
" <height>845</height>\n" <<
" <style\n" <<
" material_theme='Light'\n" <<
" material_primary='DeepOrange'\n" <<
" material_accent='LightBlue'\n" <<
" toolbar_color_light='#f3f3f3'\n" <<
" toolbar_text_color_light='#111111'\n" <<
" toolbar_color_dark='#414141'\n" <<
" toolbar_text_color_dark='#f3f3f3'\n" <<
" plugin_toolbar_color_light='#bbdefb'\n" <<
" plugin_toolbar_text_color_light='#111111'\n" <<
" plugin_toolbar_color_dark='#607d8b'\n" <<
" plugin_toolbar_text_color_dark='#eeeeee'\n" <<
" />\n" <<
" <menus>\n" <<
" <drawer default='false'>\n" <<
" </drawer>\n" <<
" </menus>\n" <<
"</window>\n";
"<window>\n" <<
" <width>1000</width>\n" <<
" <height>845</height>\n" <<
" <style\n" <<
" material_theme='Light'\n" <<
" material_primary='DeepOrange'\n" <<
" material_accent='LightBlue'\n" <<
" toolbar_color_light='#f3f3f3'\n" <<
" toolbar_text_color_light='#111111'\n" <<
" toolbar_color_dark='#414141'\n" <<
" toolbar_text_color_dark='#f3f3f3'\n" <<
" plugin_toolbar_color_light='#bbdefb'\n" <<
" plugin_toolbar_text_color_light='#111111'\n" <<
" plugin_toolbar_color_dark='#607d8b'\n" <<
" plugin_toolbar_text_color_dark='#eeeeee'\n" <<
" />\n" <<
" <menus>\n" <<
" <drawer default='false'>\n" <<
" </drawer>\n" <<
" </menus>\n" <<
"</window>\n";
configFile.close();
gzmsg << "Saved file [" << defaultConfigFile << "]" << std::endl;
}
else
{
gzerr << "Unable to open file [" << defaultConfigFile << "]"
<< std::endl;
<< std::endl;
}
}

auto app = sim::gui::createGui(argc, argv, defaultConfigFile.c_str(),
defaultConfigFile.c_str(), false);
defaultConfigFile.c_str(), false);

auto win = app->findChild<gz::gui::MainWindow *>()->QuickWindow();

Expand Down
8 changes: 4 additions & 4 deletions plugins/gazebo_gui/GazeboGui.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace gz
/// \brief Runs the Gazebo GUI.
///
/// The plugin ignores GUI configuration coming from the SDF
/// world file or saved in ~/.ignition/gazebo/gui.config. Instead,
/// it loads a GUI config from ~/.ignition/launch/gui.config.
/// world file or saved in ~/.gz/sim/gui.config. Instead,
/// it loads a GUI config from ~/.gz/launch/gui.config.
/// If that file doesn't exist, it will be created and populated
/// with default values. Delete that file to restore default values.
///
Expand All @@ -49,7 +49,7 @@ namespace gz
/// <!-- Set window icon.
/// This can be a full path to a local file, or a path to a resource
/// file prefixed by ":".
/// Defaults to the Ignition logo. -->
/// Defaults to the Gazebo logo. -->
/// <window_icon>full/path/to/window/icon.png</window_icon>
///
/// <!-- Add Gazebo GUI plugins here -->
Expand All @@ -72,6 +72,6 @@ namespace gz
}

// Register the plugin
IGNITION_ADD_PLUGIN(gz::launch::GazeboGui, gz::launch::Plugin)
GZ_ADD_PLUGIN(gz::launch::GazeboGui, gz::launch::Plugin)

#endif
4 changes: 2 additions & 2 deletions plugins/gazebo_server/GazeboServer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace gz
/// name="gz::sim::systems::v0::Physics">
/// </plugin>
///
/// <!-- Specify any other ignition gazebo plugins here. -->
/// <!-- Specify any other Gazebo sim plugins here. -->
/// </plugin>
class GazeboServer : public gz::launch::Plugin
{
Expand All @@ -63,6 +63,6 @@ namespace gz
}

// Register the plugin
IGNITION_ADD_PLUGIN(gz::launch::GazeboServer, gz::launch::Plugin)
GZ_ADD_PLUGIN(gz::launch::GazeboServer, gz::launch::Plugin)

#endif
2 changes: 1 addition & 1 deletion plugins/joy_to_twist/JoyToTwist.hh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ namespace gz
}

// Register the plugin
IGNITION_ADD_PLUGIN(gz::launch::JoyToTwist, gz::launch::Plugin)
GZ_ADD_PLUGIN(gz::launch::JoyToTwist, gz::launch::Plugin)

#endif
2 changes: 1 addition & 1 deletion plugins/joystick/Joystick.hh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ namespace gz
}

// Register the plugin
IGNITION_ADD_PLUGIN(gz::launch::Joystick, gz::launch::Plugin)
GZ_ADD_PLUGIN(gz::launch::Joystick, gz::launch::Plugin)

#endif
2 changes: 1 addition & 1 deletion plugins/websocket_server/WebsocketServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ void WebsocketServer::Run()
void WebsocketServer::OnConnect(int _socketId)
{
std::unique_ptr<Connection> c(new Connection);
c->creationTime = IGN_SYSTEM_TIME();
c->creationTime = GZ_SYSTEM_TIME();

// No authorization key means the server is publically accessible
c->authorized = this->authorizationKey.empty() &&
Expand Down
6 changes: 3 additions & 3 deletions plugins/websocket_server/WebsocketServer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace gz
/// 7. "unsub": Unsubscribe from the topic in the `topic_name` component
///
/// The `topic_name` component is mandatory for the "sub", "pub", and
/// "unsub" operations. If present, it must be the name of an Ignition
/// "unsub" operations. If present, it must be the name of a Gazebo
/// Transport topic.
///
/// The `message_type` component is mandatory for the "pub" operation. If
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace gz
/// \brief All of the websocket connections.
public: std::map<int, std::unique_ptr<Connection>> connections;

/// \brief All of the subscribed Ignition topics.
/// \brief All of the subscribed Gazebo topics.
/// The key is the topic name, and the value is the set of websocket
/// connections that have subscribed to the topic.
public: std::map<std::string, std::set<int>> topicConnections;
Expand Down Expand Up @@ -317,6 +317,6 @@ namespace gz
}

// Register the plugin
IGNITION_ADD_PLUGIN(gz::launch::WebsocketServer, gz::launch::Plugin)
GZ_ADD_PLUGIN(gz::launch::WebsocketServer, gz::launch::Plugin)

#endif
12 changes: 6 additions & 6 deletions plugins/websocket_server/ign.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function buildMsg(_frameParts) {
return _frameParts.join(',');
}

/// \brief The main interface to the Ignition websocket server and
/// \brief The main interface to the Gazebo websocket server and
/// data on Gazebo Transport.
function Ignition(options) {
options = options || {};
Expand All @@ -35,7 +35,7 @@ function Ignition(options) {
this.worlds = [];
this.isConnected = false;

// Start with a null root protobuf object. This object will be
// Start with a null root protobuf object. This object will be
// created when we get the set of protobuf definitions from the server.
this.root = null;

Expand Down Expand Up @@ -69,9 +69,9 @@ Ignition.prototype.connect = function(url, key) {
that.emit('error', event);
}

/// \brief Parses message responses from ignition and sends to the
/// \brief Parses message responses from Gazebo and sends to the
/// appropriate topic.
// \param message - the JSON message from the Ignition
// \param message - the JSON message from the Gazebo
// httpserver.
function onMessage(_message) {
if (that.root === undefined || that.root === null) {
Expand All @@ -93,7 +93,7 @@ Ignition.prototype.connect = function(url, key) {
that.socket.send(buildMsg(['topics','','','']));

// Request the list of worlds on start.
// \todo Switch this to a service call when this issue is
// \todo Switch this to a service call when this issue is
// resolved:
// https://github.com/gazebosim/gz-transport/issues/135
that.socket.send(buildMsg(['worlds','','','']));
Expand Down Expand Up @@ -168,7 +168,7 @@ Ignition.prototype.sendMsg = function(_msg) {
/// \brief Interface to Gazebo Transport topics.
function Topic(options) {
options = options || {};
this.ign = options.ign;
this.ign = options.ign;
this.name = options.name;
this.messageType = options.messageType;
this.isAdvertised = false;
Expand Down
Loading

0 comments on commit 29f2a47

Please sign in to comment.