Adding Support for a new MAVLink Gimbal

Adding Support for a new MAVLink Gimbal

This page covers how ArduPilot interacts with a MAVLink enabled gimbal. It is meant more as a guide on how gimbal manufacturers can make their gimbals work with ArduPilot with minimum code changes to ArduPilot .

The SToRM32 gimbal is a good reference as it supports MAVLink.

Messages the gimbal should support

  1. The gimbal should listen on the serial port for a HEARBEAT message from the vehicle. It can generally assume that the first heart beat it receives will be from the vehicle but to be certain you can check the “type” field to be sure it’s something sensible (i.e. MAV_TYPE = 1 for fixed wing, 2 for quadcopters but 6 for GCSs should be ignored).

    This heart beat will contain the vehicle’s system-id and component-id. The gimbal should adopt the same system-id but should use a component-id of MAV_COMP_ID_GIMBAL (i.e. 154) for all it’s future messages. In fact, any unique component-id can be used as long as it’s not zero nor the component id of the vehicle or any other device on the vehicle.

  2. The gimbal should send a HEARTBEAT message out the serial port at approximately 1hz

    • the system-id and component-id should be as mentioned above.
    • “type” should be MAV_TYPE_GIMBAL (i.e. 26).
    • “autopilot” is not used so can be set to anything including MAV_AUTOPILOT_GENERIC (i.e. 0)
    • “base_mode” and “custom_mode” are not used so can be set to anything (perhaps 0 is best)
    • “system_status” should be set to “MAV_STATE_ACTIVE” once the gimbal is ready to accept attitude targets
  3. To support reading/writing parameter values from the ground station the gimbal should implement these message:

    • PARAM_REQUEST_READ - if the gimbal receives this message and “target_system” and “target_component” values match the gimbal’s system-id and component-id, it should respond with a PARAM_VALUE message which contains the value of the parameter specified by the “param_id” field (simply an enum, the gimbal can assign whatever enum it wishes to each of it’s internal paramters)
    • PARAM_REQUEST_LIST - respond to this message by sending a PARAM_VALUE message for every parameter within the gimbal.
    • PARAM_SET - respond to this by setting the internal variable to the value in the “param_value” field.
  4. Ardupilot will send angle requests to the gimbal via MAVLink which will arrive asCOMMAND_LONG messages with the “command” field set to MAV_CMD_DO_MOUNT_CONTROL (i.e 205).

    • Param #1 contains desired pitch in degrees
    • Param #2 contains desired roll in degrees
    • Param #3 contains desired yaw in degrees but note that the yaw is in relation to the front of the vehicle so “0” is straight ahead, “90” is to the right, “-90” is to the left.
  5. If the gimbal needs extra data from the vehicle it can request it using theREQUEST_DATA_STREAM message.

    • the target system and component id should be for the vehicle.
    • “req_stream_id” can be any values in the MAV_DATA_STREAM enum. Some useful values are:
      • MAV_DATA_STREAM_POSITION will cause the vehicle to send GLOBAL_POSITION_INTmessages which includes lat, lon, alt, velocity (3d) and heading)
      • MAV_DATA_STREAM_EXTRA1 will send the MSG_ATTITUDE which includes euler angles for roll, pitch, yaw

Testing

To test the system, you should be able to connect the gimbal to a Pixhawk as if it’s a SToRM32 gimbal. In particular check the “Set-up through the Mission Planner (MALVink protocol)” section.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值