how to assign sensor in sdf so that this converter can understand and work correctly
I am struggling how to assign a camera_link and camera_optical_link in the sdf file. From this document, it suggest to only use sdf for easy maintenance, and I found this package to take sdf and convert to urdf.
But in the readme of this package, it said the
Looking for anyone could help me clearing the concept.
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" >
<joint name="camera_joint" type="fixed">
<parent link="chassis"/>
<child link="camera_link"/>
<origin xyz="0.305 0 0.08" rpy="0 0 0"/>
</joint>
<link name="camera_link">
<visual>
<geometry>
<box size="0.010 0.03 0.03"/>
</geometry>
<material name="red"/>
</visual>
</link>
<joint name="camera_optical_joint" type="fixed">
<parent link="camera_link"/>
<child link="camera_link_optical"/>
<origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/>
</joint>
<link name="camera_link_optical"></link>
<gazebo reference="camera_link">
<material>Gazebo/Red</material>
<sensor name="camera" type="camera">
<pose> 0 0 0 0 0 0 </pose>
<visualize>true</visualize>
<update_rate>10</update_rate>
<camera>
<horizontal_fov>1.089</horizontal_fov>
<image>
<format>R8G8B8</format>
<width>640</width>
<height>480</height>
</image>
<clip>
<near>0.05</near>
<far>8.0</far>
</clip>
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<frame_name>camera_link_optical</frame_name>
</plugin>
</sensor>
</gazebo>
</robot>
Actually I want to know how about urdf file can be written in sdf format. The plugin part can be skipped.
Push! Anyone has idea how to work on this? should I put the sensor tag outside the link tag? I dont mind sharing my sdf to anyone would like to help on this. Thanks so much. I would like to keep only one sdf file instead of creating a urdf that duplicate the sdf.
You probably have figured it out by now but for anyone coming across this issue in the future, the sensor should be nested inside the link as in "regular" sdf. This approach might raise a warning like [WARN] [1749037370.899454319] [sdformat_urdf]: SDFormat link [link] has a <sensor>, but URDF does not support this but the model is still spawned correctly. If you take a look at the test files inside this repository (the imu example specifically), the developers have also used this approach.
Thanks for answering the question @elmeripk ! I'll close this as answered.
Here's the link to the test file with the IMU:
https://github.com/ros/sdformat_urdf/blob/9cbd5153f48fb192f394f5bb32bb8ee16e6263b1/sdformat_test_files/models/link_sensor_imu/link_sensor_imu.sdf#L30-L31
Yes and thanks. I have just ignored the warning for right now.