Autoware.Auto
xsens_common_node.hpp
Go to the documentation of this file.
1 // Copyright 2018 the Autoware Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
16 
17 
22 
23 #ifndef XSENS_NODES__XSENS_COMMON_NODE_HPP_
24 #define XSENS_NODES__XSENS_COMMON_NODE_HPP_
25 
26 #include <string>
27 #include <vector>
28 #include "common/types.hpp"
29 #include "serial_driver/serial_driver_node.hpp"
31 
33 
34 namespace autoware
35 {
36 namespace drivers
37 {
39 namespace xsens_nodes
40 {
41 
42 using autoware::drivers::serial_driver::flow_control_t;
43 using autoware::drivers::serial_driver::parity_t;
44 using autoware::drivers::serial_driver::stop_bits_t;
45 
46 template<typename TranslatorT, typename MessageT>
47 class XSENS_NODES_PUBLIC XsensCommonNode
48  : public serial_driver::SerialDriverNode<
49  XsensCommonNode<TranslatorT, MessageT>,
50  typename TranslatorT::Packet,
51  MessageT>
52 {
53 public:
63  const std::string & node_name,
64  const std::string & device_name,
65  const typename autoware::drivers::serial_driver::SerialDriverNode<XsensCommonNode<TranslatorT,
66  MessageT>,
67  typename TranslatorT::Packet, MessageT>
68  ::SerialPortConfig & serial_port_config,
69  const std::string & frame_id,
70  const typename TranslatorT::Config & config)
71  : autoware::drivers::serial_driver::SerialDriverNode<XsensCommonNode<TranslatorT, MessageT>,
72  typename TranslatorT::Packet, MessageT>(
73  node_name,
74  "raw",
75  device_name,
76  serial_port_config),
77  m_translator(config),
78  m_frame_id(frame_id)
79  {
80  }
81 
86  const std::string & node_name,
87  const std::string & node_namespace = "")
88 
89 
90  : autoware::drivers::serial_driver::SerialDriverNode<XsensCommonNode<TranslatorT, MessageT>,
91  typename TranslatorT::Packet, MessageT>(
92 
93  node_name, node_namespace),
94  m_translator(
95  {
96  }),
97  m_frame_id(this->declare_parameter("frame_id").template get<std::string>().c_str())
98  {
99  }
100 
101  void init_output(MessageT & output)
102  {
103  (void)output;
104  }
105 
107  const typename TranslatorT::Packet & pkt,
108  MessageT & output)
109  {
110  return m_translator.convert(pkt, output);
111  }
112 
114  {
115  (void)output;
116  return false;
117  }
118 
119 private:
120  TranslatorT m_translator;
121 
122  const std::string m_frame_id;
123 
124  std::vector<MessageT> m_imu;
125 }; // class XsensCommonNode
126 
127 } // namespace xsens_nodes
128 } // namespace drivers
129 } // namespace autoware
130 
131 #endif // XSENS_NODES__XSENS_COMMON_NODE_HPP_
output
Definition: output_type_trait.hpp:32
types.hpp
This file includes common type definition.
visibility_control.hpp
autoware::drivers::xsens_nodes::XsensCommonNode::XsensCommonNode
XsensCommonNode(const std::string &node_name, const std::string &device_name, const typename autoware::drivers::serial_driver::SerialDriverNode< XsensCommonNode< TranslatorT, MessageT >, typename TranslatorT::Packet, MessageT > ::SerialPortConfig &serial_port_config, const std::string &frame_id, const typename TranslatorT::Config &config)
Default constructor, starts driver.
Definition: xsens_common_node.hpp:62
autoware::common::types::bool8_t
bool bool8_t
Definition: types.hpp:39
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::drivers::xsens_nodes::XsensCommonNode::get_output_remainder
bool8_t get_output_remainder(MessageT &output)
Definition: xsens_common_node.hpp:113
autoware::drivers::xsens_nodes::XsensCommonNode::XsensCommonNode
XsensCommonNode(const std::string &node_name, const std::string &node_namespace="")
Parameter file constructor.
Definition: xsens_common_node.hpp:85
autoware::drivers::xsens_nodes::XsensCommonNode::init_output
void init_output(MessageT &output)
Definition: xsens_common_node.hpp:101
autoware::drivers::xsens_nodes::XsensCommonNode
Definition: xsens_common_node.hpp:47
autoware::drivers::xsens_nodes::XsensCommonNode::convert
bool8_t convert(const typename TranslatorT::Packet &pkt, MessageT &output)
Definition: xsens_common_node.hpp:106