0
$\begingroup$

Rosanswers logo

when launching turtlesim I usually get a different looking turtle bot every time, probably it's random. Is there some variable I can use to make turtlesim use the same specific turtle every time ?


Originally posted by flanel on ROS Answers with karma: 3 on 2022-05-04

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The only parameters that show up in rqt's Dynamic Reconfigure (at least in Foxy) are background_b background_g background_r and use_sim_time so I don't think so.

EDIT: So I checked the source code and I found out that it is indeed random. However, this portion is interesting. That code basically adds all the images from turtlesim/images to a vector and that vector is used to randomly pick a turtlebot.

This means you could build ros tutorials from source and simply delete all the files from the folder turtlesim/images except the one you want.

I'm not 100% sure this will work, but I am 95% sure this is the only way to use the same turtlesim every time.

EDIT 2. I decided to check if it would work. There is 1 small thing you need to change to the source code (besides removing the other images from the folder) to get it to work.

This portion is used to create the vector of images. More specifically its length is used. If you don't change it, there will be a vector of 6 'images' where only the first one really exists and the other 'images' don't exist.

So in order to get it to work, you need to remove the appends except for the append of the turtle you want (e.g. if you want to use the 'ardent' one, remove line 82-86).

I'm not sure if you find it worth it to go through all of this just to get the same turtle, but that's the way I found to do it.


Originally posted by Joe28965 with karma: 1124 on 2022-05-05

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by flanel on 2022-05-05:
:) Really really appreciate the effort on this tiny question. Your details gave me another idea. I'll just try to rename/replace all the other images with the one I want and see if it works.

Thank you very much

Comment by Joe28965 on 2022-05-05:
That might work too. However, it might also depend on those images having those names, so you might still need to rename them ardent.png bouncy.png etc. even if they're all copies of the foxy one (for instance). EDIT you already mentioned rename, so nevermind.

Comment by flanel on 2022-05-06:
Confirmed, it works with replace/rename, thanks @Joe28965

$\endgroup$

Your Answer

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