Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DroneKit condition_yaw() and NED_Velocity() not working #1218

Open
freestuffasd opened this issue Mar 30, 2024 · 0 comments
Open

DroneKit condition_yaw() and NED_Velocity() not working #1218

freestuffasd opened this issue Mar 30, 2024 · 0 comments

Comments

@freestuffasd
Copy link

A week ago my follow me program was working fine. Suddenly it started showing unexpected behavior.
Only positive x velocity and positive yaw is working fine
All other commands showing unexpected circular movement at a position.

def send_movement_command_YAW(heading):
global vehicle
speed = 0
direction = 1 #direction -1 ccw, 1 cw

#heading 0 to 360 degree. if negative then ccw 

print("Sending YAW movement command with heading: %f" % heading)

if heading < 0:
    heading = heading*-1
    direction = -1

#point drone into correct heading 
msg = vehicle.message_factory.command_long_encode(
    0, 0,       
    mavutil.mavlink.MAV_CMD_CONDITION_YAW, 
    0,          
    heading,    
    speed,      #speed deg/s
    direction,  
    1,          #relative offset 1
    0, 0, 0)    

# send command to vehicle
vehicle.send_mavlink(msg)
#Vehicle.commands.flush()

def send_movement_command_XYA(velocity_x, velocity_y, altitude):
global vehicle

#velocity_x positive = forward. negative = backwards
#velocity_y positive = right. negative = left
#velocity_z positive = down. negative = up (Yes really!)

print("Sending XYZ movement command with v_x(forward/backward): %f v_y(right/left): %f " % (velocity_x,velocity_y))

msg = vehicle.message_factory.set_position_target_local_ned_encode(
    0,      
    0, 0,    
    mavutil.mavlink.MAV_FRAME_BODY_NED,  #relative to drone heading pos relative to EKF origin
    0b0000111111100011, #ignore velocity z and other pos arguments
    0, 0, altitude,
    velocity_x, velocity_y, 0, 
    0, 0, 0, 
    0, 0)    

vehicle.send_mavlink(msg)
#Vehicle.commands.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant