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

ROS2 Bridge not working with LRAUV Simulator #660

Closed
prasilva98 opened this issue Dec 4, 2024 · 2 comments
Closed

ROS2 Bridge not working with LRAUV Simulator #660

prasilva98 opened this issue Dec 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@prasilva98
Copy link

Environment

  • OS Version:
    source - humble branch with gazebo garden

Description

  • Expected behavior: I tried to create a ROS bridge between the maritime lrauv simulator to control the fins and thrusters.
  • Actual behavior: The bridge for the thruster works fine but not for the fins and I can't figure out why.

Steps to reproduce

  1. gz sim
  2. select lrauv_control_demo
  3. ros2 run ros_gz_bridge parameter_bridge /model/tethys/joint/propeller_joint/cmd_thrust@std_msgs/msg/[email protected]
  4. ros2 run ros_gz_bridge parameter_bridge /model/tethys/joint/horizontal_fins_joint/0/cmd_pos@std_msgs/msg/[email protected]

Output

In step 3 you will see that the bridge works and you are able to control the thurster. However in step 4 I get this warning:
[WARN] [1733327666.759352233] [ros_gz_bridge]: Failed to create a bridge for topic [/model/tethys/joint/vertical_fins_joint/0/cmd_pos] with ROS2 type [std_msgs/msg/Float64] to topic [/model/tethys/joint/vertical_fins_joint/0/cmd_pos] with Gazebo Transport type [gz.msgs.Double].

I don't think the topic name is wrong or the msg types because I can publish to that using gz topic -t /model/tethys/joint/vertical_fins_joint/0/cmd_pos -m gz.msgs.Double -p 'data: -0.17' and the vehicle starts to turn.

Hopefully somebody has dealt with this.

@prasilva98 prasilva98 added the bug Something isn't working label Dec 4, 2024
@prasilva98
Copy link
Author

prasilva98 commented Dec 4, 2024

I am pretty sure I know what is causing it.

ros2 run ros_gz_bridge parameter_bridge /model/tethys/joint/horizontal_fins_joint/cmd_pos@std_msgs/msg/[email protected]
[INFO] [1733341747.825102000] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/model/tethys/joint/horizontal_fins_joint/cmd_pos (gz.msgs.Double) -> /model/tethys/joint/horizontal_fins_joint/cmd_pos (std_msgs/msg/Float64)] (Lazy 0)
[INFO] [1733341747.827184515] [ros_gz_bridge]: Creating ROS->GZ Bridge: [/model/tethys/joint/horizontal_fins_joint/cmd_pos (std_msgs/msg/Float64) -> /model/tethys/joint/horizontal_fins_joint/cmd_pos (gz.msgs.Double)] (Lazy 0)


If I remove the "/0/" the bridge causes no issues.
If I add any number between the "/ /" the parameter bridge raises an issue example:

ros2 run ros_gz_bridge parameter_bridge /model/tethys/joint/4/horizontal_fins_joint/cmd_pos@std_msgs/msg/[email protected]
[INFO] [1733341701.255371834] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/model/tethys/joint/4/horizontal_fins_joint/cmd_pos (gz.msgs.Double) -> /model/tethys/joint/4/horizontal_fins_joint/cmd_pos (std_msgs/msg/Float64)] (Lazy 0)
[WARN] [1733341701.255852702] [ros_gz_bridge]: Failed to create a bridge for topic [/model/tethys/joint/4/horizontal_fins_joint/cmd_pos] with ROS2 type [std_msgs/msg/Float64] to topic [/model/tethys/joint/4/horizontal_fins_joint/cmd_pos] with Gazebo Transport type [gz.msgs.Double]

I assume this could be some sort of parsing issue correct?

@prasilva98
Copy link
Author

I figured out a workaround. From my understanding you can't specify ROS2 topics with a single number in the path. This is what is causing the issue. The workaround is top map the ROS topic to a different topic like so:

# Full set of configurations
- ros_topic_name: "/model/tethys/joint/horizontal_fins_joint/cmd_pos"
  gz_topic_name: "/model/tethys/joint/horizontal_fins_joint/0/cmd_pos"
  ros_type_name: "std_msgs/msg/Float64"
  gz_type_name: "gz.msgs.Double"
  lazy: true                # Default "false"
  direction: BIDIRECTIONAL  # Default "BIDIRECTIONAL" - Bridge both directions
                            # "GZ_TO_ROS" - Bridge Gz topic to ROS
                            # "ROS_TO_GZ" - Bridge ROS topic to Gz

@github-project-automation github-project-automation bot moved this from Inbox to Done in Core development Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant