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

Bridge as a gz sim system [rolling] #511

Closed
wants to merge 18 commits into from
Closed

Conversation

caguero
Copy link
Contributor

@caguero caguero commented Mar 15, 2024

🎉 New feature

Summary

This PR runs the ROS<->Gz bridge as a gz sim system. It's targeting ROS 2 rolling. I'll create a separate PR with some updates that we discussed offline.

Test it

ros2 launch ros_gz_sim_demos ros_gz.launch.py

Verify the output to confirm that two topics are bridged:

[ruby $(which ign) gazebo-1] [INFO] [1708634732.070359776] [ros_gz_bridge]: Creating ROS->GZ Bridge: [ros_chatter (std_msgs/msg/String) -> gz_chatter (ignition.msgs.StringMsg)] (Lazy 1)
[ruby $(which ign) gazebo-1] [INFO] [1708634732.071384449] [ros_gz_bridge]: Creating GZ->ROS Bridge: [gz_chatter (ignition.msgs.StringMsg) -> ros_chatter (std_msgs/msg/String)] (Lazy 0)

Then, you should see a ROS topic /ros_chatter:

caguero@cold:~/ros_gz_ws$ ros2 topic list
/parameter_events
/ros_chatter
/rosout

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@caguero caguero mentioned this pull request Mar 15, 2024
9 tasks
@caguero caguero marked this pull request as ready for review March 15, 2024 15:06
@caguero caguero requested a review from ahcorde as a code owner March 15, 2024 15:06
@caguero
Copy link
Contributor Author

caguero commented Mar 15, 2024

@ahcorde , do you know if these tests are supposed to compile? It seems a problem sourcing setup.bash in rolling.

@caguero caguero changed the title Bridge as a gz sim system Bridge as a gz sim system [rolling] Mar 15, 2024
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azeey or @mjcarroll do you mind to take a look too ?

}

if (!_sdf->HasElement("config_file")) {
std::cerr << "No <config_file> found. Plugin disabled." << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this is a Gazebo plugin, should we use here gzerr ? remove <iostream> header too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in 78067c4.

@azeey azeey self-requested a review March 25, 2024 18:30
@@ -173,31 +174,30 @@ std::vector<BridgeConfig> readFromYaml(std::istream & in)
std::vector<BridgeConfig> readFromYamlFile(const std::string & filename)
{
std::vector<BridgeConfig> ret;
std::ifstream in(filename);
resource_retriever::Retriever r;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: single letter variable names violate our style guide. Can you use a more descriptive variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed in 13f4008

ros_gz_bridge/include/ros_gz_bridge/ros_gz_bridge.hpp Outdated Show resolved Hide resolved
ros_gz_bridge/test/bridge_config.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not need to be installed. It can live in ros_gz_sim/src.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved in 13f4008

Comment on lines +83 to +84
this->dataPtr->exec =
std::make_shared<rclcpp::executors::MultiThreadedExecutor>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation on Multi-Threaded Executors seems to indicate we need to use callback groups to take advantage of parallelism. @mjcarroll Can you confirm?

@azeey
Copy link
Contributor

azeey commented Mar 29, 2024

Can you also fix DCO?

luca-della-vedova and others added 17 commits March 29, 2024 23:21
* Update README to include harmonic

Signed-off-by: Luca Della Vedova <[email protected]>

* Remove humble-harmonic combination

Signed-off-by: Luca Della Vedova <[email protected]>

---------

Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Also Added a note pointing to REP-2000 for additional details.
---------

Signed-off-by: Katherine Scott <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Pins rosdep to a known good version based on https://wiki.ros.org/SnapshotRepository

---------

Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
@caguero caguero force-pushed the caguero/ros2_gz_system branch from 1069252 to 7d9b91d Compare March 29, 2024 22:31
Signed-off-by: Carlos Agüero <[email protected]>
@caguero
Copy link
Contributor Author

caguero commented Mar 29, 2024

Can you also fix DCO?

Fixed

@azeey azeey mentioned this pull request Apr 24, 2024
7 tasks
@azeey
Copy link
Contributor

azeey commented May 28, 2024

@caguero Do we want to close this one now that the composable nodes PRs are merged?

@caguero caguero closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants