Hello, everyone!
An error occurred while configuring the robot arm as an xacro file. The current simple model looks like this:
<?xml version="1.0" ?>
<robot name="manipulator" xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- Begin include -->
<xacro:include filename="$(find manipulator_description)/urdf/links_joints.xacro" />
<!-- END include -->
<!--Begin robot description -->
<link_n_box name="base_link"
origin_rpy="0 0 0" origin_xyz="0 0 0"
size="1 1 1" />
<joint name="joint_01" type="revolute">
<axis xyz="0 1 0"/>
<limit effort="1000.0" lower="-3.14" upper="3.14" velocity="0.5"/>
<origin rpy="0 0 0" xyz="0 0 0.5"/>
<parent link="base_link"/>
<child link="link_01"/>
</joint>
<link name="link_01">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.2" />
<geometry>
<cylinder radius="0.35" length="0.4"/>
</geometry>
</visual>
</link>
<joint name="joint_02" type="revolute">
<axis xyz="0 1 0"/>
<limit effort="1000.0" lower="-3.14" upper="3.14" velocity="0.5"/>
<origin rpy="0 0 0" xyz="0 0 0.4"/>
<parent link="link_01"/>
<child link="link_02"/>
</joint>
<link name="link_02">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.4" />
<geometry>
<cylinder radius="0.15" length="0.8"/>
</geometry>
</visual>
</link>
<joint name="joint_03" type="revolute">
<axis xyz="0 1 0"/>
<limit effort="1000.0" lower="-3.14" upper="3.14" velocity="0.5"/>
<origin rpy="0 0 0" xyz="0 0 0.8"/>
<parent link="link_02"/>
<child link="link_03"/>
</joint>
<link name="link_03">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.4" />
<geometry>
<cylinder radius="0.15" length="0.8"/>
</geometry>
</visual>
</link>
<joint name="joint_04" type="revolute">
<axis xyz="0 1 0"/>
<limit effort="1000.0" lower="-3.14" upper="3.14" velocity="0.5"/>
<origin rpy="0 0 0" xyz="0 0 0.8"/>
<parent link="link_03"/>
<child link="link_04"/>
</joint>
<link name="link_04">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.4" />
<geometry>
<cylinder radius="0.15" length="0.8"/>
</geometry>
</visual>
</link>
<joint name="joint_05" type="revolute">
<axis xyz="0 0 1"/>
<limit effort="1000.0" lower="-3.14" upper="3.14" velocity="0.5"/>
<origin rpy="0 0 0" xyz="0 0 0.8"/>
<parent link="link_04"/>
<child link="link_05"/>
</joint>
<link name="link_05">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.125" />
<geometry>
<cylinder radius="0.15" length="0.25"/>
</geometry>
</visual>
</link>
<!--END robot description -->
</robot>
The macro files to be linked are as follows:
<?xml version="1.0" ?>
<robot name="manipulator" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="link_n_box" params="name origin_rpy origin_xyz size">
<link name="${name}">
<visual>
<origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
<geometry>
<box size="${size}" />
</geometry>
</visual>
</link>
</xacro:macro>
<xacro:macro name="joint_n" params="name type axis_xyz origin_rpy origin_xyz parent child">
<joint name="${name}" type="${type}">
<axis xyz="${axis_xyz}" />
<limit effort="1000.0" lower="-3.14" upper="3.14" velocity="0.5" />
<origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
<parent link="${parent}" />
<child link="${child}" />
</joint>
</xacro:macro>
<xacro:macro name="link_n_cylinder" params="name origin_xyz origin_rpy radius length">
<link name="${name}">
<visual>
<origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
<geometry>
<cylinder radius="${radius}" length="${length}" />
</geometry>
</visual>
</link>
</xacro:macro>
</robot>
This is the launch file used for this.
<!-- arg setting -->
<arg name="model" default="$(find robot_arm_description)/urdf/robot_arm.xacro"/>
<arg name="gui" default="true"/>
<arg name="rvizconfig" default="$(find robot_arm_description)/launch/config.rviz"/>
<!-- select model -->
<param name="robot_description" command="$(find xacro)/xacro $(arg model)"/>
<!-- Combine joint values -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
<!-- Show in Rviz -->
<node name="rviz" pkg="rviz" type="rviz"/>
<!-- send joint values-->
<node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui">
</node>
</launch>
Problems arising from robots are invisible in the rviz environment. That is, the interworking of xacro is considered a problem.
If the file is used without interworking, it works normally. As a result, only the base_link is in the macro state as soon as it is linked with the xacro file, this xacro file. What am I doing wrong now?
The example I am referring to now is this. https://www.youtube.com/watch?v=2lfwBpH-Ty8&t=492s "The Construct"
Help me.
Originally posted by jaeeunkim on ROS Answers with karma: 3 on 2023-03-10
Post score: 0