39 #include <px4_platform_common/px4_config.h>    41 #include <sys/types.h>    49 #include <px4_platform_common/getopt.h>    62 #include <board_config.h>    64 #include <bebop_rangefinder/BebopRangeFinder.hpp>    95     int _publish(
struct bebop_range &
data);
   106     BebopRangeFinder(BEBOP_RANGEFINDER_DEVICE_PATH),
   107     _range_topic(nullptr),
   108     _orb_class_instance(-1)
   118         PX4_ERR(
"BebopRangeFinder init fail: %d", ret);
   125         PX4_ERR(
"BebopRangeFinder start fail: %d", ret);
   138         PX4_ERR(
"BebopRangeFinder stop fail: %d", ret);
   152     distance_data.
min_distance = float(BEBOP_RANGEFINDER_MIN_DISTANCE_M); 
   153     distance_data.
max_distance = float(BEBOP_RANGEFINDER_MAX_DISTANCE_M); 
   157     distance_data.
type = distance_sensor_s::MAV_DISTANCE_SENSOR_ULTRASOUND;
   159     distance_data.
id = 0; 
   161     distance_data.
orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
   193     if (g_dev == 
nullptr) {
   194         PX4_ERR(
"failed instantiating DfBebopRangeFinderWrapper object");
   198     int ret = g_dev->
start();
   201         PX4_ERR(
"DfBebopRangeFinderWrapper start failed");
   207     DevMgr::getHandle(BEBOP_RANGEFINDER_DEVICE_PATH, h);
   210         DF_LOG_INFO(
"Error: unable to obtain a valid handle for the receiver at: %s (%d)",
   211                 BEBOP_RANGEFINDER_DEVICE_PATH, h.getError());
   215     DevMgr::releaseHandle(h);
   222     if (g_dev == 
nullptr) {
   223         PX4_ERR(
"driver not running");
   227     int ret = g_dev->
stop();
   230         PX4_ERR(
"driver could not be stopped");
   245     if (g_dev == 
nullptr) {
   246         PX4_ERR(
"driver not running");
   250     PX4_DEBUG(
"state @ %p", g_dev);
   258     PX4_WARN(
"Usage: df_bebop_rangefinder_wrapper 'start', 'info', 'stop'");
   270     const char *myoptarg = NULL;
   273     while ((ch = px4_getopt(argc, argv, 
"R:", &myoptind, &myoptarg)) != EOF) {
   287     const char *verb = argv[myoptind];
   290     if (!strcmp(verb, 
"start")) {
   294     else if (!strcmp(verb, 
"stop")) {
   298     else if (!strcmp(verb, 
"info")) {
 
int start()
Start automatic measurement. 
 
API for the uORB lightweight object broker. 
 
DfBebopRangeFinderWrapper * g_dev
 
void usage(const char *reason)
Print the correct usage. 
 
High-resolution timer with callouts and timekeeping. 
 
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic. 
 
void init()
Activates/configures the hardware registers. 
 
Simple error/warning functions, heavily inspired by the BSD functions of the same names...
 
int info()
Print a little info about the driver. 
 
int start()
Attempt to start driver on all available I2C busses. 
 
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle. 
 
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
 
void usage()
Prints info about the driver argument usage. 
 
int _publish(struct bebop_range &data)
 
int stop()
Stop automatic measurement. 
 
orb_advert_t _range_topic
 
__EXPORT int df_bebop_rangefinder_wrapper_main(int argc, char *argv[])
 
DfBebopRangeFinderWrapper()
 
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance, int priority)
 
int stop()
Stop the driver. 
 
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap). 
 
Performance measuring tools.