This page will show you how to start working on a new or existing module and the best practices when using Git.
If you're not familiar with Git commands, you can use tools like GitHub Desktop, GitKraken or the built-in Git tools in VSCode to help you manage Git repositories.
When working on any new feature, you need to make sure your master branch is up to date. To do so you can use the built in Git tools or use the git fetch and git pull commands in the console.
git checkout master // To make sure you are on the master branch
git fetch
git pull
When working on a new feature, you will firstly need to create your own branch based on the master branch. This branch will be used to test and develop your new feature and will contain all the changes you make to the repository.
To create your branch you can use Git tools or run the following command to create your own branch and automatically checkout to it:
git checkout -b your-branch-name
It is important that your branch name uses a significative name and that each word is seprated by a hyphen. For example, if you're working on adding individual flipper modes you branch name should be something like: individual-flipper-control
To save your changes to Git you will need to write a commit. This is used to keep a history of the different changes made in your branch. Once you're changes are done and ready to be reviewed you can push all the committed changes using git push.
To test your feature, you will need to connect to the on-board computer over SSH and create a development ROS workpace.
Connect to the robot's router via wifi (RRLCapra) or ethernet. You can then start your SSH connection in your terminal.
When asked for a password, ask someone in the club
In your terminal run the following command:
ssh markhor@192.168.1.150
You are now connected to the robot!
To create your own dev workspace on the robot, the simplest option is to copy the existing stable workspace to the dev folder.
Navigate to the dev folder in your SSH terminal
cd ~/SSD/dev/
Copy the stable workspace to dev
cp -r ~/SSD/stable/markhor_ws your_workspace_name
Navigate to the ROS package you modified in your new development workspace. In this example let's say you changed a feature in markhor.
cd your_workspace_name/src/markhor
If the robot has internet access we will simply use GitHub to access your new code
git checkout your_dev_branch_name
git pull
If the robot doesn't have internet access we will need to use the scp command to transfer the files over SSH.
Open a new terminal that isn't connected over SSH and run the following command
scp -r path_to_your_ros_package markhor@192.168.1.150:~/SSD/dev/your_workspace_name/src/
It is recommended to use the first option when internet access is available and only use the second option when it is not available.
You are now ready to start building your new feature and test it.
Don't forget to build your project using the
catkin_makecommand at the root of your workspace folder.
Once your changes are tested and fully fonctionnal, you are now ready to create a pull request on GitHub. To do so, simply go on GitHub and open the repository you worked on. Then create a pull request on your new branch and assign reviewers.