diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-11-20 17:03:29 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2014-11-26 08:32:47 +1100 |
commit | a7a68c88a25c2c4cb401fb4f8894de6f4c280ba2 (patch) | |
tree | 659a3eca6c9809b6ac3c5a6af2276fad0559b957 | |
parent | 724ec0ec8b0d34c631b2784236a990e535700254 (diff) | |
download | px4-firmware-a7a68c88a25c2c4cb401fb4f8894de6f4c280ba2.tar.gz px4-firmware-a7a68c88a25c2c4cb401fb4f8894de6f4c280ba2.tar.bz2 px4-firmware-a7a68c88a25c2c4cb401fb4f8894de6f4c280ba2.zip |
uavcan: show ESC output values in uavcan status, and add arm/disarm
this makes "uavcan status" show the current output values, which is
useful for debugging. It also adds "uavcan arm" and "uavcan disarm"
commands, which are very useful for re-arming after a motor test.
-rw-r--r-- | src/modules/uavcan/uavcan_main.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index e4f58b310..8fa765633 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -604,6 +604,14 @@ UavcanNode::print_info() (unsigned)_groups_subscribed, (unsigned)_groups_required, _poll_fds_num); printf("ESC mixer: %s\n", (_mixers == nullptr) ? "NONE" : "OK"); + if (_outputs.noutputs != 0) { + printf("ESC output: "); + for (uint8_t i=0; i<_outputs.noutputs; i++) { + printf("%d ", (int)(_outputs.output[i]*1000)); + } + printf("\n"); + } + // Sensor bridges auto br = _sensor_bridges.getHead(); while (br != nullptr) { @@ -622,7 +630,7 @@ UavcanNode::print_info() static void print_usage() { warnx("usage: \n" - "\tuavcan {start|status|stop}"); + "\tuavcan {start|status|stop|arm|disarm}"); } extern "C" __EXPORT int uavcan_main(int argc, char *argv[]); @@ -669,6 +677,16 @@ int uavcan_main(int argc, char *argv[]) ::exit(0); } + if (!std::strcmp(argv[1], "arm")) { + inst->arm_actuators(true); + ::exit(0); + } + + if (!std::strcmp(argv[1], "disarm")) { + inst->arm_actuators(false); + ::exit(0); + } + if (!std::strcmp(argv[1], "stop")) { delete inst; ::exit(0); |