aboutsummaryrefslogtreecommitdiff
path: root/src/modules/mc_att_control/mc_att_control_main.cpp
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-05 09:02:06 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-05 09:02:06 +0100
commit2f646e7082b49ef92bf9be1defd6fb7fdeec8480 (patch)
tree07caf9c50fcd0d965314f8416dd5bef3a13a5b1f /src/modules/mc_att_control/mc_att_control_main.cpp
parent4c950eb76b0d63be7936dfcd68eb6eed266b91ad (diff)
downloadpx4-firmware-2f646e7082b49ef92bf9be1defd6fb7fdeec8480.tar.gz
px4-firmware-2f646e7082b49ef92bf9be1defd6fb7fdeec8480.tar.bz2
px4-firmware-2f646e7082b49ef92bf9be1defd6fb7fdeec8480.zip
mc att control: ran fix code style script
Diffstat (limited to 'src/modules/mc_att_control/mc_att_control_main.cpp')
-rw-r--r--src/modules/mc_att_control/mc_att_control_main.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp
index 7bc638e5d..d6a58f418 100644
--- a/src/modules/mc_att_control/mc_att_control_main.cpp
+++ b/src/modules/mc_att_control/mc_att_control_main.cpp
@@ -477,8 +477,9 @@ MulticopterAttitudeControl::task_main()
int pret = poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100);
/* timed out - periodic check for _task_should_exit */
- if (pret == 0)
+ if (pret == 0) {
continue;
+ }
/* this is undesirable but not much we can do - might want to flag unhappy status */
if (pret < 0) {
@@ -522,10 +523,11 @@ MulticopterAttitudeControl::task_main()
if (_att_sp_pub > 0) {
orb_publish(ORB_ID(vehicle_attitude_setpoint), _att_sp_pub,
- &_v_att_sp);
+ &_v_att_sp);
+
} else {
_att_sp_pub = orb_advertise(ORB_ID(vehicle_attitude_setpoint),
- &_v_att_sp);
+ &_v_att_sp);
}
}
@@ -547,7 +549,8 @@ MulticopterAttitudeControl::task_main()
/* attitude controller disabled, poll rates setpoint topic */
if (_v_control_mode.flag_control_manual_enabled) {
/* manual rates control - ACRO mode */
- _rates_sp = math::Vector<3>(_manual_control_sp.y, -_manual_control_sp.x, _manual_control_sp.r).emult(_params.acro_rate_max);
+ _rates_sp = math::Vector<3>(_manual_control_sp.y, -_manual_control_sp.x,
+ _manual_control_sp.r).emult(_params.acro_rate_max);
_thrust_sp = _manual_control_sp.z;
/* reset yaw setpoint after ACRO */
@@ -630,18 +633,21 @@ MulticopterAttitudeControl::start()
int mc_att_control_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 1) {
errx(1, "usage: mc_att_control {start|stop|status}");
+ }
if (!strcmp(argv[1], "start")) {
- if (mc_att_control::g_control != nullptr)
+ if (mc_att_control::g_control != nullptr) {
errx(1, "already running");
+ }
mc_att_control::g_control = new MulticopterAttitudeControl;
- if (mc_att_control::g_control == nullptr)
+ if (mc_att_control::g_control == nullptr) {
errx(1, "alloc failed");
+ }
if (OK != mc_att_control::g_control->start()) {
delete mc_att_control::g_control;
@@ -653,8 +659,9 @@ int mc_att_control_main(int argc, char *argv[])
}
if (!strcmp(argv[1], "stop")) {
- if (mc_att_control::g_control == nullptr)
+ if (mc_att_control::g_control == nullptr) {
errx(1, "not running");
+ }
delete mc_att_control::g_control;
mc_att_control::g_control = nullptr;