I want to hover my quadcopter in offboard mode. I referred the following codes here on px4 website. But, in this case the quadcopter needs a position feedback.
I am trying to do hover indoors where GPS/MOCAP are unavailable. I have a lidar-rangefinder and a px4flow sensor on the platform. I did not find any topic in mavros to which I can publish my altitude setpoints in offboard mode without GPS/MOCAP feedback.
I am not sure if I have missed something in mavros/px4 documentation. It will be great if someone can guide me to solve this problem.
Thank you in advance.
i do not think it is designed to imitate ‘altitude hold’ in OFFBOARD mode. it needs full 3D position, not just height if you use setpoint_position.
well, may be you can control it using setpoint_raw/attitude (http://docs.ros.org/api/mavros_msgs/html/msg/AttitudeTarget.html) commanding it to be level and using a simple controller for thrust to target altitude which you get directly from lidar-lite. but that’s kind of advanced use case
Oh! I was trying to send the data as /mavros/setpoint_attitude/attitude.
It is not responding to the setpoint commands at all in this case.
I did not try it using setpoint_raw/attitude. I will try it and let you know.
Thanks a lot @alexs512
Hello @alexs512: Your suggestion worked. Thank you.
Hi @adipandas @alexs512 ，we are also trying to control drone using
However, when I switch to offboard mode, PX4 always denied and goes into failsafe mode. Could I ask what information did you give to the topic? Does the topic info include attitude in ENU frame, thrust value, and also type_mask and header? Aa detailed explanation of the problem is here https://github.com/mavlink/mavros/issues/1225
Really appreciate if you could help.
setpoint_raw topic, you have to set the
type_mask. So can check out the source-code directly for how to implement the type_mask. I think, when i was working on it, I used type_mask for attitude rates. And only published the attitude and thrust commands to the robot. The attitude is in ENU frame. I also published header.