PX4 Offboard Control Using MAVROS on ROS

This post is written by Jaeyoung Lim

Overview

Recently opensource autopilots have become reliable by various failsafe functions integrated by the opensource community. Developing different softwares for each application can be time consuming and hard to verify the reliablility of the software. An alternative to modifying the autopilot software, is to use an onboard computer to command the autopilot using high level commands. This way, the developer can use a reliable autopilot software which is still reliable and capable of staying in the air and use a software developed for the developer’s own purpose.
This article is to introduce how easy and practical it is to connect a PC, using ROS to control the autopilot running onbaord an onboard PC. A nice tutorial is up on the PX4 website but is a little unfriendly and I wanted to share some of the troubleshooting experiences while I was implementing the system.

로열모_5분스피치_임재영

what is ROS?

ROS is a framework for incorporating various modules of robotics by configuring modules as a TCP network. The ROS community is currently growing in a very fast pace both in the community and industry. The ROS wiki has great tutorials in understanding the framework. Please get used to using ROS following tutorials 1.~9. in the tutorials page.

Introduction to MAVROS

MAVROS is a ROS package which enables ROS to interact with autopilot software using the MAVLink protocol. MAVlink consists of 17 bytes and includes the message ID, target ID and data. The message ID shows what the data is. Message IDs can be seen in the messageID command set.
b15e6d130c9d606305c31ffedb3c1118.media.400x98

This enables MAVLink to be able to get information from multiple UAVs if messages are transferred in the same channel. Messages can either be transmitted through wireless signals.

mavros_raw

Installing MAVROS

MAVROS can be installed using the source in the mavros repository. The default dialect of MAVROS is apm. As we are installing px4 on the pixhawk flight controller, MAVROS should be built from source, by configuring mavros by the command below.

catkin config --cmake-args -DMAVLINK_DIALECT=common

Configuring PX4 for ROS

For the companion computer to communicate with the flight controller, a USB2TTL converter is needed to convert the voltage of the communication levels. A brief overview of configuring the companion computer with the pixhawk is shown in this link.

IMG_20151221_122909

It is recommended that the offboard control is done through the TELEM2 port. Telem2 port can be activated usign the SYS_COMPANION parameter. This can be done by modifying the parameter on qgroundcontrol.

SYS_COMPANION 921600

Configuring MAVROS for PX4

To launch MAVROS, the easiest way is to use the launch file

roslaunch mavros px4.launch

Launching MAVROS, it may not work on the first time. Do not panic!

Some parameters should be modified to be able to talk with the flight controller. The device name and baudrate should be configured to be able to talk to the autopilot.

<node name="mavros" pkg="mavros" type="mavros_node" output="screen">
	<param name="fcu_url" value="$(arg fcu_url)" />
	<param name="gcs_url" value="$(arg gcs_url)" />
	<param name="target_system_id" value="$(arg tgt_system)" />
	<param name="target_component_id" value="$(arg tgt_component)" />
	<!-- enable heartbeat send and reduce timeout -->
	<param name="conn_heartbeat" value="5.0" />
	<param name="conn_timeout" value="5.0" />
	<!-- automatically start mavlink on USB -->
	<param name="startup_px4_usb_quirk" value="true" />

</node>

Setting Setpoints

Setpoints should be sent to the flight controller with a 0.5s time out. This is a safety factor so that the control should converge to a specific objective. Otherwise the flight controller will not go into offboard mode. Setpoints that can be used are as below.

  • Position Setpoints
  • Velocity Setpoints
  • Attitude Setpoints
  • Acceleration Setpoints
  • Actuator Control

An example node written in cpp is shown below. The node publishes setpoint_poistion_local message.

Integrating Companion Computer to quadrotor

The quadrotor is based on a F330 frame and the current integration follows as below. 330 frame feeled a little small for an onboard computer. For future integration, 450 frame should be more appropriate.

IMG_20151221_202606

Position Control Example

For position control, external position estimation using the Vicon motion capture system was used for more precise position measurement. The block diagram visualized using rtq_graph is shown as below.

rosgraph2

This is an example to show how to control the quadrotor using the setpoint_position topic. External position estimation was used using the vicon motion capture system.


ctrl_position.launch

<launch>

<!--arg name="fcu_url" default="serial:///dev/ttyUSB0:921600" -->
<arg name="fcu_url" default="udp://:14540@192.168.1.36:14557"/>
<arg name="gcs_url" default="udp://:14556@192.168.150.2:14550" />
<arg name="tgt_system" default="1" />
<arg name="tgt_component" default="1" />


<node name="mavros" pkg="mavros" type="mavros_node" output="screen">
	<param name="fcu_url" value="$(arg fcu_url)" />
	<param name="gcs_url" value="$(arg gcs_url)" />
	<param name="target_system_id" value="$(arg tgt_system)" />
	<param name="target_component_id" value="$(arg tgt_component)" />

	<!--rosparam command="load" file="$(find mavros)/launch/px4_blacklist.yaml"-->

	<!-- enable heartbeat send and reduce timeout -->
	<param name="conn_heartbeat" value="5.0" />
	<param name="conn_timeout" value="5.0" />
	<!-- automatically start mavlink on USB -->
	<param name="startup_px4_usb_quirk" value="true" />
	<param name="mocap/use_tf" value="true"/>
	<param name="mocap/use_pose" value="false"/>
</node>

<node name="setpoint_pub" pkg="inrol_ros" type="pub_setpoints_pos" output="screen">

</node>

<node pkg="vicon_bridge" type="vicon_bridge" name="vicon" output="screen">
	<param name="stream_mode" value="ServerPush" type="str" />
	<!--param name="datastream_hostport" value="147.47.175.54:801" type="str" /-->
	<param name="datastream_hostport" value="147.46.175.54:801" type="str" />
	<param name="tf_ref_frame_id" value="/world" type="str" />
	<remap from="/vicon/quad/quad" to="/mavros/mocap/tf"/>	       
</node>


</launch>

pub_setpoints.cpp

#include <ros/ros.h>
#include <std_msgs/String.h> 
#include <stdio.h>
#include "geometry_msgs/PoseStamped.h"
#include "geometry_msgs/Vector3Stamped.h"

int main(int argc, char **argv)
{
   ros::init(argc, argv, "pub_setpoints");
   ros::NodeHandle n;

   ros::Publisher chatter_pub = n.advertise<geometry_msgs::PoseStamped>("/mavros/setpoint_position/local",100);
   ros::Rate loop_rate(100);
   ros::spinOnce();

   geometry_msgs::PoseStamped msg;
   int count = 1;
	
		//PositionReciever qp;:
		//Body some_object;
		//qp.connect_to_server();

	
   while(ros::ok()){
	   //some_object = qp.getStatus();
		// some_object.print();
		//printf("%f\n",some_object.position_x);
       msg.header.stamp = ros::Time::now();
       msg.header.seq=count;
       msg.header.frame_id = 1;
       msg.pose.position.x = 0.0;//0.001*some_object.position_x;
       msg.pose.position.y = 0.0;//0.001*some_object.position_y;
       msg.pose.position.z = 1.0;//0.001*some_object.position_z;
       msg.pose.orientation.x = 0;
       msg.pose.orientation.y = 0;
       msg.pose.orientation.z = 0;
       msg.pose.orientation.w = 1;

       chatter_pub.publish(msg);
       ros::spinOnce();
       count++;
       loop_rate.sleep();
   }
   
      
   return 0;
}

Attitude Control Example

pub_att.cpp

#include <ros/ros.h>
#include <std_msgs/String.h> 
#include <stdio.h>
#include <math.h>
#include "geometry_msgs/PoseStamped.h"
#include "geometry_msgs/Vector3Stamped.h"
#include "std_msgs/Float64.h"

//#include </home/mahesh/catkin_ws/src/beginner_tutorials/src/Qualisys.h>

