The normal work-flow for this course will be to log into a lab machine, clone a repository from stu, make your changes, then push those changes back to stu before logging out. This activity will walk you through that process, along with the steps of creating a ROS package.
Complete the following steps in order to create an empty Mercurial repository on stu:
ssh YOUR_EID@stu.cs.jmu.edu
cd /cs/students/cs354/f15/YOUR_EID
wander
and initialize the repository:
mkdir wander cd wander hg init
.hg
:
$ ls -la total 12 drwxr-xr-x 3 spragunr faculty 4096 Sep 10 08:03 . drwxr-xr-x 4 spragunr faculty 4096 Sep 10 08:02 .. drwxr-xr-x 3 spragunr faculty 4096 Sep 10 08:03 .hgCongratulations! You have a mercurial repository.
exit
. The
remaining steps will be completed locally.
Mercurial is able to clone a remote repository over SSH. I'm providing a shell script that automates this process.
In addition to cloning your repository, this script makes sure
that ~/catkin_ws
is properly
configured as a catkin workspace.
hg_clone.sh
and make sure that it is executable:
chmod +x hg_clone.shOR
chmod 755 hg_clone.sh
$ ./hg_clone.sh Enter eid: spragunr Enter repository name: wander INITIALIZING WORKSPACE Creating symlink "/home/student/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/indigo/share/catkin/cmake/toplevel.cmake" CLONING PACKAGE hg clone ssh://spragunr@stu.cs.jmu.edu/../../../students/cs354/f15/spragunr/wander /home/student/catkin_ws/src/wander no changes found updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
If all went well in the previous step, your repository should now
be cloned to /home/student/catkin_ws/src/wander
. The next step
is to convert this empty folder to a properly configured ROS
package.
src
folder:
cd ~/catkin_ws/src/
catkin_create_pkg wander std_msgs rospy
wander
folder, you should now see at least two files: CMakeLists.txt
, package.xml
. Update package.xml
with the correct maintainer and author information.
wander/ package.xml <-- Package information CMakeLists.txt <-- Build configuration src/ <-- Importable Python modules go here. wander/ <-- Python package for exportable modules. __init__.py <-- This file turns the folder into a package. useful_module.py rviz/ <-- rviz configuration files. wander.rviz launch/ <-- Launch files wander.launch msg/ <-- Message files scripts/ <-- Scripts that create Python ROS nodes. wander.py announce.py srv/ <-- Service files
Create a scripts
directory and place your forward.py
, bumper.py
and wander.py
files inside it.
catkin_make
Once this command completes, there should be devel
and build
directories along-side the
existing src
directory.
source devel/setup.bash rospack profile
The first command will configure your environment so that the ROS system is aware of your newly created package. The second command isn't strictly necessary. It forces an immediate update of the ROS's package list. Without this command it may take a couple of minutes before ROS "notices" that you new package exists.
You should now be able to interact with your package using ROS command line tools:
rosrun wander wander.py
Congratulations! You now have a fully-functional, properly built, ROS package.
Once you are satisfied with your package, commit your work, and push it back to stu by completing the following steps:
hg add *to add all of your newly created files to the repository.
hg commit -m 'First commit.' --user YOUR_EIDEvery time you commit your code you MUST provide a reasonably informative commit message.
hg pushYour changes are not safe until you complete this step!
hg_clone.sh
script.
There is nothing to submit for this lab. I'll check your work by accessing your Mercurial repository on stu.