Implementation of ROS message and ROS Launch file

Initially, we shall look into the making of the new ROS message and then move to ROS launch. So, far we have a deal with the ROS messages which are predefined like standard msgs string and geometry msgs twist. If no existing message fulfils the need for the requirement to be fulfilled, we have to develop the new ROS messages. 

The ROS message consists of the package name and the message type. 

ROS messages consist of the content in the form of the fields.

ROS service for an IoT application with the topic looks in a similar way, that require a custom message to deliver.

Steps to create a new ROS message 

  • Create a message folder in your package
  • THe create a message file in the package with extension .msg
  • Edit the message file accordingly
  • Update the dependencies accordingly
    • In package.xml 
    • and CmakeLists.txt 
  • Compile the package using the catkin_make
  • Make sure that your message is created using the rosmsg show

Creating ROS Message Implementation

Initially, create a message folder in the respective catkin workspace folder that contain src folder.

Now, create a file to write the contents of the message inside the message folder with file extension .msg

For various primitive types for the custom, ROS messages refer to the wiki/

Following changes has to be done in Cmake list and Package.xml file accordingly to consider the custom message file developed as the ROS message.

Then the Cmake file has to be compiled using the catkin_make command

Finally, one can check the message with rosmsg IoTSensor and can check the list of topics.

ROS Network Configuration

In ROS, it supports the network configuration and support the controlling of the remote robot from the workstation using the internet IP address.

This network connectivity feature in ROS simulation will help to control the robots from the workstation and program them accordingly if any issues or problems occur. This feature of ROS supports the simulation of the robots using the internet connectivity wirelessly.

Launch File

If you want to run multiple ros nodes then the concept of launch file makes the things easier. The launch is an XML document, that specifies the nodes to execute with the parameters and other files to include accordingly. Roslaunch command will help to start the launch file.

As discussed in the previous tutorials, if we want to run the teleop simulation followed by turtlesim go to goal simulation, we need to run both programs in the command prompt. Instead, we can use the launch file and run both accordingly.

Inside the launch file, you can mention the several nodes accordingly.

Now the lauch file can be run using the command of roslaunch of the launch file, then the nodes mentioned in the launch file will run automatically.

Including a launch file

Another method to use the run the multiple nodes along with the nodes mentioned in the other launch files is also possible in ROS.

Now, one need to mention the launch files in the new launch file, with all the necessary location and the parameter, to run the launch file.

This completes the end of the tutorial with the explanation about the development of the custom ROS message implementation and about ROS network configuration and the process of running the multiple nodes at a single time with ROS launch file. For any sort of doubts or questions, you can reach out through the comment box.

Spread knowledge

Leave a Comment

Your email address will not be published. Required fields are marked *