How to set copters Attitude via DroneKit — SET_ATTITUDE_TARGET not working

人走茶凉 提交于 2019-12-12 10:15:58

问题


I have Dronekit working properly with SITL sim, however for my project I want to be able to command the attitude of the copter. Obviously I can do this via RC over ride in ALT_HOLD mode, however I don't like that approach.

I have been trying to use the Mavlink message SET_ATTITUDE_TARGET (#82), however when I send the messages to the sim, nothing happens. I have been able to set the velocity and the position, and those work fine.

Here is my function:

def att_msg_mode():
    print "=========== Building Message"
    veh1.mode = VehicleMode("ALT_HOLD")
    msg = veh1.message_factory.set_attitude_target_encode(
    0,
    0,                #target system
    0,                #target component
    0b11100010,       #type mask
    [.9438,0,0,.17364], #q
    0,                #body roll rate
    0,                #body pitch rate
    0,                #body yaw rate
    0)                #thrust
    time.sleep(1)
    veh1.send_mavlink(msg)
    veh1.flush()
    print "=========== Message Sent"

Can someone help me out?


回答1:


It is not possible to set the attitude directly because the command is not supported by Copter in either guided mode or AUTO mode/missions). The list of supported commands in guided mode is here and AUTO commands here.

What you can do is set the yaw. Another (hacky) approach that may work is setting the ROI as this will point the camera (and often the whole vehicle) at a target.

This sounds like a reasonable requirement - perhaps create a request with explanation of why this is useful for you?




回答2:


SET_ATTITUDE_TARGET is now available to be used in guided_mode. You can even test it using mavproxy attitude command.




回答3:


SET_ATTITUDE_TARGET is now implemented, and will be released with ArduCopter 3.4



来源:https://stackoverflow.com/questions/31391721/how-to-set-copters-attitude-via-dronekit-set-attitude-target-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!