Skip to content

Commit

Permalink
Add module docs for leddar_one
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee authored and bkueng committed Feb 15, 2019
1 parent 57f1f01 commit f8c0849
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/drivers/distance_sensor/leddar_one/leddar_one.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <px4_workqueue.h>
#include <px4_getopt.h>
#include <px4_defines.h>
#include <px4_module.h>

#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -157,10 +158,33 @@ extern "C" __EXPORT int leddar_one_main(int argc, char *argv[]);

static void help()
{
printf("missing command: try 'start', 'stop' or 'test'\n");
printf("options:\n");
printf(" -d <serial port> to set the serial port were " NAME " is connected\n");
printf(" -r rotation\n");
PRINT_MODULE_DESCRIPTION(
R"DESCR_STR(
### Description
Serial bus driver for the LeddarOne LiDAR.
Most boards are configured to enable/start the driver on a specified UART using the SENS_LEDDAR1_CFG parameter.
Setup/usage information: https://docs.px4.io/en/sensor/leddar_one.html
### Examples
Attempt to start driver on a specified serial device.
$ leddar_one start -d /dev/ttyS1
Stop driver
$ leddar_one stop
)DESCR_STR");

PRINT_MODULE_USAGE_NAME("leddar_one", "driver");
PRINT_MODULE_USAGE_SUBCATEGORY("distance_sensor");
PRINT_MODULE_USAGE_COMMAND_DESCR("start","Start driver");
PRINT_MODULE_USAGE_PARAM_STRING('d', nullptr, nullptr, "Serial device", false);
PRINT_MODULE_USAGE_PARAM_INT('r', 25, 1, 25, "Sensor rotation - downward facing by default", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("stop","Stop driver");
PRINT_MODULE_USAGE_COMMAND_DESCR("test","Test driver (basic functional tests)");
PRINT_MODULE_USAGE_COMMAND_DESCR("info","Print driver information");

}

int leddar_one_main(int argc, char *argv[])
Expand All @@ -183,6 +207,7 @@ int leddar_one_main(int argc, char *argv[])
break;

default:
PX4_WARN("Unknown option!");
help();
return PX4_ERROR;
}
Expand Down Expand Up @@ -234,8 +259,11 @@ int leddar_one_main(int argc, char *argv[])

print_message(report);

} else if (!strcmp(verb, "info")) {
help();
} else {
help();
PX4_ERR("unrecognized command");
return PX4_ERROR;
}

Expand Down

0 comments on commit f8c0849

Please sign in to comment.