mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 11:20:35 +08:00
vmount: Store offset in radians and calculated scale factor in OutputConfig instead of raw parameters.
This commit is contained in:
committed by
Beat Küng
parent
ccf3e71b56
commit
fdf4eb0bd6
@@ -74,12 +74,9 @@ int OutputRC::update(const ControlData *control_data)
|
||||
actuator_controls_s actuator_controls;
|
||||
actuator_controls.timestamp = hrt_absolute_time();
|
||||
// _angle_outputs are in radians, actuator_controls are in [-1, 1]
|
||||
actuator_controls.control[0] = (_angle_outputs[0] + _config.roll_offset * M_DEG_TO_RAD_F) /
|
||||
(_config.roll_range * (M_DEG_TO_RAD_F / 2.0f));
|
||||
actuator_controls.control[1] = (_angle_outputs[1] + _config.pitch_offset * M_DEG_TO_RAD_F) /
|
||||
(_config.pitch_range * (M_DEG_TO_RAD_F / 2.0f));
|
||||
actuator_controls.control[2] = (_angle_outputs[2] + _config.yaw_offset * M_DEG_TO_RAD_F) /
|
||||
(_config.yaw_range * (M_DEG_TO_RAD_F / 2.0f));
|
||||
actuator_controls.control[0] = (_angle_outputs[0] + _config.roll_offset) * _config.roll_scale;
|
||||
actuator_controls.control[1] = (_angle_outputs[1] + _config.pitch_offset) * _config.pitch_scale;
|
||||
actuator_controls.control[2] = (_angle_outputs[2] + _config.yaw_offset) * _config.yaw_scale;
|
||||
actuator_controls.control[3] = _retract_gimbal ? _config.gimbal_retracted_mode_value : _config.gimbal_normal_mode_value;
|
||||
|
||||
int instance;
|
||||
|
||||
Reference in New Issue
Block a user