Hello!
I want to use iris rplidar model in gazebo simulation to test collision avoidance algorithms in forest-like environment. I am using ros2 framework for this but however I am unable to get the camera and lidar data on ros2 topics list.
I successfully launched the gazebo simulation using make px4_sitl gazebo-classic_iris_rplidar
, after this I connect the ros2 mircodds to using micro-ros-agent udp4 --port 8888
command. Now from here I can easily control the drone using a ros2 package. But I cannot get the lidar and image data as ros2 topics.
When I do ros2 topic list following list is displayed
/fmu/in/obstacle_distance /fmu/in/offboard_control_mode /fmu/in/onboard_computer_status /fmu/in/sensor_optical_flow /fmu/in/telemetry_status /fmu/in/trajectory_setpoint /fmu/in/vehicle_attitude_setpoint /fmu/in/vehicle_command /fmu/in/vehicle_mocap_odometry /fmu/in/vehicle_rates_setpoint /fmu/in/vehicle_trajectory_bezier /fmu/in/vehicle_trajectory_waypoint /fmu/in/vehicle_visual_odometry /fmu/out/failsafe_flags /fmu/out/sensor_combined /fmu/out/timesync_status /fmu/out/vehicle_attitude /fmu/out/vehicle_control_mode /fmu/out/vehicle_global_position /fmu/out/vehicle_gps_position /fmu/out/vehicle_local_position /fmu/out/vehicle_odometry /fmu/out/vehicle_status /parameter_events /rosout
I can see the sensor data using gazebo topic visualisation.
From the previous topic I see that it is a plugin issue but I couldn’t get an idea how to solve it.
@Rugved_katole I don’t think it is expected to publish lidar topics to ros2
You need to check whether the gazebo rplidar plugin should be publishing to ros2 or not: PX4-SITL_gazebo-classic/model.sdf at 5610c3fb441a2f3babc8ad7a63c8c4ce3e40abfa · PX4/PX4-SITL_gazebo-classic · GitHub
Thanks for your reply.
I tried to do that
I changed it as given in ros2 Migration guide But still I am unable to get them as ros2 topics. My sdf file for rplidar is as follows.
<?xml version="1.0" ?>
<inertial>
<pose>0 0 0 0 0 0</pose>
<mass>0.19</mass>
<inertia>
<ixx>4.15e-6</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>2.407e-6</iyy>
<iyz>0</iyz>
<izz>2.407e-6</izz>
</inertia>
</inertial>
<visual name="visual">
<geometry>
<box>
<size>0.02 0.05 0.05</size>
</box>
</geometry>
</visual>
<sensor name="laser" type="ray">
<ray>
<scan>
<horizontal>
<samples>360</samples>
<resolution>1</resolution>
<min_angle>-3.14</min_angle>
<max_angle>3.14</max_angle>
</horizontal>
</scan>
<range>
<min>0.2</min>
<max>6</max>
<resolution>0.05</resolution>
</range>
<noise>
<type>gaussian</type>
<mean>0.0</mean>
<stddev>0.01</stddev>
</noise>
</ray>
<plugin name="laser" filename="libRayPlugin.so" />
<plugin name="gazebo_ros_head_rplidar_controller" filename="libgazebo_ros_ray_sensor.so">
<ros>
<topicName>laser/scan</topicName>
<!-- <remapping>~/out:=scan</remapping> -->
</ros>
<output_type>sensor_msgs/LaserScan</output_type>
</plugin>
<always_on>1</always_on>
<update_rate>10</update_rate>
<visualize>true</visualize>
</sensor>
</link>
</model>
I am very new to using the gazebo plugins. If you could point out what changes I need to make to get it as ros2 topics, it would be great.