diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-25 12:51:38 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-25 13:40:14 +0100 |
commit | 195472fddf0242bfb881aef9e53d910c81a2b003 (patch) | |
tree | 48c3ff79f55e4aab94082cd9952608094b472228 /src/modules | |
parent | a93362c70013281457fb44ab0494157325eb28f9 (diff) | |
download | px4-firmware-195472fddf0242bfb881aef9e53d910c81a2b003.tar.gz px4-firmware-195472fddf0242bfb881aef9e53d910c81a2b003.tar.bz2 px4-firmware-195472fddf0242bfb881aef9e53d910c81a2b003.zip |
fix init of published structs
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/mc_att_control/mc_att_control_base.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/mc_att_control/mc_att_control_base.cpp b/src/modules/mc_att_control/mc_att_control_base.cpp index d7fbf3acd..2315e0a99 100644 --- a/src/modules/mc_att_control/mc_att_control_base.cpp +++ b/src/modules/mc_att_control/mc_att_control_base.cpp @@ -58,8 +58,8 @@ MulticopterAttitudeControlBase::MulticopterAttitudeControlBase() : _publish_att_sp(false) { - memset(&_v_rates_sp, 0, sizeof(_v_att_sp_mod)); - memset(&_v_rates_sp, 0, sizeof(_v_rates_sp_mod)); + memset(&_v_att_sp_mod, 0, sizeof(_v_att_sp_mod)); + memset(&_v_rates_sp_mod, 0, sizeof(_v_rates_sp_mod)); memset(&_actuators, 0, sizeof(_actuators)); _params.att_p.zero(); @@ -98,7 +98,7 @@ void MulticopterAttitudeControlBase::control_attitude(float dt) if (_v_control_mode->get().flag_control_velocity_enabled || _v_control_mode->get().flag_control_climb_rate_enabled) { /* in assisted modes poll 'vehicle_attitude_setpoint' topic and modify it */ - _v_att_sp_mod = _v_att_sp->get(); + memcpy(&_v_att_sp_mod, _v_att_sp->get_void_ptr(), sizeof(_v_att_sp_mod)); } if (!_v_control_mode->get().flag_control_climb_rate_enabled) { @@ -157,7 +157,7 @@ void MulticopterAttitudeControlBase::control_attitude(float dt) } else { /* in non-manual mode use 'vehicle_attitude_setpoint' topic */ - _v_att_sp_mod = _v_att_sp->get(); + memcpy(&_v_att_sp_mod, _v_att_sp->get_void_ptr(), sizeof(_v_att_sp_mod)); /* reset yaw setpoint after non-manual control mode */ _reset_yaw_sp = true; |