raw_data_pa.h
Go to the documentation of this file.
1 //==============================================================================
2 // Copyright (c) 2019, Peter Weissig, TU Chemnitz
3 // 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 are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Flight Systems and Automatic Control group,
13 // TU Darmstadt, nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND
19 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
22 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //==============================================================================
29 
30 // This file is an addon from TUC-ProAut (https://github.com/TUC-ProAut/).
31 // It was created to log all data from the ublox to a logfile and to publish
32 // the data as ros messages. This is used by our group to also evaluate the
33 // measured data with the rtklib.
34 
35 
36 #ifndef UBLOX_RAW_DATA_PA_H
37 #define UBLOX_RAW_DATA_PA_H
38 
39 // STL
40 #include <vector>
41 #include <set>
42 #include <fstream>
43 
44 // ROS includes
45 #include <ros/ros.h>
46 
47 // ROS messages
48 #include <std_msgs/UInt8MultiArray.h>
49 
55 namespace ublox_node {
56 
61  public:
62 
63 
68  RawDataStreamPa(bool is_ros_subscriber = false);
69 
73  void getRosParams(void);
74 
78  bool isEnabled(void);
79 
87  void initialize(void);
88 
94  void ubloxCallback(const unsigned char* data,
95  const std::size_t size);
96 
101  void msgCallback(const std_msgs::UInt8MultiArray::ConstPtr& msg);
102 
103  private:
107  std_msgs::UInt8MultiArray str2uint8(const std::string str);
108 
113  void publishMsg(const std::string str);
114 
119  void saveToFile(const std::string str);
120 
122  std::string file_dir_;
124  std::string file_name_;
126  std::ofstream file_handle_;
127 
130 
135 
140 };
141 
142 }
143 
144 #endif
msg
Implements functions for raw data stream.
Definition: raw_data_pa.h:60
void ubloxCallback(const unsigned char *data, const std::size_t size)
Callback function which handles raw data.
void saveToFile(const std::string str)
Stores data to given file.
std::string file_dir_
Directoy name for storing raw data.
Definition: raw_data_pa.h:122
bool flag_publish_
Flag for publishing raw data.
Definition: raw_data_pa.h:129
std_msgs::UInt8MultiArray str2uint8(const std::string str)
Converts a string into an uint8 multibyte array.
data
ros::NodeHandle nh_
ROS node handle (only for subscriber)
Definition: raw_data_pa.h:139
void initialize(void)
Initializes raw data streams If storing to file is enabled, the filename is created and the correspon...
Definition: raw_data_pa.cpp:77
std::ofstream file_handle_
Handle for file access.
Definition: raw_data_pa.h:126
ros::NodeHandle pnh_
ROS private node handle (for params and publisher)
Definition: raw_data_pa.h:137
RawDataStreamPa(bool is_ros_subscriber=false)
Constructor. Initialises variables and the nodehandle.
Definition: raw_data_pa.cpp:50
void publishMsg(const std::string str)
Publishes data stream as ros message.
std::string file_name_
Filename for storing raw data.
Definition: raw_data_pa.h:124
void msgCallback(const std_msgs::UInt8MultiArray::ConstPtr &msg)
Callback function which handles raw data.
bool isEnabled(void)
Returns the if raw data streaming is enabled.
Definition: raw_data_pa.cpp:67
void getRosParams(void)
Get the raw data stream parameters.
Definition: raw_data_pa.cpp:57


ublox_gps
Author(s): Johannes Meyer
autogenerated on Thu Jan 28 2021 03:13:52