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

How to replace a robot in stage_ros

asked 2015-05-30 09:29:42 -0500

Dayire gravatar image

Hello,

Does anyone know how can I replace a robot (like teleport it), let's say to coordinates 0,0,0 while using stage simulator [Ros] ?

I tried publishing in various topics as /Odom or /base_ground_pose but neither worked.

Any solution possible in either terminal or by coding in ros.

Thanks !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-01 03:23:12 -0500

daenny gravatar image

Hi, it is currently not implemented in the stage_ros node. But it can be implemented rather easily using the stage API. (If you do, please make a pull request, I was planning to do something similar ;) ). I already made a pull request for something similar, namely resetting the robots to their initial position when stage started: https://github.com/ros-simulation/sta...

You would need to implement a "MoveRobot" service or something similar, i.e. create a new service in which has the robot name/number and the target position and then move to corresponding robot.

This is the code snippet I used to replace the robots (the initial poses are saved at startup, see here):

StageNode::cb_reset_srv(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response){       ROS_INFO("Resetting stage!"); 
for (size_t r = 0; r < this->positionmodels.size(); r++) {
    this->positionmodels[r]->SetPose(this->initial_poses[r]);
    this->positionmodels[r]->SetStall(false); }
return true; }
edit flag offensive delete link more

Comments

Thanks so much for this ! Is there since I miss time anyway of doing the same without using a service ? Like coding it directly in my program ? Thanks !

Dayire gravatar image Dayire  ( 2015-06-01 15:10:17 -0500 )edit
1

As I said above, you need to change the stage_ros node itself, since it does not have this functionality implemented. Your code needs to be able to interact with the stage_ros node preferably by service calls (i.e. as i implemented the reset), which you then can use in your own program.

daenny gravatar image daenny  ( 2015-06-02 05:08:18 -0500 )edit

Alright, I'll try to do that. Thanks so much :)

Dayire gravatar image Dayire  ( 2015-06-02 06:17:20 -0500 )edit

Hello, i have used this service you created,but after i reset my robot position, the robot can't be navigated true, do you know why?

piliboss gravatar image piliboss  ( 2017-01-07 04:39:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-05-30 09:29:42 -0500

Seen: 461 times

Last updated: Jun 01 '15