INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
gbxsickacfr/driver.h
1/*
2 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3 * http://gearbox.sf.net/
4 * Copyright (c) 2004-2010 Alex Brooks
5 *
6 * This distribution is licensed to you under the terms described in
7 * the LICENSE file included in this distribution.
8 *
9 */
10
11#ifndef GBX_SICK_ACFR_H
12#define GBX_SICK_ACFR_H
13
14#include <gbxsickacfr/serialhandler.h>
15#include <gbxutilacfr/tracer.h>
16#include <gbxutilacfr/status.h>
17#include <memory>
18
19namespace gbxsickacfr {
20
22class Config
23{
24public:
25 Config();
26 bool isValid() const;
27 std::string toString() const;
28 bool operator==( const Config & other );
29 bool operator!=( const Config & other );
30
32 std::string device;
36 double minRange;
38 double maxRange;
42 double startAngle;
45};
46
48class Data
49{
50public:
51 Data()
52 : haveWarnings(false)
53 {}
54
55 float *ranges;
56 unsigned char *intensities;
57 int timeStampSec;
58 int timeStampUsec;
59 bool haveWarnings;
61 std::string warnings;
62};
63
65class Driver
66{
67
68public:
69
75 Driver( const Config &config,
76 gbxutilacfr::Tracer &tracer,
77 gbxutilacfr::Status &status );
78
86 void read( Data &data );
87
88private:
89
90 // Waits up to maxWaitMs for a rxMsg of a particular type.
91 // Returns true iff it got the rxMsg it wanted.
92 bool waitForRxMsgType( uChar type, TimedLmsRxMsg &rxMsg, int maxWaitMs );
93 // Returns: true if ack or nack received.
94 // (and sets receivedAck: true = ACK, false=NACK)
95 bool waitForAckOrNack( bool &receivedAck );
96
97 LmsRxMsgPtr askLaserForStatusData();
98 LmsRxMsgPtr askLaserForConfigData();
99
100 LmsConfigurationData desiredConfiguration();
101 bool isAsDesired( const LmsConfigurationData &lmsConfig );
102
103 int guessLaserBaudRate();
104
105 // Connects to the laser, sets params, and starts continuous mode.
106 void initLaser();
107
108 TimedLmsRxMsg sendAndExpectRxMsg( const std::vector<uChar> &commandAndData,
109 bool ignoreErrorConditions=false );
110
111 std::string errorConditions();
112
113 uChar desiredMeasuredValueUnit();
114 uint16_t desiredAngularResolution();
115
116 void setBaudRate( int baudRate );
117
118 Config config_;
119
120 std::auto_ptr<SerialHandler> serialHandler_;
121
122 std::vector<uChar> commandAndData_;
123 std::vector<uChar> telegramBuffer_;
124
125 gbxutilacfr::Tracer& tracer_;
126 gbxutilacfr::Status& status_;
127};
128
129} // namespace
130
131#endif
Configuration structure.
Definition: gbxsickacfr/driver.h:23
double maxRange
maximum range [m]
Definition: gbxsickacfr/driver.h:38
double minRange
minimum range [m]
Definition: gbxsickacfr/driver.h:36
int baudRate
Baud rate.
Definition: gbxsickacfr/driver.h:34
int numberOfSamples
number of samples in a scan
Definition: gbxsickacfr/driver.h:44
double startAngle
starting angle [rad]
Definition: gbxsickacfr/driver.h:42
double fieldOfView
field of viewe [rad]
Definition: gbxsickacfr/driver.h:40
std::string device
Serial device. e.g. "/dev/ttyS0".
Definition: gbxsickacfr/driver.h:32
Data structure returned by read()
Definition: gbxsickacfr/driver.h:49
std::string warnings
if 'haveWarnings' is set, 'warnings' will contain diagnostic information.
Definition: gbxsickacfr/driver.h:61
SICK driver.
Definition: gbxsickacfr/driver.h:66
Driver(const Config &config, gbxutilacfr::Tracer &tracer, gbxutilacfr::Status &status)
Definition: gbxsickacfr/driver.cpp:116
void read(Data &data)
Definition: gbxsickacfr/driver.cpp:574
Local interface to component status.
Definition: status.h:254
Definition: tracer.h:112
SICK laser driver.
 

Generated for GearBox by  doxygen 1.4.5