Changing Joint from Fixed to Revolute Breaks TF
Hello guys,
I'm fairly new to ROS and still learning. I've been struggling with this problem for a while, and I can't seem to solve it. I've dug through countless ROS Answers, but can't seem to find the solution.
I'm running through the URDF Tutorial and finished it. This is as in, if I run the last 13-diffdrive.launch
all starts up correctly. To prove to myself that I know how it works, I attempted to make R2D2's legs also rotate at his shoulders, by changing the joint from fixed
to revolute
, which also requires a few additional changes as well.
So first what I did was change the following in the *.urdf.xacro
file:
<joint name="base_to_${prefix}_leg" type="fixed">
<parent link="base_link"/>
<child link="${prefix}_leg"/>
<origin xyz="0 ${reflect*(width+.02)} 0.25" />
</joint>
to
<joint name="base_to_${prefix}_leg" type="revolute">
<parent link="base_link"/>
<child link="${prefix}_leg"/>
<origin xyz="0 ${reflect*(width+.02)} 0.25" />
<axis xyz="0 1 0"/>
<limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
<dynamics damping="0.0" friction="0.0"/>
</joint>
by copying code from the _gripper_joint
. When running the launch file again it opens RViz and Gazebo with a little wheel controlling interface. In Gazebo everything displays correctly, and I can see the new joint swiwels when I drive R2D2 around. But, in RViz the legs are displayed at the origin
and not at the shoulders. This because the TF Transform isn't published. I double checked this using the command rostopic echo /joint_states -n 1
, which didn't display the new shoulder joint.
According to the tutorial to get the joint state published you need to add a transmission. So added the transmission like below, again copying from the _gripper_joint
.
<joint name="base_to_${prefix}_leg" type="revolute">
<parent link="base_link"/>
<child link="${prefix}_leg"/>
<origin xyz="0 ${reflect*(width+.02)} 0.25" />
<axis xyz="0 1 0"/>
<limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
<dynamics damping="0.0" friction="0.0"/>
</joint>
<transmission name="$base_to_${prefix}_trans">
<type>transmission_interface/SimpleTransmission</type>
<actuator name="$base_to_${prefix}_motor">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
<joint name="$base_to_${prefix}_leg">
<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
</joint>
</transmission>
This breaks a few things, and I don't understand where I'm going wrong. The symptoms that I see are the following:
- Gazebo still seems to display the bot correctly, but gripper retracts into the body with no command given. This makes me think that some joints are getting confused.
- In Gazebo I've lost control of the wheel, which is also why I think some joints are getting confused.
- In RViz only half of the bot is loaded.
- Nothing is being published in the
/joint_states
topic. - In the terminal I get the ...
It would help (others) if you could show the complete urdf. It's a bit hard to figure out what the states of things is without it.
Also:
this is (most likely) only true if/when using Gazebo, as the standard
joint_state_publisher
won't care about transmissions at all.