clearpathrobotics / clearpath_simulator

BSD 3-Clause "New" or "Revised" License
8 stars 6 forks source link

Use gazebo bridge configuration files #38

Open SteveMacenski opened 3 weeks ago

SteveMacenski commented 3 weeks ago

I think you may have done the gazebo bridges the most challenging way possible (but kudos to you for not going crazy trying to read those files) and I might recommend another strategy for the sensor simulation generator.

Each package could boil down to a

    gz_bridge = Node(
        package='ros_gz_bridge',
        executable='parameter_bridge',
        name='bridge_ros_gz',
        parameters=[{
            'config_file': os.path.join(sim_dir, 'configs', 'gazebo_bridge.yaml'),
            'use_sim_time': True}],
        output='screen',
    )

Like you have now, except you can depend on a configuration yaml file that has the bridge specifics. For example for a 3D lidar:

# 3D Lidar
- ros_topic_name: "sensors/lidar0/points"
  gz_topic_name: "/sensors/lidar0/points"
  ros_type_name: "sensor_msgs/msg/PointCloud2"
  gz_type_name: "gz.msgs.PointCloudPacked"
  direction: GZ_TO_ROS

Since that's in a yaml configuration file, its probably much easier auto-generated & you can have a single sensors_simulation.launch.py that contains the call to create the bridge and the only difference needs to be which yaml it points to instead of having the generator auto-generate the launch file with the bridge configs embedded into it.

Then, your sensor simulation director would just contain (1) launch file with the bridge and you just need to generate (1) yaml that has the various configs of the structure above.

For example: https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation/blob/main/nav2_minimal_tb4_sim/configs/tb4_bridge.yaml

luis-camero commented 1 week ago

We have made these changes and merged them in the latest PR #39.