|
|
|
@ -64,7 +64,7 @@ static socklen_t _addrlen = sizeof(_srcaddr);
@@ -64,7 +64,7 @@ static socklen_t _addrlen = sizeof(_srcaddr);
|
|
|
|
|
using namespace simulator; |
|
|
|
|
|
|
|
|
|
void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) { |
|
|
|
|
float out[8]; |
|
|
|
|
float out[8] = {}; |
|
|
|
|
|
|
|
|
|
const float pwm_center = (PWM_HIGHEST_MAX + PWM_LOWEST_MIN) / 2; |
|
|
|
|
|
|
|
|
@ -95,6 +95,12 @@ void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) {
@@ -95,6 +95,12 @@ void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if vehicle status has not yet been updated, set actuator commands to zero
|
|
|
|
|
// this is to prevent the simulation getting into a bad state
|
|
|
|
|
if (_vehicle_status.timestamp == 0) { |
|
|
|
|
memset(out, 0, sizeof(out)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
actuator_msg.time_usec = hrt_absolute_time(); |
|
|
|
|
actuator_msg.roll_ailerons = out[0]; |
|
|
|
|
actuator_msg.pitch_elevator = _vehicle_status.is_rotary_wing ? out[1] : -out[1]; |
|
|
|
|