Home position offset in offboard flight
-
In vvpx4 I am trying to update the offboard_figure_eight script so that before switching to offboard mode, the home position gets set to the current drone position, and the path gets offset so that it is centered about the current drone state. As a preliminary step I changed the
_send_position_in_path
function to send the home position instead. I have been usingT_body_wrt_local
from thevio_manager
, after making it externally accessible, but there still seems to be some offset I can't account for that moves the drone along -x and -y from what should be the home position (current state at the time of switch to offboard). Is there a different reference frame I should be using? I noticed that there is aT_body_wrt_fixed
that is updated by theapriltag_manager
andfixed_pose_input
, but this seems to be accounted for in theuart_mavlink_send_fixed_setpoint
function that the path waypoints get sent to. Can you please clear up what reference frame would be the correct drone state to use to set my home position to? The current goal is to have the drone hover where it is when it switches to offboard mode, and once this is working, using that same home position to offset the figure8 path, which is centered about the origin by default. -
I've gone further down the rabbit hole and see now that the tag detections update the fixed frame, as does the
fixed_pose_input
sink, which as far as I can tell does not get used and is setup for alternative fixed frame references. I also see now that the setpoints get converted in theuart_mavlink.c
file from fixed to local frame, and when no april tags are used this keeps the value the same. This being said, it seems that, when april tags are not used, the setpoints and the vio position are both set in local frame. If I am understanding this correctly, I should be able to set my home position toT_body_wrt_local
before sending the home position as a setpoint in offboard mode, but the drone seems to always move to some other location. Can you please clarify what my misunderstaning is in this case, if any?