i’m using mro pixracer-pro with arducopter 4.4.0, mavros and my position estimate is via visual odometry.
my sequence is set mode to guided, arm, takeoff to 1m, move 1m forward (in the yaw i had at takeoff)
this almost works, i get a good takeoff and start moving in the direction i want, but right after i finish my takeoff and give the move forward command i get a fcu error “bad vision position” and the drone doesn’t stop moving forward even after i cleared the 1m mark.
my code for motion:
def _move_impl(self, pos_x, pos_y, pos_z, yaw_rate):
# Use Position : 0b110111111000 / 0x0DF8 / 3576 (decimal)
# Use Velocity : 0b110111000111 / 0x0DC7 / 3527 (decimal)
# Use Acceleration : 0b110000111111 / 0x0C3F / 3135 (decimal)
# Use Pos+Vel : 0b110111000000 / 0x0DC0 / 3520 (decimal)
# Use Pos+Vel+Accel : 0b110000000000 / 0x0C00 / 3072 (decimal)
# Use Yaw : 0b100111111111 / 0x09FF / 2559 (decimal)
# Use Yaw Rate : 0b010111111111 / 0x05FF / 1535 (decimal)
# 0b, yaw_rate, yaw, 0, pos_x, pos_y, pos_z, vel_x, vel_y, vel_z, acc_x, acc_y, acc_z
type_mask = 0b010111111000 # position and yaw rate
self.autopilot.mav.set_position_target_local_ned_send( #mav.send(mavutil.mavlink.MAVLink_set_position_target_local_ned_message(
10,
self.autopilot.target_system,
self.autopilot.target_component,
mavutil.mavlink.MAV_FRAME_LOCAL_NED, #mavutil.mavlink.MAV_FRAME_BODY_NED,
type_mask,
pos_x, pos_y, pos_z, # position
0.0, 0.0, 0.0, # velocity
0.0, 0.0, 0.0, # acceleration
0.0, yaw_rate) # yaw and yaw rate
def move(self, pos_x, pos_y, pos_z, yaw_rate = 0.0):
print("flying to: ", str(pos_x), ", ", str(pos_y), ", ", str(pos_z))
print("with yaw rate: ", str(yaw_rate))
self._move_impl(pos_x, pos_y, pos_z, yaw_rate)