OFFBOARD mode problem

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

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

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

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

@saeidfallah1132 You can find the message definitions in geometry_msgs/PoseStamped Documentation

The timestamp is inside the header

Could you maybe share the flightlog tjat shows your issue?

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

Here you can find offboard control sample python code:

@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:

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

Kindly, please advise me on this matter.

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

Surely. This is how it looked like РобоКросс 2019 - YouTube

@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

@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

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 ?

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 ?

Here is step-by-step instruction: Вход в Aeronet, эпизод 2: Самонаводящийся дрон / Хабр.
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

@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 ?

@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

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

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

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/

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
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.

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

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 (931.5 KB)

thanks

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 (931.5 KB)

thanks.