mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-08 18:52:46 +08:00
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:
@@ -604,6 +604,14 @@ UavcanNode::print_info()
|
|||||||
(unsigned)_groups_subscribed, (unsigned)_groups_required, _poll_fds_num);
|
(unsigned)_groups_subscribed, (unsigned)_groups_required, _poll_fds_num);
|
||||||
printf("ESC mixer: %s\n", (_mixers == nullptr) ? "NONE" : "OK");
|
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
|
// Sensor bridges
|
||||||
auto br = _sensor_bridges.getHead();
|
auto br = _sensor_bridges.getHead();
|
||||||
while (br != nullptr) {
|
while (br != nullptr) {
|
||||||
@@ -622,7 +630,7 @@ UavcanNode::print_info()
|
|||||||
static void print_usage()
|
static void print_usage()
|
||||||
{
|
{
|
||||||
warnx("usage: \n"
|
warnx("usage: \n"
|
||||||
"\tuavcan {start|status|stop}");
|
"\tuavcan {start|status|stop|arm|disarm}");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" __EXPORT int uavcan_main(int argc, char *argv[]);
|
extern "C" __EXPORT int uavcan_main(int argc, char *argv[]);
|
||||||
@@ -669,6 +677,16 @@ int uavcan_main(int argc, char *argv[])
|
|||||||
::exit(0);
|
::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")) {
|
if (!std::strcmp(argv[1], "stop")) {
|
||||||
delete inst;
|
delete inst;
|
||||||
::exit(0);
|
::exit(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user