Reader small image

You're reading from  Mastering ROS for Robotics Programming, Third edition - Third Edition

Product typeBook
Published inOct 2021
PublisherPackt
ISBN-139781801071024
Edition3rd Edition
Concepts
Right arrow
Authors (2):
Lentin Joseph
Lentin Joseph
author image
Lentin Joseph

Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA.
Read more about Lentin Joseph

Jonathan Cacace
Jonathan Cacace
author image
Jonathan Cacace

Jonathan Cacace was born in Naples, Italy, on December 13, 1987. He received his Master's degree in computer science, and a Ph.D. degree in Information and Automation Engineering, from the University of Naples Federico II. Currently, he is an Assistant Professor at the University of Naples Federico II. He is also a member of PRISMA Lab where he is involved in different research projects focused on industrial and service robotics in which he has developed several ROS-based applications integrating robot perception and control.
Read more about Jonathan Cacace

View More author details
Right arrow

Writing a ROS-PX4 application

Let's now create a new package in which we will store all the source and launch files needed to send and receive data from the simulated UAV using ROS. Enter your ROS source workspace and use the following command:

catkin_create_project px4_ros_ctrl roscpp mavros_msgs  geometry_msgs

As you can see, this package depends from the mavros_msgs. This will be used to retrieve data from the UAV. Here, we will discuss the ROS node that controls the vehicle. The complete code can be found in the book source code and it is contained into the src/px4_ctrl_example.cpp source file.

To achieve our goal, we need to perform the following operations:

  1. Arm the quadrotor. Arming the vehicle allows the motors to start spinning. This can be done using mavros through ROS services. The /mavros/cmd/arming service can be used.
  2. Switch to OFFBOARD mode. After that, the motors should start to spin and we can send input to the UAV. To accept external...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering ROS for Robotics Programming, Third edition - Third Edition
Published in: Oct 2021Publisher: PacktISBN-13: 9781801071024

Authors (2)

author image
Lentin Joseph

Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA.
Read more about Lentin Joseph

author image
Jonathan Cacace

Jonathan Cacace was born in Naples, Italy, on December 13, 1987. He received his Master's degree in computer science, and a Ph.D. degree in Information and Automation Engineering, from the University of Naples Federico II. Currently, he is an Assistant Professor at the University of Naples Federico II. He is also a member of PRISMA Lab where he is involved in different research projects focused on industrial and service robotics in which he has developed several ROS-based applications integrating robot perception and control.
Read more about Jonathan Cacace