Automatic flight using ROS failed

Hi, I tried to move the Erle Copter automatically, programming a ROS node that suscribes to mavros/setpoint_position/local topic and it was supossed to take off at 4 meters and then move 3 meter in the x axis. But it was a disaster (it crashed), I attach the log file of the flight in case you could look a it and you could find where the error is. I don’t know why it behaved that way, so maybe someone could help me with this.
18-04-28_10-05-40_1.bin (338.6 KB)

We are based in this tutorial: . In the DO STUFF section in the code, we added the following:

ros::Publisher local_pos_pub = n.advertise<geometry_msgs::PoseStamped>(“mavros/setpoint_position/local”,10);
geometry_msgs::PoseStamped pose;

pose.pose.position.x = 3;
pose.pose.position.y = 0;
pose.pose.position.z = 4;
ROS_INFO(“Move X”);

for(int i = 100; ros::ok() && i>0; --i){


Is there anything we are doing wrong? Is this the best way to move the real ErleCopter (not simulated) automatically?
Thanks in advance.

Please have a look at excellent work from @khancyr the wiki and on youtube ,

Additionnal comment on experimenting with automatic flight
Make all test on simulator
Test , retest and TEST AGAIN !!

Make sure that you practice manual override with Radio Control while testing automatic modes

1 Like