int main(int argc, char **argv)
{
   ros::init(argc, argv, "pub_setpoints");
   ros::NodeHandle n;

   ros::Publisher pub_att = n.advertise<geometry_msgs::PoseStamped>("/mavros/setpoint_attitude/attitude",100);
   ros::Publisher pub_thr = n.advertise<std_msgs::Float64>("/mavros/setpoint_attitude/att_throttle", 100);
   ros::Rate loop_rate(100);
   ros::spinOnce();
   geometry_msgs::PoseStamped cmd_att;
   std_msgs::Float64 cmd_thr;
   int count = 1;
   double v[3]={1.0, 0.0, 0.0};
   double lambda = 0.3;


   double v_norm=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
   double theta=0.0;
   

		//PositionReciever qp;
		//Body some_object;
		//qp.connect_to_server();

	
   while(ros::ok()){
	   //some_object = qp.getStatus();
		// some_object.print();
		//printf("%f\n",some_object.position_x);
		//Create attitude command message
       cmd_att.header.stamp = ros::Time::now();
       cmd_att.header.seq=count;
       cmd_att.header.frame_id = 1;
       cmd_att.pose.position.x = 0.0;//0.001*some_object.position_x;
       cmd_att.pose.position.y = 0.0;//0.001*some_object.position_y;
       cmd_att.pose.position.z = 0.0;//0.001*some_object.position_z;

       cmd_att.pose.orientation.x = sin(theta/2.0)*v[0]/v_norm;
       cmd_att.pose.orientation.y = sin(theta/2.0)*v[1]/v_norm;
       cmd_att.pose.orientation.z = sin(theta/2.0)*v[2]/v_norm;
       cmd_att.pose.orientation.w = cos(theta/2.0);
      /*
	   double q_norm = sqrt(sin(theta/2.0)*sin(theta/2.0)+cos(theta/2.0)*cos(theta/2.0));
		printf("%f\t",v_norm);
		printf("%f\n", q_norm);
	*/
	   //Create throttle command message
	   cmd_thr.data = lambda;
      
	   pub_att.publish(cmd_att);
       pub_thr.publish(cmd_thr);
	   ros::spinOnce();
       count++;
	   theta=0.3*sin(count/300.0);
       loop_rate.sleep();
/*
	if(count>1000){
		count =0;
	}
	*/
   }
   
      
   return 0;
}

The video below shows some bias in yaw when controlling the attitude of the quadrotor. I believe this is due to the induced magnetic field from the motor currents which will offset the magnetic field in high attitudes.

