# OFFBOARD mode problem

**URL:** <https://discuss.px4.io/t/offboard-mode-problem/23536>\
**Category:** Uncategorized\
**Created:** [July 30, 2021, 12:55pm UTC](https://discuss.px4.io/t/offboard-mode-problem/23536 "2021-07-30T12:55:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [July 30, 2021, 12:55pm UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/1 "2021-07-30T12:55:14Z")

</div>

Dear All  
I’ve been working on a real autonomous drone project.  
Basically an on board computer is connected to Pixhwak (FC).  
I could change the FC mode to OFFBOARD and I could Arm the drone successfully.

Hardware: Pixhawk4  
Software: Px4  
Onboard computer:RPi4  
Protocol: Mavros

I use this code example :  
[https://docs.px4.io/master/en/ros/mavros\_offboard.html](https://docs.px4.io/master/en/ros/mavros_offboard.html)

I am sending this topic:  
mavros/setpoint\_position/local  
And I send this set points:

geometry\_msgs::PoseStamped pose;  
pose.pose.position.x = 0;  
pose.pose.position.y = 0;  
pose.pose.position.z = 2;

My issue is the drone can’t take of and go to the location which I am sending the set points via MAVLink ( position control)  
Could you please advise me on this matter?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [July 31, 2021, 8:05am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/2 "2021-07-31T08:05:31Z")

</div>

@saeidfallah1132 You are not populating the PoseStamped messages with the timestamps

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [July 31, 2021, 8:51am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/3 "2021-07-31T08:51:27Z")

</div>

@Jaeyoung-Lim thank you for your reply.  
What is the timestamp ? How can I add it ?

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [July 31, 2021, 3:56pm UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/4 "2021-07-31T15:56:26Z")

</div>

@saeidfallah1132 You can find the message definitions in [geometry\_msgs/PoseStamped Documentation](http://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/PoseStamped.html)

The timestamp is inside the header

Could you maybe share the flightlog tjat shows your issue?

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 1, 2021, 1:09am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/5 "2021-08-01T01:09:53Z")

</div>

I read the document. As far as I understand, what I need to publish are:

pos.header.stamp = ros::Time::now;  
pose.pose.position.x = 0;  
pose.pose.position.y = 0;  
pose.pose.position.z = 2;

Then drone has to take off and move to z=2 meter.  
Is it right ?

The below link is my log file:  
[https://logs.px4.io/plot\_app?log=dd8b2026-7bb3-4118-90c3-eaa4330e3dfe](https://logs.px4.io/plot_app?log=dd8b2026-7bb3-4118-90c3-eaa4330e3dfe)

---

<div class="post-metadata">

**Author:** ![copterspace](https://discuss.px4.io/user_avatar/discuss.px4.io/copterspace/32/3187_2.png) [@copterspace](https://discuss.px4.io/u/copterspace)\
**Post date:** [August 2, 2021, 5:27am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/6 "2021-08-02T05:27:27Z")

</div>

Here you can find offboard control sample python code:

> **[GitHub - copterspace/robocross2019: Baloon visual detector + steering node...](https://github.com/copterspace/robocross2019)**
>
> Baloon visual detector + steering node for RPI+PX4 quad flight stack - GitHub - copterspace/robocross2019: Baloon visual detector + steering node for RPI+PX4 quad flight stack

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 3, 2021, 7:48am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/7 "2021-08-03T07:48:53Z")

</div>

@Jaeyoung-Lim As you advised, I sent the timestamp, seq and frame\_id with the setpints

```
   pose.header.stamp = ros::Time::now();
   pose.header.seq=count;
   pose.header.frame_id = 1;
   local_pos_pub.publish(pose);

```

To make sure the header data is sending, I subscribe to the topic:  
_ **mavros/setpoint\_position/local** _  
This is how the result looks like:

 ![Position_ctrl](https://discuss.px4.io/uploads/default/original/2X/4/492e582863b13d5e7b244eedce2bd31ce3299796.png)

**BTW, I do not have RC attached to the Pixhawk. My plan is to take off the drone without RC.**

The drone still cannot take off. I attached the log file and don’t know how to troubleshoot from the log file.  
The below link is my log file:

[https://logs.px4.io/plot\_app?log=dd8b2026-7bb3-4118-90c3-eaa4330e3dfe](https://logs.px4.io/plot_app?log=dd8b2026-7bb3-4118-90c3-eaa4330e3dfe)

Kindly, please advise me on this matter.

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 3, 2021, 7:50am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/8 "2021-08-03T07:50:03Z")

</div>

@copterspace Thank you for sharing the link. Have you test it on the real drone ?

---

<div class="post-metadata">

**Author:** ![copterspace](https://discuss.px4.io/user_avatar/discuss.px4.io/copterspace/32/3187_2.png) [@copterspace](https://discuss.px4.io/u/copterspace)\
**Post date:** [August 3, 2021, 8:06am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/9 "2021-08-03T08:06:04Z")

</div>

Surely. This is how it looked like [РобоКросс 2019 - YouTube](https://www.youtube.com/watch?v=YqR_UTF9HM8)

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [August 3, 2021, 8:12am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/10 "2021-08-03T08:12:17Z")

</div>

@saeidfallah1132 If you look at the log, you can see that your altitude estimate is somehow higher(50m) than 2m. Therefore I think the vehicle behavior is correct.

I think you might have a height estimation issue hat needs to be solved before you go into offboard mode

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 3, 2021, 8:26am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/11 "2021-08-03T08:26:22Z")

</div>

@Jaeyoung-Lim This the new log (yesterday) after the code correction (add timestamp)

[https://logs.px4.io/plot\_app?log=f0b090f8-468a-41b1-8825-f93ab29eaf08](https://logs.px4.io/plot_app?log=f0b090f8-468a-41b1-8825-f93ab29eaf08)

Are you referring to GPS altitude ?  
I tested the drone in my apartment at level 9.  
how can I solve height estimation issue? why is it happening ?

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 3, 2021, 10:24am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/12 "2021-08-03T10:24:28Z")

</div>

Thank you for sharing the valuable video.  
May I know what kind of configurate do I have to set for OFFBOARD mode (Position Control) in QGC software ?

---

<div class="post-metadata">

**Author:** ![copterspace](https://discuss.px4.io/user_avatar/discuss.px4.io/copterspace/32/3187_2.png) [@copterspace](https://discuss.px4.io/u/copterspace)\
**Post date:** [August 3, 2021, 10:51am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/13 "2021-08-03T10:51:30Z")

</div>

Here is step-by-step instruction: [Вход в Aeronet, эпизод 2: Самонаводящийся дрон / Хабр](https://habr.com/ru/post/461887/).  
It is in Russian, you may google-translate it, I hope it will be readable.  
There are also some pics and code…

[https://translate.google.com/translate?hl=&sl=ru&tl=en&u=https%3A%2F%2Fhabr.com%2Fru%2Fpost%2F461887%2F](https://translate.google.com/translate?hl=&sl=ru&tl=en&u=https%3A%2F%2Fhabr.com%2Fru%2Fpost%2F461887%2F)

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 4, 2021, 7:15am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/14 "2021-08-04T07:15:44Z")

</div>

@copterspace Thank you for sharing the instruction. Today I am going to try your code and will update you on the result.  
I have a question, As I mentioned, I do not have a RC in my application so that there is no receiver attached to the pixhawk.  
Shall I disable failsafe RC permission in QGS software ?

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 4, 2021, 9:41am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/15 "2021-08-04T09:41:46Z")

</div>

@copterspace I just tested your code. The link below is the result of test which I recorded my screen.  
[https://drive.google.com/drive/folders/179jPpZLetP8EUxpVsfcYJJQriP0tWyvM?usp=sharing](https://drive.google.com/drive/folders/179jPpZLetP8EUxpVsfcYJJQriP0tWyvM?usp=sharing)

Conclusion:  
Drone changed the mode to AUTO.TAKEOFF then the mode changed to AUTO.RTL.  
The mode didn’t change to OFFBOARD Mode.  
I noticed that on the terminal I received the below Warning:  
**[WARN] [1563116702.366064401]: TM : RTT too high for timesync: 13.14 ms.**

BTW, I used a serial to USB converter which is connect to Pixhawk’s TELEM2

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 5, 2021, 4:50am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/16 "2021-08-05T04:50:44Z")

</div>

@Jaeyoung-Lim  
Could you please guide me what shall I do ?

---

<div class="post-metadata">

**Author:** ![copterspace](https://discuss.px4.io/user_avatar/discuss.px4.io/copterspace/32/3187_2.png) [@copterspace](https://discuss.px4.io/u/copterspace)\
**Post date:** [August 5, 2021, 6:22am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/17 "2021-08-05T06:22:32Z")

</div>

Imho, you better first reproduce jmavsim autonomous flight exactly as it is described here:  
[https://translate.google.com/translate?sl=ru&tl=en&u=https://habr.com/ru/post/434220/](https://translate.google.com/translate?sl=ru&tl=en&u=https://habr.com/ru/post/434220/)

After you succeed with jmavsim - try to apply this approach to real drone.  
[https://translate.google.com/translate?hl=&sl=ru&tl=en&u=https%3A%2F%2Fhabr.com%2Fru%2Fpost%2F461887%2F](https://translate.google.com/translate?hl=&sl=ru&tl=en&u=https%3A%2F%2Fhabr.com%2Fru%2Fpost%2F461887%2F)  
When jmavim works OK - at least you’ll be assured the problem is not in onboard computer code.  
Then you’ll be able to concentrate on solving real drone setup issues.

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [August 5, 2021, 11:22am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/18 "2021-08-05T11:22:14Z")

</div>

@saeidfallah1132 What is your baudrate? make sure it is over 921600

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 8, 2021, 5:22am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/19 "2021-08-08T05:22:16Z")

</div>

My Baudrate setup is 921600 and I use the below command in the terminal

**roslaunch mavros px4.launch fcu\_url:=/dev/ttyUSB0:921600**

I tested again the drone, still had the same problem. doesn’t allow the drone to take-off.  
[OFFBOARD\_\_Setup Report.pdf|attachment]  
I’ve prepared a report for your review and your advise.  
Please have a look and give me your feedback .  
[OFFBOARD\_\_Setup Report.pdf](https://discuss.px4.io/uploads/short-url/h1F2lkw4Z5yxsezj5wMM0L7JrdC.pdf) (931.5 KB)

thanks

---

<div class="post-metadata">

**Author:** ![saeidfallah1132](https://discuss.px4.io/user_avatar/discuss.px4.io/saeidfallah1132/32/9156_2.png) [@saeidfallah1132](https://discuss.px4.io/u/saeidfallah1132)\
**Post date:** [August 8, 2021, 5:35am UTC](https://discuss.px4.io/t/offboard-mode-problem/23536/20 "2021-08-08T05:35:40Z")

</div>

Hi,  
Thank you for sharing the links.  
Yes, I tested the code in the simulation environment and the result was as expected so that the python script could take-off the drone. However I tested the same code with a real drone. In the real drone, I could change the mode to “OFFBARD” and “ARM” the motors successfully but the drone still cannot take-off.  
Note: There is no RC in my setup.

1. Would it be possible the drone cannot take-off due to not existing the RC.
2. Is there any configuration I have to do to disable the RC failsafe ?

BTW, I attached a report form my setup and results. Please have a look and give me you opinion.  
[OFFBOARD\_\_Setup Report.pdf](https://discuss.px4.io/uploads/short-url/h1F2lkw4Z5yxsezj5wMM0L7JrdC.pdf) (931.5 KB)

thanks.

[Next page](https://discuss.px4.io/t/offboard-mode-problem/23536.md?page=2)
