Home | Tutorials | Wiki | Issues
Ask Your Question
0

how to modify the pose of a robot by msgs?

asked 2014-01-15 20:33:29 -0500

Sam gravatar image

updated 2014-01-15 20:42:50 -0500

The name of a existing model is "ball". I use "this->node->Advertise<msgs::pose>(std::string("~/") + ball + "/pose");" to create a transport::PublisherPtr, but it doesn't work. How to create a publisherPtr? thanks.

edit retag flag offensive close merge delete

Comments

Can you provide more information about how it fails? Does it fail to compile? Seg fault or the message is not published? Please also include a code example.

isura gravatar imageisura ( 2014-01-16 11:29:37 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-01-16 17:35:23 -0500

nkoenig gravatar image

A model does not automatically create a topic through which you can modify it's pose.

There is a general purpose topic called ~/model/modify which receives a model message

You can use the topic and message like this:

transport::PublisherPtr modelPub = this->node->Advertise<msgs::Model>("~/model/modify");
msgs::Model msg;
msg.set_name("ball");
msgs::Set(msg.mutable_pose(), math::Pose(0, 0, 10, 0, 0, 0));
modelPub->Publish(msg);
edit flag offensive delete link more

Comments

thanks a lot!

Sam gravatar imageSam ( 2014-01-16 19:20:02 -0500 )edit

I am trying to do the same thing but I'm having some issues. I started from the following example (https://bitbucket.org/osrf/gazebo/src/e18491b2ff1a/examples/stand_alone/publisher/?at=default) and modified it to use the above code. The result is that the model jumps around in Gazebo, always returning to it's original position, in a very discontinuous way. You can see my code here: http://pastebin.com/BG1HLhDn

What is the problem?

NickDP gravatar imageNickDP ( 2014-09-10 18:27:28 -0500 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2014-01-15 20:33:29 -0500

Seen: 1,153 times

Last updated: Jan 16 '14