RoPod/Tutorials/Configuring GitHub: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
No edit summary
 
(15 intermediate revisions by 3 users not shown)
Line 3: Line 3:
<div STYLE="float: left; width:60%">
<div STYLE="float: left; width:60%">


In order to keep track of the changes made within the software of the entire project (so we know who screwed up :)) and have the ability to revert a the software to a previous revision, we are using version control. We will use GitHub for this. Every team member has the full history available, and can always stored his changes and go back to previous versions, even if he or she is off-line. However, note that we will use a central server every team member stores his or her changes to, and loads the changes others made from.  
In order to keep track of the changes made within the software of the entire project (so we know who screwed up :)) and have the ability to revert the software to a previous revision, we are using version control. We will use GitHub for this. Every team member has the full history available, and can always store his changes and go back to previous versions, even if he or she is off-line. However, note that we will use a central server every team member stores his or her changes to, and loads the changes others made from.  


Get familiar first with Git repositories https://git-scm.com/doc, and the used concepts: i.e. branches, commits, push, etc.
Get familiar first with Git repositories https://git-scm.com/doc, and the used concepts: i.e. branches, commits, push, etc.


Create an account in guthub https://github.com/, it will allow you to do changes to the repository
'''Create an account in github https://github.com/, it will allow you to do changes to the repository'''


Install Git in your system: https://git-scm.com/downloads
Install Git in your system: https://git-scm.com/downloads
Line 20: Line 20:
git config --global user.email "Mail_used_in_Git_Hub@domain.com"</pre>
git config --global user.email "Mail_used_in_Git_Hub@domain.com"</pre>


We will create 2 folder in your home directory: ropod-project and ropod-project-software. Therefore, cd to your home directory first:
Create a test repository in your account, then clone it in any location in your computer by:
 
<pre>cd ~</pre>
 
<pre>git init</pre>
 
Add the ROPOD test branch repository to your GIT
 
<pre>git remote add origin https://github.com/tue-ropod/ropod-project.git</pre>
 
Then clone both repositories and, for the rest of this tutorial, switch to the testbranch of in the ropod-project directory


<pre>
<pre>
git clone https://github.com/tue-ropod/ropod-project.git
git clone https://github.com/_your_username_/_repository_name_.git
git clone https://github.com/tue-ropod/ropod-project-software.git
</pre>
cd ropod-project
git checkout InittestBranch</pre>


Check the online repository, for now mostly only readme files:
For now, we will make a small demonstration on how to work with git in your repository.  
https://github.com/tue-ropod/ropod-project/tree/InittestBranch


Now, suppose you want to add a file. You can make a test by creating a test file and add  it, commit it and push it into the repository:
Now, suppose you want to add a file. You can make a test by creating a test file and add  it, commit it and push it into the repository:


<pre>cd ropod-project/documentation/reports
<pre>cd _repository_name_
echo "My first test file to add, commit and push into the repository" > YOURNAME_testfile.txt</pre>
echo "My first test file to add, commit and push into the repository" > YOURNAME_testfile.txt</pre>


Line 66: Line 53:


You will be prompted the username and password created in the github website.
You will be prompted the username and password created in the github website.
Now, if you check the online repository at https://github.com/tue-ropod/ropod-project/tree/InittestBranch you should see your file online.
Now, if you check the online repository you should see your file online.


= Structure of Ropod-repository: software =
As it is impossible to work without Matlab, lets [[ RoPod/Tutorials/Matlab Installation | install ]] it now.
All packages will be placed in the catkin_workspace/src. To add more structure between all the packages, this folder contains 3 other folders:
* functionalities: Here, all non-standard ros-packages are placed, such as ED, but also packages for localization, navigation, etc.
* platform: Files corresponding to specific platforms located in this folder, while general files for getting the communication with the sensors to work is placed in the robot_common sub-folder
* applications: In order to configure the robot for specific use-cases, all the relevant files are placed here.


