The purpose of this project is to introduce new members to ROS and Git. You will learn how to use ROS to send text between terminal windows and how to use git to share and version your code.
First you will have to get the clone the repository. The process is quite simple. If you don't already have git on your Ubuntu install get it by running sudo apt update followed by sudo apt install git. Follow these steps to get the code:
- Navigate into ~/catkin_ws/src :
cd ~/catkin_ws/src.~/is a shorthand for your user's home directory. - Clone the repository :
git clone https://github.com/pennaerial/bootcamp.git. This will make a local copy of the repository on your computer. - Now build catkin :
catkin buildorcatkin build bootcamp. The latter will install only bootcamp. Even though we are using python, catkin will run a script which adds your project to ROS, so that you can run roscommands such asroscdorrosrun. - Restart terminal or
source~/.bashrc`.
At this point you should take a minute to learn about git. This guide is a nice place to start. I recomend that you are familiar with command line git, however it is up to you. My favorite graphical git client is GitKraken, which you can get through the student developer pack. You can also use version control plugins that are avaiable for most IDEs.
Hah, so git is not the same things as GitHub. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency, while GitHub is a really handy service that allows us to store code online and collaborate. Please get familiar with these guides.
- Make a new issue in the bootcamp repository. Call it something descriptive like "[YOURNAME]'s Tutorial". Note the issue number.
- Go back to git (on your computer) and make sure you are in
~/catkin_ws/src/bootcamp. - Make a new branch by typing
git branch [ISSUE#]-[DESCRIPTIVE NAME]. For example,git branch 47-DamianTutorial. This creates a local branch on your computer. - Checkout the new branch
git checkout [BRANCH NAME] - Push (upload) you branch to GitHub :
git push origin [BRANCH NAME]. Git will complain a bit at this point. It will ask you to run a couple commands to set your email adress etc. Just follow what it says.
If you navigate to bootcamp/src you will find two folders listener and publisher. Each one is a standalone python package. Your goal is to use ROS to send text messages from publisher to listener. When both "nodes" are open then by typing into publisher and pressing return I should see the message display in listener. A good place to get started is this tutorial on ros wiki.
- Start ros master node
roscore. - To run publisher:
rosrun bootcamp publisher - To run listener:
rosrun bootcamp listener
Once you finish working on your code and you test it's awesomeness it's time to share this with other people.
- Make sure you have checked out your branch:
git checkout [BRANCH NAME]. - View status
git status. - Stage your changes for commit. For every file that you want to upload do
git add [path]. For examplegit add src/publisher/publisher.py. - Commit your changes:
git commit -m "[DESCRIPTIVE MESSAGE]" - Push your code
git push. - Make a pull request on GitHub. Open the repository on GitHub and switch to your branch. Click new pull request. Good job! If I don't have any comments you're done.