Starting the Package (The First Step)


To create a package we must first create a work space folder, make a src folder within the work space folder, initialize the work space, make the work space, add the work space to the .bashrc, and then verify that the work space is the package path. This seems like a lot to swallow at first because it isn't always explained (very well) why you have to build a work space or why you need packages. I think we can get through this with a better understanding than I did a few weeks ago. I suppose the first thing should be explaining the work space, the packages, and why everything else.


The work space is where the packages are placed in (or made). And the packages are the parts of the robot programming. This likens it to a sandbox environment for creating the robot simulation program files. Most of ROS, in my opinion, is about simulations--even when the robot is moving in the real world. The work space has to be made to a certain specification and then has to be referenced to the ROS program files so that the packages can be executed.


TLDR: make a work space this way so you can run your code.

Here are the magical steps (as far as I know):

  • Open a terminal (Try: alt+ctrl+t)
    1. mkdir -p ~/lawnmow_ws/src -- Makes a folder within the home directory. The -p allows the mkdir to make a sub-directory src.
    2. cd ~/lawnmow_ws/src -- Changes the directory to the src folder.
    3. catkin_init_workspace -- initializes the work space.
    4. cd ../ -- takes you back down to ~/lawnmow_ws.
    5. catkin_make -- makes the folder into a work space.
    6. echo "source ~/lawnmow_ws/devel/setup.bash" >> ~./bashrc -- This should cross-reference the work space to the ./bashrc
    7. source ~/.bashrc -- Make it happen!
    8. echo $ROS_PACKAGE_PATH -- Check to see if the work space is referenced.


Now you should be able to use what is in your lawnmow_ws/src folder within the ROS programs.


To make packages go to the src folder (type: cd src) and do this:

    • catkin_create_pkg name_of_pkg dependencies_that_the_package_requires_each_separated_by_a_space


For the next project run:

    • catkin_create_pkg lawnmow_description roscpp tf geometry_msgs urdf rviz xacro

This builds the lawnmow_description package in the lawnmow_ws/src with the required packages for robot modeling.


References: http://wiki.ros.org/catkin/Tutorials/create_a_workspace

http://wiki.ros.org/catkin/Tutorials/CreatingPackage

Mastering ROS for Robotics Programming

ROS Robotics Projects


The next step will be to make the URDF file to make our first real package!


3/25/17