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.
This commit is contained in:
Andrew Tridgell 2014-11-20 17:03:29 +11:00
parent 724ec0ec8b
commit a7a68c88a2
1 changed files with 19 additions and 1 deletions

View File

@ -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);