Graphics graphic switch direction when crosssing 0

asked 2015-07-21 08:56:59 -0500

ngoldfarb gravatar image

updated 2015-07-21 14:37:58 -0500

gvdhoorn gravatar image

I am trying to build a real time visualizer for my robot. I am using rviz to do this. When I move the robot the simulation model moves the same way. However, when I spin the robot through 0, it takes the "long way" to get there. it ends up in the right spot but it has to switch directions to do this. is there a way to make it do it does not switch directions but move thought the 0 point?

Here is my URDF file:

<?xml version="1.0"?>
<robot name="videoray">

  <link name="body">
    <inertial>
      <mass value="1"/>
      <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
      <origin/>
    </inertial>
    <visual>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
         <mesh filename="file:///home/nathaniel/simulation/src/ros-videoray-sim/move_videoray/graphics/videoray_robot.stl"/> 
      </geometry>
    </visual>
  </link>

  <joint name="sonar_joint" type="fixed">
    <parent link="body" />
    <child link="sonar_link" />
  </joint>


  <link name="sonar_link">
    <inertial>
      <mass value="0.001" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
               iyy="0.0001" iyz="0.0" izz="0.0001" />
    </inertial>
  </link>
</robot>

and how I am publishing the node:

current.orientation.x = kalman_pos[5]
current.orientation.y = kalman_pos[4]*-1
current.orientation.z = kalman_pos[6]*-1
current.orientation.w = kalman_pos[7]

broadcaster.sendTransform( (current.position.x,current.position.y,current.position.z), 
                            (current.orientation.x,current.orientation.y,current.orientation.z,
                            current.orientation.w),
                            rospy.Time.now(), "body", "odom" )
edit retag flag offensive close merge delete

Comments

It would probably help to know a bit more about "your robot": what kind of robot is this (mobile base, serial manipulator (arm))? How did you model it in your URDF (continuous joints, or revolute), etc.

gvdhoorn gravatar image gvdhoorn  ( 2015-07-21 09:30:40 -0500 )edit

I updated my question to include the code.

ngoldfarb gravatar image ngoldfarb  ( 2015-07-21 12:16:38 -0500 )edit