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_pathfunction to send the home position instead. I have been using
vio_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 a
T_body_wrt_fixedthat is updated by the
fixed_pose_input, but this seems to be accounted for in the
uart_mavlink_send_fixed_setpointfunction 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_inputsink, 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 the
uart_mavlink.cfile 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 to
T_body_wrt_localbefore 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?