0
$\begingroup$

Rosanswers logo

Hi all. I've just started using ROS yesterday - i've completed the 15 or so beginner tutorials that utilize turtlesim. I've begun writing my own .cpp file - since i'm a beginner this is all pretty new to me. I'm trying to figure out how to create the actual turtlesim simulator window from C++ code. This sounds like it would be easy so can anyone help? I've been looking at several of the files in the documentation but there isn't a real clear answer.


Originally posted by Index on ROS Answers with karma: 1 on 2012-01-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The turtlesim window is a separate executable. Typically, C++ does not support running executable from code. Typically you have to use the system() command to do so. But, there is also a system called rosspawn that might just do what you want it to do.

I'm not sure what the end goal is, but there are a couple of options I can think of:

If you're trying to launch turtlesim at the same time as one of your own executables, I would suggest roslaunch.

If you're looking to do something that you cannot do via turtlesim's topics and services, I would suggest looking at the code for turtlesim in the turtlesim package (probably in the src directory). You might be able to modify it to your needs.

If you edit your question to be more specific as to the goal, I might be able to help further.


Originally posted by DimitriProsser with karma: 11163 on 2012-01-27

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by DimitriProsser on 2012-01-27:
I would start a new question for that so that others can benefit from it.

Comment by Index on 2012-01-27:
Thanks, using a launch file and roslaunch worked! I just want to learn the basics and build from there - I am a beginner after all. After looking at the sample source .cpp files, there doesn't seem to be a clear way to just simply move the robot forward or turn - can you help me with that?

$\endgroup$

Your Answer

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