ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Robot behaviour in rviz is different when launched with .launch file and when the node is run directly.

asked 2014-08-13 00:33:33 -0500

sumanth gravatar image

updated 2014-08-13 00:34:36 -0500

I am using th example from this link: http://wiki.ros.org/navigation/Tutori... , for publishing my odo data from the robot, though I have made some small changes like:

  1. Added a callback, so as to subscribe to the incoming data from the robot.
  2. Changed the velocities to suit for differential drive robot.
  3. Small change in calculation of the robot position based on odo.

When I run the node with the launch file as below:

<launch>
        <param name="robot_description" command="cat $(find my_robot_urdf)/my_robot.urdf" />
        <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
        <node name="my_state_publisher_temp" pkg="security_robot_urdf" type="my_state_publisher_temp" />
</launch>

then open the rviz, select /odom as fixed frame in global options and add a robot model, I can see that robot moves in simulation exactly how the real robot moves in the world.

But when I run the same node using "rosrun" as rosrun folder my_state_publisher_temp, then open the rviz, select /odom as fixed frame in global options and add a robot model, I can see only the base_link moving according to the real robot in the world, But other links (I have wheels, scanner etc.) remains rigid at the initial position.

any insights why this happens..?

Many thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-08-13 00:51:23 -0500

ahendrix gravatar image

updated 2014-08-13 02:00:47 -0500

In addition to running your nodes, the launch file you posted also sets the /robot_description parameter and runs the robot_state_publisher node.

Are you setting the /robot_description parameter and running robot_state_publisher when you run your node by hand?

EDIT

You can set the /robot_description parameter with:

rosparam set /robot_description -t my_robot.urdf

And you can run the robot_state_publisher node with rosrun:

rosrun robot_state_publisher robot_state_publisher

(Note how both of these commands resemble the contents of your launch file)

edit flag offensive delete link more

Comments

No I guess, How can I do this..?

sumanth gravatar image sumanth  ( 2014-08-13 01:09:08 -0500 )edit

Super now it's working. and I got know how to set the parameters. Many many thanks.

sumanth gravatar image sumanth  ( 2014-08-13 02:51:29 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2014-08-13 00:33:33 -0500

Seen: 214 times

Last updated: Aug 13 '14