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

How to find the source code for a ROS 2 package, say, turtlesim?

asked 2021-07-01 08:02:27 -0600

updated 2021-07-02 08:00:09 -0600

I see that ROS2 tutorials uses turtlesim, but where is the source code (on Github) for the ROS2 turtlesim package? The one on GitHub seems to target ROS1 or maybe I am wrong.

edit retag flag offensive close merge delete

Comments

1

@Zhoulai Fu: would it perhaps be an idea to make your question (title) a little more generic? Something like "how to find the source code for ROS 2 packages?", and then use the turtlesim package as an example for which you'd like to find the source?

I feel that would help future users find the Q&A more easily.

gvdhoorn gravatar image gvdhoorn  ( 2021-07-02 04:14:13 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
7

answered 2021-07-01 08:14:59 -0600

gvdhoorn gravatar image

updated 2021-07-03 04:16:57 -0600

Edit: for future readers: please always prefer to install the binary version of ROS packages, if at all possible.

Building ROS packages from sources is not the recommended way to install them and should not be your default.


Easiest way to find source code for released (and indexed) packages would be index.ros.org.

For turtlesim specifically: index.ros.org/p/turtlesim:

ros index

In the screenshot:

  1. the main link to the source repository. In this case: https://github.com/ros/ros_tutorials.git
  2. the name of the branch. In this case: galactic-devel
  3. tabs which allow you to switch to a different ROS release. Note how GALACTIC is selected here. To switch to the Foxy version of the package/page, click the FOXY tab. The VCS Version field in the Repository Summary will automatically update to show the correct branch name (for Foxy it would switch to foxy-devel)
  4. a convenience button which will take you to the source repository and open the correct branch for the package version selected using the tabs (3). In this case: https://github.com/ros/ros_tutorials/...
edit flag offensive delete link more

Comments

it's also good to point out that you should select the ROS distro you're using near the top of the page. Then if you want to clone the repo or just look at the code, you should use the branch that's next to "VCS Version" in the summary (in this case galactic-devel), otherwise you might not get the right code or version of the code. If you click "Browse Code" on the right panel, it should lead you to the directory corresponding to the package on the right branch in the repo.

christophebedard gravatar image christophebedard  ( 2021-07-01 14:27:14 -0600 )edit
1

Good suggestion.

I've updated the screenshot and highlighted the various elements in the UI and their function.

gvdhoorn gravatar image gvdhoorn  ( 2021-07-02 04:07:13 -0600 )edit
1

answered 2021-07-01 08:11:10 -0600

vinny gravatar image

I believe this is what you are looking for: https://github.com/ros/ros_tutorials/...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-07-01 08:02:27 -0600

Seen: 2,303 times

Last updated: Jul 03 '21