MRPT  2.0.3
CGyroKVHDSP3000.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/comms/CSerialPort.h>
14 
16 #include <mrpt/poses/CPose3D.h>
17 
18 namespace mrpt::hwdrivers
19 {
21 {
25 };
26 /** A class for interfacing KVH DSP 3000 gyroscope with an assynchronous serial
27  *communication (product SN : 02-1222-01).
28  * It uses a serial port connection to the device. The class implements the
29  *generic sensor class.
30  * See also the application "rawlog-grabber" for a ready-to-use application to
31  *gather data from the scanner.
32  * The generated observation is a CObservationIMU, but only the yaw angular
33  *velocity and the absolute yaw position are
34  * are set in the vector CObservationIMU::rawMeasurements.
35  * The sensor process rate is imposed by hardware at 100Hz.
36  * For now, this sensor is only supported on posix system.
37  * \code
38  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
39  * -------------------------------------------------------
40  * [supplied_section_name]
41  * process_rate = 100 ; MUST be 100 Hz.
42  * pose_x=0 ; Sensor 3D position relative to the robot (meters)
43  * pose_y=0
44  * pose_z=0
45  * pose_yaw=0 ; Angles in degrees
46  * pose_pitch=0
47  * pose_roll=0
48  * sensorLabel = <label> ; Label of the sensor
49  * COM_port_LIN = /dev/ttyUSB0 ; COM PORT in LINUX
50  * operatingMode = <"rate"/"integrated", "incremental"> ; Default mode is
51  *Rate.
52  * \endcode
53  * In most of the communs applications, this class will be used as :
54  * \code
55  * CGyroKVHDSP3000 kvh;
56  * /// ...
57  * CConfigFile conf("conf.ini");
58  * /// ...
59  * kvh.loadConfig_sensorSpecific(conf, "KVH");
60  * /// ...
61  * while(1) {
62  * kvh.doProcess();
63  * TListObservations rateObs;
64  * kvh.getObservations(rateObs);
65  * // ....
66  * \endcode
67  * \ingroup mrpt_hwdrivers_grp
68  */
70 {
72  protected:
73  /** This serial port will be attempted to be opened automatically when this
74  * class is first used to request data from the device.
75  * \sa comms::CSerialPort
76  */
77  int m_COMbauds{38400};
78  std::string m_com_port;
79 
81 
82  /** Search the port where the sensor is located and connect to it
83  */
84  // bool searchPortAndConnect();
85 
86  /** The serial port connection */
87  std::unique_ptr<mrpt::comms::CSerialPort> m_serialPort;
89  bool m_firstInteration{true};
90 
92 
93  public:
94  /** Constructor
95  */
97 
98  /** See the class documentation at the top for expected parameters */
100  const mrpt::config::CConfigFileBase& configSource,
101  const std::string& iniSection) override;
102 
103  /** Destructor
104  */
105  ~CGyroKVHDSP3000() override;
106 
107  /** This method will be invoked at a minimum rate of "process_rate" (Hz)
108  * \exception This method must throw an exception with a descriptive
109  * message if some critical error is found.
110  */
111  void doProcess() override;
112 
113  /** Turns on the KVH DSP 3000 device and configure it for getting
114  * orientation data. you must have called loadConfig_sensorSpecific before
115  * calling this function.
116  */
117  void initialize() override;
118  /** Send to the sensor the command 'Z' wich reset the integrated angle. (in
119  * both rate mode and incremental, this function has no effect) */
120  void resetIncrementalAngle();
121  void changeMode(GYRO_MODE _newMode);
122 
123 }; // end of class
124 
125 } // namespace mrpt::hwdrivers
mrpt::hwdrivers::INCREMENTAL_ANGLE
@ INCREMENTAL_ANGLE
Definition: CGyroKVHDSP3000.h:23
mrpt::hwdrivers::CGyroKVHDSP3000::m_sensorPose
mrpt::poses::CPose3D m_sensorPose
Definition: CGyroKVHDSP3000.h:80
CSerialPort.h
mrpt::hwdrivers::INTEGRATED_ANGLE
@ INTEGRATED_ANGLE
Definition: CGyroKVHDSP3000.h:24
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:19
mrpt::hwdrivers::CGyroKVHDSP3000::m_COMbauds
int m_COMbauds
This serial port will be attempted to be opened automatically when this class is first used to reques...
Definition: CGyroKVHDSP3000.h:77
DEFINE_GENERIC_SENSOR
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
Definition: CGenericSensor.h:302
mrpt::hwdrivers::CGyroKVHDSP3000::doProcess
void doProcess() override
This method will be invoked at a minimum rate of "process_rate" (Hz)
Definition: CGyroKVHDSP3000.cpp:40
mrpt::hwdrivers::CGyroKVHDSP3000::~CGyroKVHDSP3000
~CGyroKVHDSP3000() override
Destructor.
Definition: CGyroKVHDSP3000.cpp:35
mrpt::hwdrivers::CGyroKVHDSP3000::m_mode
GYRO_MODE m_mode
Definition: CGyroKVHDSP3000.h:88
mrpt::obs::CObservationIMU::Ptr
std::shared_ptr< mrpt::obs ::CObservationIMU > Ptr
Definition: CObservationIMU.h:113
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::hwdrivers::CGyroKVHDSP3000::loadConfig_sensorSpecific
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
Definition: CGyroKVHDSP3000.cpp:109
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
CGenericSensor.h
mrpt::hwdrivers::RATE
@ RATE
Definition: CGyroKVHDSP3000.h:22
mrpt::hwdrivers::CGyroKVHDSP3000::CGyroKVHDSP3000
CGyroKVHDSP3000()
Constructor.
Definition: CGyroKVHDSP3000.cpp:28
mrpt::hwdrivers::CGyroKVHDSP3000::m_com_port
std::string m_com_port
Definition: CGyroKVHDSP3000.h:78
mrpt::hwdrivers::CGyroKVHDSP3000::changeMode
void changeMode(GYRO_MODE _newMode)
Definition: CGyroKVHDSP3000.cpp:142
mrpt::hwdrivers::CGenericSensor
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
Definition: CGenericSensor.h:70
mrpt::hwdrivers::CGyroKVHDSP3000::resetIncrementalAngle
void resetIncrementalAngle()
Send to the sensor the command 'Z' wich reset the integrated angle.
Definition: CGyroKVHDSP3000.cpp:168
CObservationIMU.h
CPose3D.h
mrpt::hwdrivers::GYRO_MODE
GYRO_MODE
Definition: CGyroKVHDSP3000.h:20
mrpt::hwdrivers::CGyroKVHDSP3000::m_firstInteration
bool m_firstInteration
Definition: CGyroKVHDSP3000.h:89
mrpt::hwdrivers::CGyroKVHDSP3000::m_serialPort
std::unique_ptr< mrpt::comms::CSerialPort > m_serialPort
Search the port where the sensor is located and connect to it.
Definition: CGyroKVHDSP3000.h:87
mrpt::hwdrivers::CGyroKVHDSP3000
A class for interfacing KVH DSP 3000 gyroscope with an assynchronous serial communication (product SN...
Definition: CGyroKVHDSP3000.h:69
mrpt::hwdrivers::CGyroKVHDSP3000::initialize
void initialize() override
Turns on the KVH DSP 3000 device and configure it for getting orientation data.
Definition: CGyroKVHDSP3000.cpp:88
mrpt::hwdrivers::CGyroKVHDSP3000::m_observationGyro
mrpt::obs::CObservationIMU::Ptr m_observationGyro
Definition: CGyroKVHDSP3000.h:91



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Thu May 21 21:53:32 UTC 2020