ROS basics

Created At: 2024-04-05 06:28:17 Updated At: 2024-04-29 10:26:22

ROS is a cool tool to simulate robots and work with them. Here we will cover the basic of ROS. First we will learn a little bit about ROS workspace and folder creation.

First go ahead and create a folder name mvrobot_ws and within it create another directory called src. Inside src we will have all the code and functionalities of our robot. 

All the ROS packages would be installed there too. They are ROS overlay. We need to initialize this workspace so that it's recognized as ROS overlay.

So from src folder go back to mvrobot_ws folder and run the following command

catkin_make

The above command will build our workspace. catkin is a tool to build code to executables. Once you have run the above command you will see there are two new folders inside our workspace mvrobot_ws. They are

  1. build
  2. devel

Now inside our work space we have total three folders. Inside the src folder we will put our actual workspace code.

After that we will create a new ROS package inside src folder. To create a package we will run

catkin_create_pkg

But this command needs the package name and dependencies. Let's name our package name as mvrobot_ws with the dependencies.

Let's mention the dependencies

catkin_create_pkg mvrobot_examples rospy std_msgs

After that you need to press enter to create the packages. Then we will see it has a few files and folders inside mvrobot_examples.

We will see another src folder and CMakeList.txt and package.xml.

CMakeList.txt is for compiler and list the intstructions of how to compile. And package.xml we will list all the information related to package like version and creator's name.

Then we need to rebuild our work space and go one step back. We now will go to mvrobot_ws folder and run 

catkin_make

Comment

Add Reviews

Latest Posts

Subscribe our newsletter