rt_usb_9axisimu_driver.hpp
Go to the documentation of this file.
1 /*
2  * rt_usb_9axisimu_driver.hpp
3  *
4  * License: BSD-3-Clause
5  *
6  * Copyright (c) 2015-2020 RT Corporation <support@rt-net.jp>
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of RT Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef RT_USB_9AXISIMU_BINARY_MODE_H_
35 #define RT_USB_9AXISIMU_BINARY_MODE_H_
36 
37 #include "ros/ros.h"
39 
41 {
42 private:
44 
48 
50 
51  std::string frame_id_;
56 
58  {
59  NONE = 0,
65  };
69 
70  // Method to combine two separate one-byte data into one two-byte data
71  int16_t combineByteData(unsigned char data_h, unsigned char data_l);
72  // Method to extract binary sensor data from communication buffer
74  bool isBinarySensorData(unsigned char* imu_data_buf);
75  bool readBinaryData(void);
76  bool isValidAsciiSensorData(std::vector<std::string> imu_data_vector_buf);
77  bool readAsciiData(void);
78 
79 public:
80  RtUsb9axisimuRosDriver(std::string serialport);
82 
83  void setImuFrameIdName(std::string frame_id);
84  void setImuPortName(std::string serialport);
85  void setImuStdDev(double linear_acceleration, double angular_velocity, double magnetic_field);
86 
87  bool startCommunication();
88  void stopCommunication(void);
89  void checkDataFormat(void);
90  bool hasCompletedFormatCheck(void);
91  bool hasAsciiDataFormat(void);
92  bool hasBinaryDataFormat(void);
93  bool hasRefreshedImuData(void);
94 
95  bool publishImuData();
96  bool readSensorData();
97 };
98 
99 #endif
void setImuPortName(std::string serialport)
rt_usb_9axisimu::Consts consts
rt_usb_9axisimu::ImuData< int16_t > extractBinarySensorData(unsigned char *imu_data_buf)
void setImuStdDev(double linear_acceleration, double angular_velocity, double magnetic_field)
bool isBinarySensorData(unsigned char *imu_data_buf)
int16_t combineByteData(unsigned char data_h, unsigned char data_l)
rt_usb_9axisimu::SensorData sensor_data_
RtUsb9axisimuRosDriver(std::string serialport)
bool isValidAsciiSensorData(std::vector< std::string > imu_data_vector_buf)
void setImuFrameIdName(std::string frame_id)


rt_usb_9axisimu_driver
Author(s): RT Corporation
autogenerated on Fri May 14 2021 02:35:44