Adding a camera to my urdf
Hello,
I am trying to add a camera to the end of an arm using xacros. The camera link URDF is:
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="camera" params="parent">
<link name="camera">
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://sensors_and_actuators/meshes/camara.stl" scale="0.1 0.1 0.1"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://sensors_and_actuators/meshes/camara.stl" scale="0.1 0.1 0.1"/>
</geometry>
</visual>
<inertial>
<mass value="1e-5" />
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
</inertial>
</link>
<joint name="sensor_joint" type="fixed">
<parent link="${parent}"/>
<child link="camera"/>
<origin rpy="0 1.5620 0" xyz="0.0475 0.0 0.0"/>
<axis xyz="1 0 0" />
</joint>
<gazebo reference="camera">
<sensor type="camera" name="camera_sensor">
<parent link="camera"/>
<update_rate>30.0</update_rate>
<camera>
<horizontal_fov>1.3962634</horizontal_fov>
<image>
<format>R8G8B8</format>
<width>800</width>
<height>800</height>
</image>
<clip>
<near>0.01</near>
<far>100</far>
</clip>
</camera>
<plugin name="${name}_camera_controller" filename="libgazebo_ros_camera.so">
<cameraName>arm_sensors/camera</cameraName>
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>camera</frameName>
</plugin>
</sensor>
</gazebo>
</xacro:macro>
</robot>
When I run the launch file it reports an error saying that the parent param is missing:
samper@samper:~$ roslaunch cern_tim_arm_simulator arm_tim_simulator.launch spawn_arm:=true robotic_arm:=schunk_lwa4p world:=tunnel spawn_collimator:=true camera_on_arm:=true
... logging to /home/samper/.ros/log/2c17a290-4b39-11e5-b79f-605718079cbb/roslaunch-samper-16690.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
Traceback (most recent call last):
File "/opt/ros/indigo/share/xacro/xacro.py", line 60, in <module>
xacro.main()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xacro/__init__.py", line 696, in main
eval_self_contained(doc)
File "/opt/ros/indigo/lib/python2.7/dist-packages/xacro/__init__.py", line 626, in eval_self_contained
eval_all(doc.documentElement, macros, symbols)
File "/opt/ros/indigo/lib/python2.7/dist-packages/xacro/__init__.py", line 552, in eval_all
(",".join(params), str(node.tagName)))
xacro.XacroException: Parameters [parent] were not set for macro camera
while processing /home/samper/ROS_Workspaces/ROS_Cern/src/ros_cern/tim_gazebo/load_world.launch:
while processing /home/samper/ROS_Workspaces/ROS_Cern/src/ros_cern/robotic_arm/launch/schunk_lwa4p_and_tim.launch:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/indigo/share/xacro/xacro.py '/home/samper/ROS_Workspaces/ROS_Cern/src/ros_cern/robotic_arm/arm_description/robots/schunk_lwa4p/schunk_lwa4p_arm_and_tim_camera.urdf.xacro'] returned with code [1].
Param xml is <param command="$(find xacro)/xacro.py '$(find robotic_arm)/arm_description/robots/schunk_lwa4p/schunk_lwa4p_arm_and_tim_camera.urdf.xacro'" if="$(arg camera_on_arm)" name="robot_description"/>
The traceback for the exception was written to the log file
I would really appreciate if someone could give me any clue. Thank you in advance.
JLuis Samper
PS: it only works if i delete the <camera> tag and its content