144 thoughts on “PX4 Offboard Control Using MAVROS on ROS

  1. Ok What I want to do is implement an Attitude+Position controller that I implemented in Matlab during my Robotics: Aerial Robotics course in Coursera Specialization but I am having trouble doing so because I dont understand well how to get the current state, I did what you told me above and I think it works I just had to fix a roscpp problem that came with my ROS installation and havent had the time to try it out. what confuses me is that you posted an attitude controller and I dont understand where or how you get the state if youre not subscribed to any topics just published

    Liked by 1 person

    • As you can see in the code, I am publishing “/mavros/setpoint_attitude/attitude” messages

      When the message is received by the quadrotor, an attitutde controler INSIDE the quadrotor will take care of controlling the attitude.

      Maybe what you are trying to do is to run the controller outside pixhawk and command values to the quadrotor which is also possible

      Liked by 1 person

      • Hi Jaeyoung Lim. Thank you for your instruction. But can you guide me how to code an attitude controller to control the quadrotor after publishing set point attitude?

        Like

      • The attitude controller is run by PX4 which is running inside the flight controller(Pixhawk).
        You do not need to control the attitude in addition to publishing the setpoint attitude.

        You still need to send throttle commands to make the quadrotor fly while sending attitude setpoint commands

        Like

  2. Hi ! Thank you a ot for this tutorial, it’s very interesting but I have some problem before begin it.
    I don’t download mavros and mavros extras and I compil them but in catkin_make_isolated. I have an error when i compil catkin_make. (Ubutun 14.02 , ros indigo)
    I had dowload vicon_bridge too but i don’t know where it go this package ?
    Can you help me ?
    Thanl you a lot

    Like

  3. HI Jaeyoung Lim, Thank you a lot for this tutorial. I have some questions about vicon package. I had download it but i don’t kno how to build it and to add it in my project. Can you help me ?
    Thank you a lot
    Regards

    Like

      • Hi Jaeyoung Lim,
        I can build all package and control my UAV . thank you a lot for your help.
        Best Regards

        Like

    • Hi Stéphane CERVETTI and Jaeyoung Lim,
      Can you guide me how to install Vicon_bridge inside a microprocessor (Odroid xu4). I tried many times but it just shows me some errors.
      Thanks

      Like

      • I am not sure if it runs on a arm processor a better solution is to run the vicon bridge on a different computer and make the odroid subscribe the mocap messages

        Like

      • Hi jaeyoung lim. So what is the frequency you used to run your code. Currently, i used vicon bridge inside my lap and i saw all data are pubshied, but when my drone i subscribing this topic, I experienced dropping data at 100 hz.

        Like

      • have you checked if you have enough baudrate to handle more than 100Hz?

        I was using a wired connection and was using 250Hz of mocap data. I am not sure of the subscribing rates were that fast.

        Like

  4. Hello there! Nice tutorial, how do you sent vicon values from the mocap computer to the companion? WiFi ? I was using a telemetry radio but it is very unreilable and, oddly enough, sometimes it lose connection even if we are at 5 meter distance. I checked that because px4 is often logging “vision timeout”.

    Like

    • In the flight test video, the quadrotor is connected to the laptop via a usb cable. The TELEM2 port is connected to the computer via USB2TTL

      Usually a companion computer integrated ‘on’ the quadrotor was used to fetch the vicon data from the server. The companion computer was connected to the network via wifi.

      I guess telemetry modules(433MHz AFSK modules, right?) are not appropriate for OFFBOARD control as they are too slow and unreliable. Especially if you are forwarding mocap data. Baudrate for wired TELEM2 port is 921600 compared to the badrate of the 433MHz telemetry module’s baudrate which is usually 57600

      In my opinion the fastest way to check for you is simply connecting the quadrotor with a long usb cable possible with a repearter attached to it.

      Like

      • Thank you very much! I will try wifi first. Yes I was using the 433MHz AFSK modules and they are nightmares, but for mocap data forwarding they were working just fine until some days ago. I would like to set a small onboard companion computer such as a raspberry. Do you have any suggestion for that? I need low power comsumption and small volume, the only feature I need is wifi. Thank you so much, awesome blog by the way 😉

        Like

      • I guess the cheapest option will be a raspberry pi, as it incorporates some GPIOs in a small package. However, Pis are not powerful enough for image processing applications.

        For image processing, I guess you will need something like an odroid Xu4 or u3

        Like

    • If you use the telemetry (I guess you are using 433MHz AFSK modules) you are constrained with slow baudrates(~57600) and packet loss.

      You should have a companion computer onboard the quadrotor which is connected to the pixhawk by wire. This way you can use baudrates upto 921600. The companion computer should be tied up in the network via wifi to access the vicon data.

      Like

      • Hello JaeYoung! I have an Odroid XU4 connected to my pixhawk 2.0 (working with a 3dr solo) through usb wire and a lot of the data is not published. The baud rate is set at 921600. Topics like /mavros/global_position/global are not being published but topics like /mavros/imu/data_raw are published. When the 3dr solo is connected to mavros via wifi, all of the data is available and published. Any ideas on why some data is not accessible when connected through usb?

        Thanks for your help!

        Like

  5. Hey, sorry for possible multiple posts but i had a connection problem. Anyway, awesome and clear tutorial! How do you send mocap values from the vision computer to the companion? WiFi? I am using two telemetry radio modules but they are pretty slow. Moreover, from yesterday I see in px4 log files “vision timeout” very often. It seems that the are losing some mavlink package and the receiver is not reading, i really need a more reliable solution for that.

    Like

  6. HI Jaeyoung Lim,

    Thanks a lot for the useful tutorial. I am trying to get Offboard Control working using PX4 and Intel NUC onboard PC.

    I have used the files you provided in the Position Control Example above – ctrl_position.launch and pub_setpoints.cpp. However, I am running into the REJECT OFFBOARD problem. I am new to this, and hence would appreciate your help.

    Here is the sequence of steps I am doing:
    – Turn on Onboard PC
    – Power on PX4 using Lithium Polymer Battery
    – roscore & roslaunch on the Onboard PC (using the ctrl_position.launch file provided above)
    – Press safety switch
    – ARM the quad (the motors then start spinning – I have not put in the rotors yet, since I am only testing at this point)
    – Turn on RC (which is in Manual Control mode)
    – Increase Throttle using the RC (the FCU shows “TAKEOFF DETECTED” message)
    – Switch the Offboard mode using the RC

    This is when I receive the FCU: REJECT OFFBOARD message.

    I am not sure what I am doing wrong. Do you think this is a Firmware issue?

    Like

      • how can I do this Im having that same problem these are the outputs most of the time when I can connect
        FCU: Rejecting mode switch cmd
        FCU: REJECT OFFBOARD
        Also I am using a usb cable connected directly to the pixhawks USB port does this matter?

        Like

      • I think the setpoints you are publishing are not properly subscribed by the mavros node or some how the pixhawk board is not receiving the setpoint topics. Would you check if the setpoints are properly being sent to the flight controller?

        You should NOT use the usb port. You have to send the setpoints topic to the TELEM2 port on pixhawk.

        Like

  7. Hi Jaeyoung Lim, I came here from your link in youtube. Could you share an example where setpoint_velocity/cmd_vel topic is used. I am working on autonomous takeoff where Optical Flow sensor is used in a GPS denied evironment.

    Like

  8. Hi,
    I am using ROS indigo with XU4. I am doing SLAM with quadrotor using moveit.
    I have a problem that i don’t know how to control the quadrotor after i got the plan.In the other word,quadrotor can’t execute.I have already connected to mavros.Do you know how should i do to let quadrotor fly?
    I am new in ROS. Hope you can help me with that.

    Like

    • I am not sure if I have fully understood your problem. Is it that the px4 is not entering offboard mode? are you sending setpoints within the timeout? Setpoints have a 0.5 second timeout

      Like

      • sorry,i redescribe my problem again.
        I have an action server(action controller) and controller manager for moveit now.
        But i don’t know how to use action server to control quadrotor after i got the trajectory planned by moveit.
        I set px4 to stabilized mode when i want it execute the trajectory.
        I didn’t have setpoint.cpp. Should i write setpoint.cpp? or maybe action server can control quadrotor via mavros?

        this is my rqt

        thank you for your reply.

        Like

      • Hi,
        I know write a node which subscribes the trajectory from moveit and sends to mavros is one method.
        But i am trying to understand how to implement the trajectory with action server.
        Maybe i should subscribe the command from my_controller_node?
        (i attatch the new graph below)

        Do you know the other method that subscribe from controller?

        Thanks for help.

        Like

  9. Hi,

    1. Recently, I am finding the transfer function of drone. Its input is roll pitch and yaw rate from topic mavros/imu_raw_data of mavros and its output is PWM signals of roll pitch yaw and throttle from mavros/actuator control that are coded on ROS, mavros, Odroid xu4 and px4 native stack firmware. The control signal of drone is from radio controller and sometimes this signal will be combined with chirping signals on roll pitch and yaw so that it will make my drone move around x y z axis and collect the necessary input and output data.
    2. To achieve this, I used topic mavros/rc/in which reads the roll pitch yaw and throttle signal from radio controller and scaled them to the range of -1 to 1. After that, I produce directly to the output of actuator using topic mavros/ actuator control (roll pitch yaw throttle channel of group 0). This code is fine! I can change my Pixhawk into Offboard Mode, then arm motor and control drone through radio signal, add chirping noise using switch on radio controller ( topic mavros/rc/in) as well as save the input and output data in text file.
    3. However, when running this code in my experiment, my drone oscillates a lot in take-off process and flip itself occasionally. I guess that the major reason is that the control signal from radio alone to control drone directly is not good.
    4. After that, I tried to turn it into Manual mode and used QRoundControl software to adjust PID parameters for roll pitch and yaw rate. Fortunately, my drone operates well with less fluctuation. However, with this flight mode, I cannot run my code as in section1 and 2 proposed because it is clear that my code only runs with Offboard Mode.
    Therefore, can anybody here that have experience with controlling drone with mavros and px4 native stack give me some ideas to solve my problem. I will run manual mode first and then switch it to offboard mode when my drone is stable? but to do that, what i have to add in my code or a process? or should I convert my code to program PX4 native stack firmware?
    Thank you too much for any help and discussion.

    Like

  10. Hi,
    I have successfully used position control. I am trying to use velocity control. I am using setpoint_velocity/cmd_vel (geometry_msgs/TwistStamped) . It works for linear x,y,z speeds. However I have problem with yaw. I am setting goalSpeed.twist.angular.z=X . If X is between 0.3 – 0.5 (for anti clockwise) or -0.3 – -0.5 (for clockwise) I can see the UAV is turning however not very fast and not so precise as position controller. If you give 1 to X, UAV starts to turn in one direction then suddenly it starts turn in the other direction. By the way I am using Gazebo to test it. Do you have any idea for yaw velocity control?
    THX

    Liked by 1 person

  11. Hello,

    This is perfect ! thanks for this. I have been trying this for sometime but everytime i try to get vicon_bridge to compile on the odroid u3, it keeps failing. This is the error i keep getting.

    ““
    [ 11%] Built target _vicon_bridge_generate_messages_check_deps_Markers
    [ 11%] Built target _vicon_bridge_generate_messages_check_deps_viconGrabPose
    [ 12%] Built target msvc_bridge
    Linking CXX executable /home/odroid/indigo_ws/devel/lib/vicon_bridge/testclient
    /usr/bin/ld.bfd.real: skipping incompatible /home/odroid/indigo_ws/src/vicon_bridge/vicon_sdk/Vicon_SDK_1.3_Linux/32-bit/libViconDataStreamSDK_CPP.so when searching for -lViconDataStreamSDK_CPP
    /usr/bin/ld.bfd.real: cannot find -lViconDataStreamSDK_CPP
    collect2: error: ld returned 1 exit status
    make[2]: *** [/home/odroid/indigo_ws/devel/lib/vicon_bridge/testclient] Error 1
    make[1]: *** [vicon_bridge/CMakeFiles/testclient.dir/all] Error 2
    make: *** [all] Error 2
    make: INTERNAL: Exiting with 5 jobserver tokens available; should be 4!

    ““

    Could you help me please. im using Lubuntu 14.04 and ROS Indigo.

    Like

  12. Hello,

    This has been a great tutorial and taught me many things, thank you for that. From what I understand, the local_position topic gives us the local position which is measured by the Pixhawk’s on-board sensors (and maybe GPS?). Right now I am working on inputting other data to local_position topic and would like to as you whether if it is possible? Thank you for your help.

    Like

  13. Hello Jaeyoung,

    Good job what you did here. I wanted to know how you could do your position estimator collaborate with Vicon readings. In my case, when I echo /mavros/local_position/pose and /mavros/mocap/tf topics, they have very different values. If you could guide me to solve this, I would appreciate it. Thanks in advance.

    Tarik

    Like

    • I think it is normal to have different values
      a. The local position is the position estimated by PX4 running on the pixhawk board: The origin is where you armed
      b. The mocap/tf topic is coming from the vicon mocap system: The origin is where you have selected it to be origin

      There is an onboard position estimator running in PX4. You can set the weights using the parameters
      CBRK_NO_VISION to 0
      `ATT_EXT_HDG_M to 1 or 2

      Like

  14. Hello, Lim
    Thank you for your nice work.

    May I ask you some questions?
    I want to use visual SLAM to provide local position. And I use the LPE estimator. Right now, I publish the camera pose to “/mavros/vision_pose/pose”, but I have no idea, how to set the Coordinate System of camera pose?

    Thank you in advance!

    Like

  15. Thanks for nice tutorial for using external pose estimation data for controlling UAVs.
    I have a question,
    How can you hookup motion capture system with ROS?
    As I know, Motion capture is running on Windows so I wonder how can hookup that data with ROS
    I found a article for this in ROS wiki, but actually I can’t find how to install and setup that system by following that.

    Regards.

    Like

    • Thank you,

      Motion capture systems usually communicate their motion data through the network. Usually ROS nodes that works for motion capture runs on Ubuntu and accesses the motion capture through the network. Which the operation system doesn’t matter.

      Which motion capture system are you using? If you are using Vicon you can use a package called vicon_bridge

      Like

  16. Hi Jaeyoung Lim , in case i have two drones , so i have to run two mavros nodes at the same time, but two nodes with the same name is not acceptable while we declare mavros node in launch file. Therefore, what i have to edit in mavros package so that I can run mavros node at 2 processors. Thanks.

    Like

  17. Hi Jaeyoung Lim, I could not find any files and topics like this

    Instead of that, I saw px4_config.yaml and “heartbeat” and “time out” inside that file. Is that due to the difference of mavros version?

    Like

    • It will work without the px4_config.yaml

      this article currently has some issues with the newer version.

      you can switch mavros to a previous version and test it if you want

      Like

  18. Hi
    I am using optitrack cameras

    I could send position data of Motive to Ros using VRPN.
    Often I remap vrpn data from optitrack to /mavros/mocap/pose topic.

    My question is:

    The mocap/pose topic transform the ENU coordinates to NED ?

    Regards!!

    Like

      • I want to do my first test with optitrack cameras and my 3dr irirs, as mentioned in other comments, the 3dr telemetry (433MHz) are very bad to send data mocap, I do not currently have a companion computer, so I got a long usb cable and I want to do a test like your video (position control), I have some questions:

        What part of the cpp file (pub_setpoints.cpp) enable offboard mode?

        When I run the cpp file and my iris has the desired position, how can the drone return to land, how to go from offboard to manual mode?

        thank you very much for answering!

        regards!

        Like

      • In the included example, I am not enabling the offboard mode with the code but doing it via a toggle switch on the transmitter.

        You can also enable it using mavros, but then you should also include tools t
        o check if the quad is doing what you expected or otherwise abort the offboard mode

        Like

      • Hello ! I thank you so much for your previous reply

        I have two last questions:

        In your Position control video, Did you hava disabled the gps?

        what is orientation.w?

        Greetings and again thanks!

        Like

      • Dear Mario,

        For the first question: Yes, I have disabled the GPS weights

        For the second question: the orientation.w is the real part of the quaternion The orientation is parameterized as a quaternion hence w, x, y, z

        Like

      • I understand that if I disable the gps I will be removing some filters.

        If I disable the gps, Do I have to do this tutorial to make the position control of your video? https://dev.px4.io/en/advanced/fake_gps.html

        At this point I have the vrpn node sending the mocap data to mocap/pose topic and I have a node sending setpoints to /mavros/setpoint_position/local

        Sorry for asking a lot of questions, your answers have helped me a lot, thanks!

        Like

      • Hello!

        Today I did my first test similar to your videvo (position control) and everything went wrong.

        When I send the setpoints my 3dr irirs drone my terminal said: “offboard node enable” and “vehicle armed”. But my 3dr iris does not take off and therefore does not get an altitude of 0.5 m.

        My iris drone is only moving on the ground without direction.

        Why is this happening?
        Do I have to disable the gps weights?

        I attach some images as my rqt_graph and linux terminals

        I thank you for all the help you have given me.

        PD: I am using a usb cable connected from my ubuntu pc to pxhawk (921600 Baudrate)

        Like

  19. hi Jaeyoung Lim, I want to use offboard mode without vicon to hover indoor.but I think the setpoints you send with mavros to pixhawk use GPS date ?how can i hover indoor ?do you give me a example code takeoff indoor in offboard mode?thank you

    Like

  20. Hi Jaeyoung, congrats for your nice work on this! We are currently trying to achieve offboard control with VICON and an F450, and followed the standard tutorials. The quadcopter follows waypoints very accurately, but we are finding issues in take-off. We arm the quad on the ground, send ‘setpoint_position/local’ to 1m height from its current position, and switch to offboard mode. Then the quad overshoots to approximately 2.5m followed by a slow height decrease until the setpoint height of 1m. Does this sound familiar to you or ring any bell? We are modifying LPE and MPC parameters but so far we could not solve the issue. Any help will be greatly appreciated, thanks in advance!

    Like

  21. Hi Jaeyoung, congrats for your nice work on this! We are currently trying to achieve offboard control with VICON and an F450, and followed the standard tutorials. The quadcopter follows waypoints very accurately, but we are finding issues in take-off. We arm the quad on the ground, send ‘setpoint_position/local’ to 1m height from its current position, and switch to offboard mode. Then the quad overshoots to approximately 2.5m followed by a slow height decrease until the setpoint height of 1m. Does this sound familiar to you or ring any bell? We are modifying LPE and MPC parameters but so far we could not solve the issue. Any help will be greatly appreciated, thanks in advance!

    Like

    • It looks like the overshoot and slow decrease is because you are using the barometer sensor in altitude estimation

      Try turning the barometer off or decreasing the gains
      Best,
      Jaeyoung

      Like

      • Thanks for the quick reply! Our LPE_FUSION is 12 (only vision data, the barometer is not fused). Which gains should we decrease? Velocity/position PID gains from MPC?

        Like

  22. Hi Jaeyoung, I have an Odroid XU4 connected to Pixhawk with APM stack. A sensor is mounted on the quad to detect obstacles. When detected I want to move the quad away from it. How do I send Pitch and Roll values via MAVROS? Thanks

    Like

      • Thanks. Please let me know if I have understood this correctly. In your code “cmd_att.pose.position.x, cmd_att.pose.position.y, cmd_att.pose.position.z” are the roll, pitch and yaw values, right?. If so, what are the values that should be given to make the copter pitch backwards 45 degress(should I implement a PID controller?)

        Like

  23. Hello Jaeyoung Lim, I have one simple question. Does the pilot control input using the transmitter work in the offboard mode during activating the setpoint_velocity command?

    Like

  24. Hey Jaeyoung Lim, really nice work. I was wondering if you could provide me with some guidance as I am relatively new to ROS. I am trying to run my PX4 in an indoor environment autonomously. I want to publish the decision made by ROS AMCL to the PX4 and make it move to the desired location. I would really appreciate your assistance 🙂

    Like

      • I am trying to make PX4 fly autonomously using the ROS. I am using AMCL for localization, and move base for planning the destination. Can you help me on how to write the interface between PX4 and ROS? I understand I need to use MAVROS, but I ma not sure how to send the data from ROS to PX4

        Like

  25. Hi Jaejoung Lim,
    I am controlling my rover using PX4. In PX4 i couldn’t set externally , ” rosrun mavros mavsys mode -c OFFBOARD ” as offboard mode is not available in the firmware I am using. However, I managed to override RC by setting SYSID_MYGCS = 1 , ” rosrun mavros mavparam set SYSID_MYGCS 1. Now I am able to control the actuator using /mavros/rc/override topic.

    But I want to control it using Joystick. And rosrun mavros mavteleop -rc produce error.Also, I am not able to control my actuator using /mavros/actuator_control topic, which I published. If I am in offboard mode I should be able to control the actuators using /mavros/actuator_control topic right ?

    Thank you in advance!

    Like

  26. Have you ever achieved to send position and attitude data at the same time? I could send position data to setpoint_position/local node but if i put yaw info into orientaiton field of PoseStamped message the vehicle start to spin around. When i tried to send messages to setpoint_position/local and setpoint_attitude/attitude individually, the rotation of vehicle didn’t change. Finally, i tried to send PositionTarget message to setpoint_raw/local, it is failed again when i changed yaw or yaw_rate and drone started to spin again. There is no problem on sending position information but i couldn’t send position and yaw data together.

    Like

  27. Hello, I have made the PX4 offboard position control, but it is not so stable as yours, the quadrotor moves around the setpoint, I have asked others, they said the problem is the PID parameters? Is it true, I thought when I choose the airframe the PID also have set. And how to change the PID , I am not familiar with it ?

    Like

      • Hi, Jaeyoung Lim
        Thanks for nice tutorial for using external pose estimation data for controlling UAVs.
        I have two questions.
        1. Could you please post the answer of heshu (@shubao_he)’s question? I have the same problem.
        2. From the previous answer, I know you are implemented this drone without GPS, and you said in an previous answer:
        “a. The local position is the position estimated by PX4 running on the pixhawk board: The origin is where you armed”
        did the “armed” means take off and will no GPS flying making the orign shifting(how much usually)?

        Regards.

        Like

  28. Dear Jeayoung Lim

    Thank you for sharing thise very good and well documented tutorial – great job actually!

    I would like to share some questions with you.

    Actually we are running a SLAM on our quad and we are running Ardupilot in an indoor environment. As you will expect, we would like to use the output of the SLAM to set up the position of the autopilot and then be able to send setpoint to move from one point to another in the explored space. All computation is done onboard.

    Looks like it is quite difficult to achieve this goal with ArduPilot (need to send a fake GPS information and I am nore sure we cand send setPoint as well or you need to send them in latitude and longitude) and PX4 is more appropriate, do you think so?

    If we use PX4, the principle will be to use VISION_POSE_ESTIMATE (Mavros) to update the pose of the quad based on SLAM output.

    Then if we need to move to a new position, issue setPoint (“goal position”) on a regular period – and add another piece of code to check that we actually reached the “goal position”.

    Am I correct?

    Besides, If I correctly understood, you need to send regularly the same setPoint because you are in offboard mode, am I correct? But Can you tell me how to setup this mode, because in the published example I did not see it?

    Finally in one answer, you mentioned that we need to to specifiy the throttle command, but it should be done by the controler inside the PX4 normally?

    In you video, the quad took off automatically, is it based on the code “pub_setpoints.cpp”?

    Sorry for my long message but your post is very good and thus raised many questions in my mind as well 🙂

    Thank you for reading

    Fabrice

    Like

    • Dear Fabrice, Sorry for the late reply a. I would recommend PX4 than APM(APM runs on the PX4 stack anyway) b. it is correct that you should send the setpoint and check the current position c. In the video I have set offboard mode with my transmitter, to be able to disable it whenever the quadrotor is not stable This is not necessary once you got the whole system running

      Like

  29. Hi, I am wondering if I want the attitude control using attitude_setpoint/attitude to set the command, how should I set the initial setpoint to trigger at the very beginning? I try to do like this
    for(int i = 100; ros::ok() && i > 0; –i){
    local_pos_pub.publish(pose);
    ros::spinOnce();
    rate.sleep();
    }
    as shown in website: https://dev.px4.io/en/ros/mavros_offboard.html
    and it work only if I keep sending the pose rather than the attitued. Otherwise the quad cannot be armmed and set to be “offboard” mode So can you show me a success code for the attitude control?

    Thanks,

    Like

    • Oh, I increase the trigger time over 0.5s and the quad can be armed and stepped into the manual control mode. But when I do the offboard mode, the pixhawk showed the red flash light means rejecting it. What should I do?

      Like

      • If you want to disable offboard control with a manual control, increasing the trigger time is not a good solution as it will compromise your performance

        Try assigning the trigger on your transmitter to trigger offboard mode

        Like

      • Hello again, we double checked the transmitter offboard control. When using pose (/mavros/setpoint_position/local) instead of attitude, it can switch to offboard with no problem. When we try switching modes using attitude control (/mavros/setpoint_attitude/attitude AND /mavros/setpoint_attitude/att_throttle), the light on the Pixhawk flashes red, which means that the offboard control is rejected. We are using the code below for attitude control. Any help is greatly appreciated.

        #include
        #include
        #include
        #include
        #include
        #include
        #include
        #include
        #include
        #include
        #include
        #include
        //#include
        #define Pi 3.14159

        geometry_msgs::Vector3 Current_euler;
        mavros_msgs::State current_state;
        mavros_msgs::RCIn current_RC;

        double Time = 0;

        void state_cb(const mavros_msgs::State::ConstPtr& msg){
        current_state = *msg;
        }

        void RC_cb(const mavros_msgs::RCIn::ConstPtr& msg){
        current_RC = *msg;
        }
        void imuqua_cb(const sensor_msgs::Imu msg){
        tf::Quaternion IMU_q(msg.orientation.x,msg.orientation.y,msg.orientation.z,msg.orientation.w);
        tf::Matrix3x3 m(IMU_q);
        m.getRPY(Current_euler.x,Current_euler.y,Current_euler.z);
        Current_euler.z=-Current_euler.z;
        Current_euler.y=-Current_euler.y;
        }
        bool wasArmed = false; //Check value for arming

        int main(int argc, char **argv)
        {
        ros::init(argc, argv, “offb_node”);
        ros::NodeHandle nh;

        ros::Subscriber state_sub = nh.subscribe
        (“mavros/state”, 10, state_cb);
        ros::Subscriber RC_sub = nh.subscribe
        (“mavros/rc/in”, 10, RC_cb);
        ros::Subscriber imuqua_sub = nh.subscribe
        (“mavros/imu/data”, 10, imuqua_cb);

        ros::Publisher Eu_pub = nh.advertise//attitutude_pub
        (“Current_Euler”, 10);
        ros::Publisher Des_pub = nh.advertise//attitutude_pub
        (“Desired_Euler”, 10);
        ros::ServiceClient arming_client = nh.serviceClient
        (“mavros/cmd/arming”);
        ros::ServiceClient set_mode_client = nh.serviceClient
        (“mavros/set_mode”);

        ros::Publisher pub_att = nh.advertise(“/mavros/setpoint_attitude/attitude”,100);
        ros::Publisher pub_thr = nh.advertise(“mavros/setpoint_attitude/att_throttle”,100);
        geometry_msgs::PoseStamped cmd_att;
        std_msgs::Float64 cmd_thr;

        int count = 1;//it counts
        double theta = 0.0;
        double v[3] = {1.0, 0.0, 0.0};
        double lambda =0.3;
        double v_norm = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
        //the setpoint publishing rate MUST be faster than 2Hz
        double SampleFreq = 50;
        double SampleTime = 0.02;
        ros::Rate rate(SampleFreq);

        tf::Quaternion Dequaternion;

        // wait for FCU connection
        while(ros::ok() && !current_state.connected){
        ros::spinOnce();
        rate.sleep();
        }

        cmd_att.pose.position.x = 0.0;//0.001*some_object.position_x;
        cmd_att.pose.position.y = 0.0;
        cmd_att.pose.position.z = 0.0;

        cmd_att.pose.orientation.x = 0;
        cmd_att.pose.orientation.y = 0;
        cmd_att.pose.orientation.z = 0;
        cmd_att.pose.orientation.w = 1;

        cmd_thr.data = 0;

        //send a few setpoints before starting
        for(int i = 1000; ros::ok() && i > 0; –i){
        pub_att.publish(cmd_att);
        pub_thr.publish(cmd_thr);
        ros::spinOnce();
        rate.sleep();
        }

        mavros_msgs::SetMode offb_set_mode;
        offb_set_mode.request.custom_mode = “OFFBOARD”;

        mavros_msgs::CommandBool arm_cmd;
        arm_cmd.request.value = true;

        ros::Time last_request = ros::Time::now();

        while(ros::ok){

        double roll, pitch, yaw;

        if( current_state.mode != “OFFBOARD” && current_RC.channels[4] > 1800 &&
        (ros::Time::now() – last_request > ros::Duration(5.0))){
        if( set_mode_client.call(offb_set_mode) && offb_set_mode.response.mode_sent){

        ROS_INFO(“Offboard enabled~~~~~~~~~~~~~~~~~~~~~~~”);
        Time = 0;//Reset timer when offboard is enabled

        }
        last_request = ros::Time::now();

        } else if( !current_state.armed && wasArmed == false &&
        (ros::Time::now() – last_request > ros::Duration(5.0))){
        if(current_RC.channels[6] > 1500){
        arm_cmd.request.value = true;

        if( arming_client.call(arm_cmd) &&
        arm_cmd.response.success){
        ROS_INFO(“Vehicle armed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!”);
        wasArmed = true;
        }
        }
        last_request = ros::Time::now();

        } else{//disarm if switch on channel 7 < 1500

        if(/*current_state.armed == true &&*/ wasArmed == true && current_RC.channels[6] < 1500){
        arm_cmd.request.value = false;

        if( arming_client.call(arm_cmd) &&
        arm_cmd.response.success){
        ROS_INFO("Vehicle disarmed///////////////////////");
        wasArmed = false;
        }
        }
        //last_request = ros::Time::now();
        }

        cmd_att.header.stamp = ros::Time::now();
        cmd_att.header.seq = count;
        cmd_att.header.frame_id = 1;
        cmd_att.pose.position.x = 0.0;//0.001*some_object.position_x;
        cmd_att.pose.position.y = 0.0;
        cmd_att.pose.position.z = 0.0;

        cmd_att.pose.orientation.x = sin(theta/2.0)*v[0]/v_norm;
        cmd_att.pose.orientation.y = sin(theta/2.0)*v[1]/v_norm;
        cmd_att.pose.orientation.z = sin(theta/2.0)*v[2]/v_norm;
        cmd_att.pose.orientation.w = cos(theta/2.0);

        cmd_thr.data = lambda;
        count++;
        theta = 0.3*sin(count/300.0);

        geometry_msgs::Vector3 Desired_Euler;
        Desired_Euler.x = 0.3*sin(Pi*0.2*Time);
        Desired_Euler.y = 0;
        Desired_Euler.z = 0;
        roll = Desired_Euler.x;
        pitch = -Desired_Euler.y;
        yaw = -Desired_Euler.z;

        pub_att.publish(cmd_att);
        pub_thr.publish(cmd_thr);
        Des_pub.publish(Desired_Euler);
        Eu_pub.publish(Current_euler);

        ros::spinOnce();
        rate.sleep();
        Time = Time + SampleTime;
        }

        return 0;
        }

        Like

  30. Thanks for sharing this. Could you share with me what kind of mechanical parts are you using for designing the test rig of the second video?

    Thanks

    Like

  31. HI Jaeyoung Lim
    I have a query Is it possible to launch/run mavros offboard node directly from Qground control?
    without connecting to the onboard companion computer by ethernet or wifi.

    Like

  32. Hi Jaeyoung
    1. I wanted to send the quadcopter position and attitude using the ros vicon bridge to ros and to pixhawk.
    I have set the parameters use_tf to true and have remapped /vicon/quad/quad to mavros/mocap/tf. I am getting an error that says
    “Dropped message ATT_POSE_MOCAP: tx-queue overflow”
    Did you go through this error?
    2. In the pixhawk settings did you use LPE or EKF2 as an estimator.
    3. Did you follow the steps mentioned on this site, because it says, we need to remap the position data to /mavros/vision_pose/pose
    https://dev.px4.io/v1.9.0/en/ros/external_position_estimation.html#relaying_pose_data_to_px4
    4. When I publish the topic /tf, no result comes in? Do you have some idea about how I can fix that

    Like

  33. Hi Jaeyoung,

    Thank you for your post it is really helpful on how to use MAVROS with the Offboard mode. My goal is to design and replace the position and attitude controller of px4 in MAVROS. I would then need to publish on the Actuator Control topic and change the “controls” variable documented as “raw servo values for direct actuator controls”. But what are exactly those values ? PWM ?

    Like

    • @Daniel Blanquez Thank you for the comments. Why would you want to change the control actuators through mavros? The communication bandwidth is usually not enough, and you are basically duplicating what is done in px4. Why don’t you create a px4 application directly and run your code in the micro controller?

      Like

      • Because my goal is to develop an external controller that would be an add-on to the position and attitude controller of px4. To do that I either need to understand exactly how the px4 controller works or to replace it with my own controller. To replace the position and attitude controller of px4 you then suggest to do it as a px4 application ?

        Like

    • @Daniel Blanquez External position/attitude control doesn’t necessarily mean you need to control actuator topics. For example, https://github.com/Jaeyoung-Lim/mavros_controllers This is my project of a external geometric controller but it sends body rate setpoints so that the flight controller can follow it more reliably. If you plan to use actuator setpoints, yes I think it is a better choice to implement it into px4 directly. However, you can also do what I did and use angular rate setpoints so you can benefit from the high rate feedback loop in px4

      Like

  34. Hey Jaeyong:
    Thank you for this website. It s really very helpful:)
    I have a drone that I want to control with px4. The mavros connection works fine und I can arm the vehicle with the mavrosservice. the motors start also to turn. I can also send actuator commands and the drone does what I want. But when It comes to send position set_points or attitude_setpoints. It doesnt work. I couldn find the Problem und I dont konw how to debug it.

    Like

      • Thank you for your response.
        Have you maybe some tipps how Can I search for the Problem.
        Here is my output when I start the mavros node:

        PARAMETERS
        /mavros/cmd/use_comp_id_system_control: False
        /mavros/conn/heartbeat_rate: 1.0
        /mavros/conn/system_time_rate: 1.0
        /mavros/conn/timeout: 10.0
        /mavros/conn/timesync_rate: 10.0
        /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
        /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
        /mavros/distance_sensor/hrlv_ez4_pub/id: 0
        /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
        /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
        /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
        /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
        /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
        /mavros/distance_sensor/laser_1_sub/id: 3
        /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
        /mavros/distance_sensor/laser_1_sub/subscriber: True
        /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
        /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
        /mavros/distance_sensor/lidarlite_pub/id: 1
        /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
        /mavros/distance_sensor/lidarlite_pub/send_tf: True
        /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
        /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
        /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
        /mavros/distance_sensor/sonar_1_sub/id: 2
        /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
        /mavros/distance_sensor/sonar_1_sub/subscriber: True
        /mavros/fake_gps/eph: 2.0
        /mavros/fake_gps/epv: 2.0
        /mavros/fake_gps/fix_type: 3
        /mavros/fake_gps/geo_origin/alt: 408.0
        /mavros/fake_gps/geo_origin/lat: 47.3667
        /mavros/fake_gps/geo_origin/lon: 8.55
        /mavros/fake_gps/gps_rate: 5.0
        /mavros/fake_gps/mocap_transform: True
        /mavros/fake_gps/satellites_visible: 5
        /mavros/fake_gps/tf/child_frame_id: fix
        /mavros/fake_gps/tf/frame_id: map
        /mavros/fake_gps/tf/listen: False
        /mavros/fake_gps/tf/rate_limit: 10.0
        /mavros/fake_gps/tf/send: False
        /mavros/fake_gps/use_mocap: True
        /mavros/fake_gps/use_vision: False
        /mavros/fcu_protocol: v2.0
        /mavros/fcu_url: /dev/ttyACM0:57600
        /mavros/gcs_url:
        /mavros/global_position/child_frame_id: base_link
        /mavros/global_position/frame_id: map
        /mavros/global_position/gps_uere: 1.0
        /mavros/global_position/rot_covariance: 99999.0
        /mavros/global_position/tf/child_frame_id: base_link
        /mavros/global_position/tf/frame_id: map
        /mavros/global_position/tf/global_frame_id: earth
        /mavros/global_position/tf/send: False
        /mavros/global_position/use_relative_alt: True
        /mavros/image/frame_id: px4flow
        /mavros/imu/angular_velocity_stdev: 0.0003490659 // 0…
        /mavros/imu/frame_id: base_link
        /mavros/imu/linear_acceleration_stdev: 0.0003
        /mavros/imu/magnetic_stdev: 0.0
        /mavros/imu/orientation_stdev: 1.0
        /mavros/landing_target/camera/fov_x: 2.0071286398
        /mavros/landing_target/camera/fov_y: 2.0071286398
        /mavros/landing_target/image/height: 480
        /mavros/landing_target/image/width: 640
        /mavros/landing_target/land_target_type: VISION_FIDUCIAL
        /mavros/landing_target/listen_lt: False
        /mavros/landing_target/mav_frame: LOCAL_NED
        /mavros/landing_target/target_size/x: 0.3
        /mavros/landing_target/target_size/y: 0.3
        /mavros/landing_target/tf/child_frame_id: camera_center
        /mavros/landing_target/tf/frame_id: landing_target
        /mavros/landing_target/tf/listen: False
        /mavros/landing_target/tf/rate_limit: 10.0
        /mavros/landing_target/tf/send: True
        /mavros/local_position/frame_id: map
        /mavros/local_position/tf/child_frame_id: base_link
        /mavros/local_position/tf/frame_id: map
        /mavros/local_position/tf/send: False
        /mavros/local_position/tf/send_fcu: False
        /mavros/mission/pull_after_gcs: True
        /mavros/mocap/use_pose: True
        /mavros/mocap/use_tf: False
        /mavros/odometry/fcu/odom_child_id_des: base_link
        /mavros/odometry/fcu/odom_parent_id_des: map
        /mavros/plugin_blacklist: [‘safety_area’, ‘…
        /mavros/plugin_whitelist: []
        /mavros/px4flow/frame_id: px4flow
        /mavros/px4flow/ranger_fov: 0.118682
        /mavros/px4flow/ranger_max_range: 5.0
        /mavros/px4flow/ranger_min_range: 0.3
        /mavros/safety_area/p1/x: 1.0
        /mavros/safety_area/p1/y: 1.0
        /mavros/safety_area/p1/z: 1.0
        /mavros/safety_area/p2/x: -1.0
        /mavros/safety_area/p2/y: -1.0
        /mavros/safety_area/p2/z: -1.0
        /mavros/setpoint_accel/send_force: False
        /mavros/setpoint_attitude/reverse_thrust: False
        /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
        /mavros/setpoint_attitude/tf/frame_id: map
        /mavros/setpoint_attitude/tf/listen: False
        /mavros/setpoint_attitude/tf/rate_limit: 50.0
        /mavros/setpoint_attitude/use_quaternion: False
        /mavros/setpoint_position/mav_frame: LOCAL_NED
        /mavros/setpoint_position/tf/child_frame_id: target_position
        /mavros/setpoint_position/tf/frame_id: map
        /mavros/setpoint_position/tf/listen: False
        /mavros/setpoint_position/tf/rate_limit: 50.0
        /mavros/setpoint_raw/thrust_scaling: 1.0
        /mavros/setpoint_velocity/mav_frame: LOCAL_NED
        /mavros/startup_px4_usb_quirk: True
        /mavros/sys/disable_diag: False
        /mavros/sys/min_voltage: 10.0
        /mavros/target_component_id: 1
        /mavros/target_system_id: 1
        /mavros/tdr_radio/low_rssi: 40
        /mavros/time/time_ref_source: fcu
        /mavros/time/timesync_avg_alpha: 0.6
        /mavros/time/timesync_mode: MAVLINK
        /mavros/vibration/frame_id: base_link
        /mavros/vision_pose/tf/child_frame_id: vision_estimate
        /mavros/vision_pose/tf/frame_id: odom
        /mavros/vision_pose/tf/listen: False
        /mavros/vision_pose/tf/rate_limit: 10.0
        /mavros/vision_speed/listen_twist: True
        /mavros/vision_speed/twist_cov: True
        /mavros/wheel_odometry/child_frame_id: base_link
        /mavros/wheel_odometry/count: 2
        /mavros/wheel_odometry/frame_id: odom
        /mavros/wheel_odometry/send_raw: True
        /mavros/wheel_odometry/send_twist: False
        /mavros/wheel_odometry/tf/child_frame_id: base_link
        /mavros/wheel_odometry/tf/frame_id: odom
        /mavros/wheel_odometry/tf/send: False
        /mavros/wheel_odometry/use_rpm: False
        /mavros/wheel_odometry/vel_error: 0.1
        /mavros/wheel_odometry/wheel0/radius: 0.05
        /mavros/wheel_odometry/wheel0/x: 0.0
        /mavros/wheel_odometry/wheel0/y: -0.15
        /mavros/wheel_odometry/wheel1/radius: 0.05
        /mavros/wheel_odometry/wheel1/x: 0.0
        /mavros/wheel_odometry/wheel1/y: 0.15
        /rosdistro: kinetic
        /rosversion: 1.12.14
        NODES
        /
        mavros (mavros/mavros_node)

        auto-starting new master
        process[master]: started with pid [5053]
        ROS_MASTER_URI=http://localhost:11311

        setting /run_id to a7ad4db0-8199-11ea-a9de-dc85def86db3
        process[rosout-1]: started with pid [5066]
        started core service [/rosout]
        process[mavros-2]: started with pid [5084]
        [ INFO] [1587230754.617274039]: FCU URL: /dev/ttyACM0:57600
        [ INFO] [1587230754.620913481]: serial0: device: /dev/ttyACM0 @ 57600 bps
        [ INFO] [1587230754.621778125]: GCS bridge disabled
        [ INFO] [1587230754.639949832]: Plugin 3dr_radio loaded
        [ INFO] [1587230754.642840836]: Plugin 3dr_radio initialized
        [ INFO] [1587230754.642986137]: Plugin actuator_control loaded
        [ INFO] [1587230754.649998070]: Plugin actuator_control initialized
        [ INFO] [1587230754.655602204]: Plugin adsb loaded
        [ INFO] [1587230754.661047930]: Plugin adsb initialized
        [ INFO] [1587230754.661299325]: Plugin altitude loaded
        [ INFO] [1587230754.663016734]: Plugin altitude initialized
        [ INFO] [1587230754.663247038]: Plugin cam_imu_sync loaded
        [ INFO] [1587230754.664355512]: Plugin cam_imu_sync initialized
        [ INFO] [1587230754.664598298]: Plugin command loaded
        [ INFO] [1587230754.674940931]: Plugin command initialized
        [ INFO] [1587230754.675165442]: Plugin companion_process_status loaded
        [ INFO] [1587230754.681536613]: Plugin companion_process_status initialized
        [ INFO] [1587230754.681755392]: Plugin debug_value loaded
        [ INFO] [1587230754.688794715]: Plugin debug_value initialized
        [ INFO] [1587230754.688850375]: Plugin distance_sensor blacklisted
        [ INFO] [1587230754.689094639]: Plugin fake_gps loaded
        [ INFO] [1587230754.713705324]: Plugin fake_gps initialized
        [ INFO] [1587230754.714011920]: Plugin ftp loaded
        [ INFO] [1587230754.725618297]: Plugin ftp initialized
        [ INFO] [1587230754.725867334]: Plugin global_position loaded
        [ INFO] [1587230754.751573413]: Plugin global_position initialized
        [ INFO] [1587230754.751811367]: Plugin gps_rtk loaded
        [ INFO] [1587230754.755901156]: Plugin gps_rtk initialized
        [ INFO] [1587230754.756165899]: Plugin hil loaded
        [ INFO] [1587230754.781823847]: Plugin hil initialized
        [ INFO] [1587230754.782139713]: Plugin home_position loaded
        [ INFO] [1587230754.788699376]: Plugin home_position initialized
        [ INFO] [1587230754.789102071]: Plugin imu loaded
        [ INFO] [1587230754.804786598]: Plugin imu initialized
        [ INFO] [1587230754.805066243]: Plugin landing_target loaded
        [ INFO] [1587230754.833368344]: Plugin landing_target initialized
        [ INFO] [1587230754.833809332]: Plugin local_position loaded
        [ INFO] [1587230754.846106327]: Plugin local_position initialized
        [ INFO] [1587230754.846380567]: Plugin log_transfer loaded
        [ INFO] [1587230754.852512253]: Plugin log_transfer initialized
        [ INFO] [1587230754.852879622]: Plugin manual_control loaded
        [ INFO] [1587230754.859846611]: Plugin manual_control initialized
        [ INFO] [1587230754.860169211]: Plugin mocap_pose_estimate loaded
        [ INFO] [1587230754.870832746]: Plugin mocap_pose_estimate initialized
        [ INFO] [1587230754.871117895]: Plugin mount_control loaded
        [ INFO] [1587230754.878671776]: Plugin mount_control initialized
        [ INFO] [1587230754.878941114]: Plugin obstacle_distance loaded
        [ INFO] [1587230754.884405535]: Plugin obstacle_distance initialized
        [ INFO] [1587230754.884662026]: Plugin odom loaded
        [ INFO] [1587230754.894174953]: Plugin odom initialized
        [ INFO] [1587230754.894449672]: Plugin onboard_computer_status loaded
        [ INFO] [1587230754.899795615]: Plugin onboard_computer_status initialized
        [ INFO] [1587230754.900201466]: Plugin param loaded
        [ INFO] [1587230754.905537254]: Plugin param initialized
        [ INFO] [1587230754.905762382]: Plugin px4flow loaded
        [ INFO] [1587230754.917180185]: Plugin px4flow initialized
        [ INFO] [1587230754.917273473]: Plugin rangefinder blacklisted
        [ INFO] [1587230754.917722086]: Plugin rc_io loaded
        [ INFO] [1587230754.925963592]: Plugin rc_io initialized
        [ INFO] [1587230754.926039131]: Plugin safety_area blacklisted
        [ INFO] [1587230754.926310443]: Plugin setpoint_accel loaded
        [ INFO] [1587230754.932290178]: Plugin setpoint_accel initialized
        [ INFO] [1587230754.932699787]: Plugin setpoint_attitude loaded
        [ INFO] [1587230754.948817940]: Plugin setpoint_attitude initialized
        [ INFO] [1587230754.949134188]: Plugin setpoint_position loaded
        [ INFO] [1587230754.977784831]: Plugin setpoint_position initialized
        [ INFO] [1587230754.978098074]: Plugin setpoint_raw loaded
        [ INFO] [1587230754.994887365]: Plugin setpoint_raw initialized
        [ INFO] [1587230754.995191939]: Plugin setpoint_trajectory loaded
        [ INFO] [1587230755.003344049]: Plugin setpoint_trajectory initialized
        [ INFO] [1587230755.003680917]: Plugin setpoint_velocity loaded
        [ INFO] [1587230755.015955031]: Plugin setpoint_velocity initialized
        [ INFO] [1587230755.016835415]: Plugin sys_status loaded
        [ INFO] [1587230755.041671687]: Plugin sys_status initialized
        [ INFO] [1587230755.042017528]: Plugin sys_time loaded
        [ INFO] [1587230755.056171261]: TM: Timesync mode: MAVLINK
        [ INFO] [1587230755.058675763]: Plugin sys_time initialized
        [ INFO] [1587230755.058958963]: Plugin trajectory loaded
        [ INFO] [1587230755.069566064]: Plugin trajectory initialized
        [ INFO] [1587230755.069908752]: Plugin vfr_hud loaded
        [ INFO] [1587230755.071317821]: Plugin vfr_hud initialized
        [ INFO] [1587230755.071386214]: Plugin vibration blacklisted
        [ INFO] [1587230755.071687638]: Plugin vision_pose_estimate loaded
        [ INFO] [1587230755.088142643]: Plugin vision_pose_estimate initialized
        [ INFO] [1587230755.088479920]: Plugin vision_speed_estimate loaded
        [ INFO] [1587230755.095482271]: Plugin vision_speed_estimate initialized
        [ INFO] [1587230755.095818186]: Plugin waypoint loaded
        [ INFO] [1587230755.103969036]: Plugin waypoint initialized
        [ INFO] [1587230755.104022401]: Plugin wheel_odometry blacklisted
        [ INFO] [1587230755.104417505]: Plugin wind_estimation loaded
        [ INFO] [1587230755.106645862]: Plugin wind_estimation initialized
        [ INFO] [1587230755.106772491]: Autostarting mavlink via USB on PX4
        [ INFO] [1587230755.107091248]: Built-in SIMD instructions: SSE, SSE2
        [ INFO] [1587230755.107132527]: Built-in MAVLink package version: 2020.4.4
        [ INFO] [1587230755.107232808]: Known MAVLink dialects: common ardupilotmega ASLUAV autoquad icarous matrixpilot paparazzi slugs standard uAvionix ualberta
        [ INFO] [1587230755.107307175]: MAVROS started. MY ID 1.240, TARGET ID 1.1
        [ INFO] [1587230755.223903269]: IMU: High resolution IMU detected!
        [ INFO] [1587230755.225927511]: IMU: Attitude quaternion IMU detected!
        [ INFO] [1587230755.443214204]: RC_CHANNELS message detected!
        [ INFO] [1587230755.859208576]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
        [ INFO] [1587230755.864818494]: IMU: High resolution IMU detected!
        [ INFO] [1587230755.865256801]: IMU: Attitude quaternion IMU detected!
        [ INFO] [1587230755.943907658]: RC_CHANNELS message detected!
        [ERROR] [1587230756.029910073]: FCU: Onboard controller lost
        [ INFO] [1587230756.081858866]: FCU: Onboard controller regained
        [ INFO] [1587230756.865514759]: VER: 1.1: Capabilities 0x000000000000e4ef
        [ INFO] [1587230756.865611160]: VER: 1.1: Flight software: 010a01ff (e0f016c2b3000000)
        [ INFO] [1587230756.865694507]: VER: 1.1: Middleware software: 010a01ff (e0f016c2b3000000)
        [ INFO] [1587230756.865778943]: VER: 1.1: OS software: 071d00ff (427238133be2b0ec)
        [ INFO] [1587230756.865855775]: VER: 1.1: Board hardware: 00000032
        [ INFO] [1587230756.865930262]: VER: 1.1: VID/PID: 26ac:0032
        [ INFO] [1587230756.866003260]: VER: 1.1: UID: 3038510738333933
        [ WARN] [1587230756.867597214]: CMD: Unexpected command 520, result 0
        [ INFO] [1587230765.860215512]: HP: requesting home position
        [ INFO] [1587230770.861342169]: WP: mission received
        [ INFO] [1587230775.859518018]: HP: requesting home position
        [ INFO] [1587230785.859820618]: HP: requesting home position

        Like

  35. The topics “/mavros/setpoint_attitude/att_throttle” and “/mavros/setpoint_attitude/attitude” are not showing up when I do “rostopic list”. I tried “mavros/setpoint_raw/attitude”, but in that topic, I could send only the angular velocity and not the orientation. Am I missing something here?

    Like

Leave a comment