mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 15:13:35 +08:00
gimbal: implement gimbal_device_id
It turns out that I had omitted implementing the gimbal_device_id which is the component ID of the gimbal device that the gimbal manager (in this case PX4) is responsible for. Signed-off-by: Julian Oes <julian@oes.ch>
This commit is contained in:
@@ -46,7 +46,7 @@ OutputMavlinkV1::OutputMavlinkV1(const Parameters ¶meters)
|
||||
: OutputBase(parameters)
|
||||
{}
|
||||
|
||||
void OutputMavlinkV1::update(const ControlData &control_data, bool new_setpoints)
|
||||
void OutputMavlinkV1::update(ControlData &control_data, bool new_setpoints)
|
||||
{
|
||||
vehicle_command_s vehicle_command{};
|
||||
vehicle_command.timestamp = hrt_absolute_time();
|
||||
@@ -142,7 +142,7 @@ OutputMavlinkV2::OutputMavlinkV2(const Parameters ¶meters)
|
||||
{
|
||||
}
|
||||
|
||||
void OutputMavlinkV2::update(const ControlData &control_data, bool new_setpoints)
|
||||
void OutputMavlinkV2::update(ControlData &control_data, bool new_setpoints)
|
||||
{
|
||||
_check_for_gimbal_device_information();
|
||||
|
||||
@@ -162,6 +162,8 @@ void OutputMavlinkV2::update(const ControlData &control_data, bool new_setpoints
|
||||
_last_update = t;
|
||||
}
|
||||
|
||||
control_data.device_compid = _gimbal_device_found ? _gimbal_device_compid : 0;
|
||||
|
||||
_publish_gimbal_device_set_attitude();
|
||||
}
|
||||
}
|
||||
@@ -206,6 +208,13 @@ void OutputMavlinkV2::print_status() const
|
||||
(double)_angle_velocity[0],
|
||||
(double)_angle_velocity[1],
|
||||
(double)_angle_velocity[2]);
|
||||
|
||||
if (_gimbal_device_found) {
|
||||
PX4_INFO_RAW(" gimbal device compid found: %d\n", _gimbal_device_compid);
|
||||
|
||||
} else {
|
||||
PX4_INFO_RAW(" gimbal device compid not found\n");
|
||||
}
|
||||
}
|
||||
|
||||
void OutputMavlinkV2::_publish_gimbal_device_set_attitude()
|
||||
|
||||
Reference in New Issue
Block a user