MRPT  2.0.1
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
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
void initialize() override
Turns on the KVH DSP 3000 device and configure it for getting orientation data.
void resetIncrementalAngle()
Send to the sensor the command &#39;Z&#39; wich reset the integrated angle.
Contains classes for various device interfaces.
mrpt::obs::CObservationIMU::Ptr m_observationGyro
std::unique_ptr< mrpt::comms::CSerialPort > m_serialPort
Search the port where the sensor is located and connect to it.
This class allows loading and storing values and vectors of different types from a configuration text...
void doProcess() override
This method will be invoked at a minimum rate of "process_rate" (Hz)
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
A class for interfacing KVH DSP 3000 gyroscope with an assynchronous serial communication (product SN...
mrpt::poses::CPose3D m_sensorPose
~CGyroKVHDSP3000() override
Destructor.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
void changeMode(GYRO_MODE _newMode)
int m_COMbauds
This serial port will be attempted to be opened automatically when this class is first used to reques...



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020