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

Set model and link states of Clearpath Husky-Grizzly in Gazebo

asked 2014-12-04 16:59:11 -0500

2ROS0 gravatar image

updated 2014-12-05 14:15:25 -0500

Hi,

I'm working with the Clearpath Husky and Grizzly simulators. And so I have the model loaded in Gazebo. And also the visualization in Rviz.

Now, when I reset the model state of the robot in Gazebo using:

rosservice call /gazebo/set_model_state

the robot is set to that state in the Gazebo simulator but it doesn't reflect the changes in RViz.

EDIT: This is probably becase Rviz is reading off the joint_states which are not reset by the above command. Now, I possibly can use:

rosservice call /gazebo/set_link_state

and achieve what I want. But there are a number of links on the robot model and I don't want to specify all of them because the relationship between all these links is already known (like in the tf tree)

How can I solve this problem? Is there not a relationship between the model state values and the link state values since both are the robot. I guess what I am asking is - how do I reset the joint states?

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-12-08 07:42:40 -0500

2ROS0 gravatar image

Update: deleting the model and respawning it works. Still need to restart the spawn_model node for that. Is there a faster way to do it through the spawn_model rosservice? I'm not sure how I'm going to run xacro.py on it before loading the model through the service.

edit flag offensive delete link more
1

answered 2014-12-04 23:47:19 -0500

Ryan gravatar image

What states are you setting and what topics/tfs are you monitoring in rviz? If you're changing the position of the robot directly and you've got rviz set up to monitor odometry (or something equivalent), this would be expected behaviour. After all, the robot wheels (real or simulated) haven't moved, and that's needed for odometry to change.

edit flag offensive delete link more

Comments

I'm setting the pose and the twist of the Gazebo model. I expected that to change the pose in Rviz as well. In any case, what's a way to get rviz states to change?

2ROS0 gravatar image 2ROS0  ( 2014-12-05 07:56:45 -0500 )edit

Normally, we try to interact with robots as if they're real. That is, using topics like cmd_vel. Have you tried that? For example, rostopic pub /cmd_vel geometry_msgs/Twist -r 100 '[0.5,0,0]' '[0,0,0]' (see http://www.clearpathrobotics.com/blog... )

Ryan gravatar image Ryan  ( 2014-12-06 17:55:40 -0500 )edit

Yes, that's what I'm using to test my algorithm. However, in order to reset the visualization in Rviz I need to start the node all over again since resetting the Gazebo model doesn't reset the link states that it sends to Rviz.

2ROS0 gravatar image 2ROS0  ( 2014-12-08 07:14:20 -0500 )edit

Not that I'm aware of. What do you need to do with xacro after it's spawned? If you're wanting to expand the model, I'd personally probably create a xacro beforehand and pass that in to the spawn pipeline.

Ryan gravatar image Ryan  ( 2014-12-11 08:43:42 -0500 )edit

I just need it to be spawned. So I can reset the model without restarting the node.

2ROS0 gravatar image 2ROS0  ( 2014-12-12 08:55:58 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-12-04 16:59:11 -0500

Seen: 991 times

Last updated: Dec 05 '14