0
$\begingroup$

Rosanswers logo

hi, I'm trying to simulate two differential drive robots walking in a corridor (the map is provided as png and yaml files, and I cannot change it) using stage. Since one of the robots uses a reinforcement-learning-based controller I need to model the state of the simulation. The state is composed of various information such as if the robot has reached its goal or if a collision (no matter what kind of collision) has occurred. The problem I'm having is to detect if the robot running my controller has collided with something. Since the image representing the robot changes in stage, I assume that stage is aware of such collision and I would like to retrieve such information. Can you help me doing this? Thanks Andrea


Originally posted by Mago Nick on ROS Answers with karma: 385 on 2013-06-21

Post score: 3


Original comments

Comment by devesh on 2013-11-20:
I am in an exactly similar situation. RL controller with stageros for simulation.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

As gustavo suggested, I modified src/stageros.cpp. The boolean 'stall' is set iff there is a collision at the instant. Stalled() function returns this value and can be called to check.


Other details regarding the solution

But after modifying, 'rosmake stage' does not work for some reason (just like this thread http://answers.ros.org/question/87666/no-executable-in-bin-with-rosmake-on-groovy/)

So, after modifying the permissions of the stage stack folder I ran 'make'. After downloading the md5sum tarball into the build folder, it compiled most of the code. But then, it gave out the error "undefined reference to Fl::wait(double)".

Turns out, it is a problem with gcc and ordering of flags. So, as suggested in http://player-stage-gazebo.10965.n7.nabble.com/Stage-install-error-td6455.html, I edited CMakeLists.txt towards the bottom into (I just added the 3rd line)

rosbuild_add_compile_flags(bin/stageros ${STAGE_CFLAGS_OTHERS})
target_link_libraries(bin/stageros ${STAGE_LIBRARIES})
target_link_libraries(bin/stageros fltk fltk_gl fltk_images)
rosbuild_add_link_flags(bin/stageros ${STAGE_LDFLAGS_OTHERS})

Originally posted by devesh with karma: 104 on 2013-11-21

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by jsergeant on 2015-09-09:
hi devesh, can you please elaborate on how you achieved this? I can't seem to get anything to compile on ROS jade

Comment by devesh on 2015-09-10:
Hi jsergeant, unfortunately I'm out of touch with ROS and don't use it anymore. I remember it was a tedious chase to fix errors for compilation but don't even remember what all I did to get it to work.

$\endgroup$
0
$\begingroup$

Rosanswers logo

As suggested by @gustavo.velascoh and @devesh, one can modify src/stageros.cpp. You can find these two lines in src/stageros.cpp which gives you a hint:

//@todo Publish stall on a separate topic when one becomes available
//this->odomMsgs[r].stall = this->positionmodels[r]->Stall();

Note that Stall() should be Stalled().

In my case:

if(this->positionmodels[r]->Stalled()){
        // do something
}

Originally posted by wuch with karma: 11 on 2019-10-30

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.