PX4 Firmware
PX4 Autopilot Software http://px4.io
LidarLite.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2014-2019 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 
35 /**
36  * @file LidarLite.h
37  * @author Johan Jansen <jnsn.johan@gmail.com>
38  *
39  * Generic interface driver for the PulsedLight Lidar-Lite range finders.
40  */
41 
42 #include "LidarLite.h"
43 
44 LidarLite::LidarLite(const uint8_t rotation) :
45  _px4_rangefinder(0 /* device id not yet used */, ORB_PRIO_DEFAULT, rotation)
46 {
49  _px4_rangefinder.set_fov(0.008); // Divergence 8 mRadian
50 }
51 
53 {
58 };
59 
60 void
62 {
67  printf("poll interval: %u \n", get_measure_interval());
68 }
void set_max_distance(const float distance)
static constexpr float LL40LS_MAX_DISTANCE
Definition: LidarLite.h:51
void set_fov(const float fov)
PX4Rangefinder _px4_rangefinder
Definition: LidarLite.h:88
void perf_free(perf_counter_t handle)
Free a counter.
virtual ~LidarLite()
Definition: LidarLite.cpp:52
uint32_t get_measure_interval() const
Definition: LidarLite.h:82
void set_min_distance(const float distance)
perf_counter_t _sensor_zero_resets
Definition: LidarLite.h:95
perf_counter_t _sample_perf
Definition: LidarLite.h:93
perf_counter_t _sensor_resets
Definition: LidarLite.h:94
LidarLite(const uint8_t rotation=distance_sensor_s::ROTATION_DOWNWARD_FACING)
Definition: LidarLite.cpp:44
void perf_print_counter(perf_counter_t handle)
Print one performance counter to stdout.
static constexpr float LL40LS_MIN_DISTANCE
Definition: LidarLite.h:50
perf_counter_t _comms_errors
Definition: LidarLite.h:92
void print_info()
Diagnostics - print some basic information about the driver.
Definition: LidarLite.cpp:61