gazebo camera topic wont show in rostopic list
Hello, I am currently trying to deploy object detection in gazebo world but when I try to subscribe to the camera topic from gazebo I cant see it in rostopic list. here is what i do: 1) ros launch my gazebo world. 2) spawn my camera sdf file with the ros camera plugin included.
I can see the camera topic under gazebo.msgs.ImageStamped but I cant see the topic in rostopics or RVIZ.
I would appreciate any help as this issue have been bothering me for two days.
world launch File:
<launch>
<arg name="debug" value="false"/>
<arg name="gui" value="true"/>
<arg name="paused" value="true"/>
<arg name="world" value="/home/islam/catkin_ws/src/environment/world/world_test.world"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(arg world)"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="true"/>
<arg name ="verbose" value ="true" />
</include>
</launch>
Spawn camera:
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<include file="$(find environment)/launch/spawn_sdf.launch">
<arg name="camera_name" value="cam" />
<arg name="x" value="0.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.0" />
<arg name="roll" value="0"/>
<arg name="pitch" value="0"/>
<arg name="yaw" value="0.0" />
<arg name="sdf_camera_file" value="$(find environment)/world/camera/model.sdf" />
</include>
</launch>
Camera model.sdf:
<?xml version='1.0'?>
<sdf version='1.6'>
<model name='camera'>
<pose frame=''>0 0 10 0 1.54 0</pose>
<link name='link'>
<visual name='visual'>
<geometry>
<box>
<size>0.1 0.1 0.1</size>
</box>
</geometry>
</visual>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
<static>1</static>
<allow_auto_disable>0</allow_auto_disable>
<!--Gazebo Camera Plugin-->
<gazebo reference="camera">
<sensor type="camera" name="camera">
<update_rate>30.0</update_rate>
<camera name="yolo_camera">
<horizontal_fov>1.4</horizontal_fov>
<image>
<width>800</width>
<height>800</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.02</near>
<far>300</far>
</clip>
<noise>
<type>gaussian</type>
<!-- Noise is sampled independently per pixel on each frame.
That pixel's noise value is added to each of its color
channels, which at that point lie in the range [0,1]. -->
<mean>0.0</mean>
<stddev>0.007</stddev>
</noise>
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>/yolo_camera/camera</cameraName>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>camera</frameName>
<hackBaseline>0.07</hackBaseline>
<distortionK1>0.0</distortionK1>
<distortionK2>0.0</distortionK2>
<distortionK3>0.0</distortionK3>
<distortionT1>0.0</distortionT1>
<distortionT2>0.0</distortionT2>
</plugin>
</sensor>
</gazebo>
</link>
</model>
</sdf>
Asked by IslamFA on 2021-10-12 13:59:29 UTC
Comments
Try changing
<gazebo reference="camera">
to<gazebo reference="camera_link">
and<frameName>camera</frameName>
to<frameName>camera_link</frameName>
. I don't see anything else.Asked by osilva on 2021-10-13 07:50:45 UTC
I figured out what was wrong. it was gazebo as usual. I was working on a fresh install of ros melodic and it had gazebo 9.0 and it was not great. when I upgraded to gazebo 9.9 the issues got solved. also, changed camera to camera_link before that. thank you for your reply.
Asked by IslamFA on 2021-10-13 08:09:32 UTC
Great to hear it's solved. It would be good you document your answer so others benefit in the future. You may answer your own question. Cheers.
Asked by osilva on 2021-10-13 08:53:17 UTC