Mostly, we program our worldmodel and its functionalities using C++. Not familiar yet with C++? Then it might be usefull to do the following C++ tutorials:
# [http://www.cplusplus.com/doc/tutorial/ cplusplus.com]: up to and including '''Name visibility'''
# [http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-096-introduction-to-c-january-iap-2011/lecture-notes/ MIT's Introduction to C++]: up to and including '''Classes'''
#* Remarks:
#** For now, use a simple editor such as ''gedit'' (the ubuntu version of Notepad). We will install a more advanced editor (IDE - Integrated Development Environment) later.
#** Once you have saved your C++ program (e.g. as ''example.cpp''), it can be compiled from a terminal using:<pre>g++ example.cpp -o example</pre>and run with<pre>./example</pre>
If a non-standard ros-package should be added while maintaining the commits of the previous package, use the following commands (in this case, the ed_tutorials package is moved):
<pre>
git remote add ed_tutorials_remote https://github.com/tue-robotics/ed_tutorials
git fetch ed_tutorials_remote
git merge -s ours --no-commit ed_tutorials_remote/master
git read-tree --prefix=ed_tutorials/ -u ed_tutorials_remote/master
git commit -m "Imported ed_tutorials as a subtree."
git mv ~/ropod-project/ed/ ~/ropod-project/catkin_workspace/src/functionalities/ED/
</pre>
As it is impossible to work without Matlab, lets [[ RoPod/Tutorials/Matlab Installation | install ]] it now.
</div>
</div>

Latest revision as of 12:57, 17 August 2020

In order to keep track of the changes made within the software of the entire project (so we know who screwed up :)) and have the ability to revert the software to a previous revision, we are using version control. We will use GitHub for this. Every team member has the full history available, and can always store his changes and go back to previous versions, even if he or she is off-line. However, note that we will use a central server every team member stores his or her changes to, and loads the changes others made from.

Get familiar first with Git repositories https://git-scm.com/doc, and the used concepts: i.e. branches, commits, push, etc.

Create an account in github https://github.com/, it will allow you to do changes to the repository

Install Git in your system: https://git-scm.com/downloads

sudo apt-get install git 

At this point you might want to follow this tutorial to get hands on experience on how a repository works: https://git-scm.com/docs/gittutorial. For now you can also continue to get a quick example on how to commit files.

Example

Send the username of your github account to the administrator of the RoPod repository (Currently César López) so that you can be added as contributor of the ropod project, you will receive a link back in your email in which you can accept the invitation to the project. Next, configure git in your laptop

git config --global user.name "USERNAME used in GitHub" 
git config --global user.email "Mail_used_in_Git_Hub@domain.com"

Create a test repository in your account, then clone it in any location in your computer by:

git clone https://github.com/_your_username_/_repository_name_.git

For now, we will make a small demonstration on how to work with git in your repository.

Now, suppose you want to add a file. You can make a test by creating a test file and add it, commit it and push it into the repository:

cd _repository_name_
echo "My first test file to add, commit and push into the repository" > YOURNAME_testfile.txt

You have created the YOURNAME_testfile.txt, which you will add to version-control:

git add YOURNAME_testfile.txt 

Now the file is added to version control but is not committed yet, run:

git status

and you will be able to see that the file was added and not committed yet. You can indeed add more files if desired. Next, commit the file:

git commit -m "Here you can add a comment to this commit, i.e. commit test "

Always try to put a meaningful comment in the message field of your commit. In this way other people know what is your commit for. By the way, after three months it could be really useful for yourself as well! Now run again:

git status

Notice that there is nothing to commit but you received the message that your branch is ahead of ‘origin/InittestBranch’, which is the branch we are using in the online repository.

git push -u origin InittestBranch

You will be prompted the username and password created in the github website. Now, if you check the online repository you should see your file online.

As it is impossible to work without Matlab, lets install it now.