kvh_geo_fog_3d_driver.hpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (Apache 2.0)
3  *
4  * Copyright (c) 2019, The MITRE Corporation.
5  * All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * https://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * Sections of this project contains content developed by The MITRE Corporation.
20  * If this code is used in a deployment or embedded within another project,
21  * it is requested that you send an email to opensource@mitre.org in order to
22  * let us know where this software is being used.
23  *********************************************************************/
24 
32 #pragma once
33 
34 // STD
35 #include <vector>
36 #include <set>
37 #include <map>
38 #include <memory>
39 #include <functional>
40 #include <iostream>
41 
42 // GEO-FOG SDK
43 #include "rs232.h"
44 #include "an_packet_protocol.h"
45 #include "spatial_packets.h"
46 
47 // Kvh Driver Components
51 
52 namespace kvh
53 {
59  {
60  bool gnssEnabled{true};
61  int baudRate{115200};
62  std::string port{"/tty/USB0"};
63  bool debugOn{false};
69  double odomPulseToMeters{0.000583};
70  double trackWidth{1.63576};
71  double odometerVelocityCovariance{0.00001};
72  bool encoderOnLeft{true};
73  };
74 
83  class Driver
84  {
85  private:
86  bool connected_;
87  std::string port_;
88  const uint32_t PACKET_PERIOD{50};
89  an_decoder_t anDecoder_;
91  bool debug_{false};
92  std::vector<packet_id_e> packetRequests_;
93  KvhInitOptions defaultOptions_;
98 
99  // Private functions, see implementation for detailed comments
100  int DecodePacket(an_packet_t *);
101  int DecodeUtmFix(utm_fix *, an_packet_t *); // Special decode since their utm api is incorrect
102  int SendPacket(an_packet_t *);
103 
104  public:
105  explicit Driver(bool _debug = false);
106  ~Driver();
107 
116  int Init(const std::string &_port, KvhPacketRequest &_packetsRequested);
117 
129  int Init(const std::string &_port, KvhPacketRequest &_packetsRequested, KvhInitOptions _initOptions);
130 
146  int Once();
147 
158  bool PacketIsUpdated(packet_id_e);
159 
165  int SetPacketUpdated(packet_id_e, bool);
166 
172  int AddPacket(packet_id_e);
173 
189  template <class T>
190  int GetPacket(packet_id_e _packetId, T &_packet)
191  {
192  return packetStorage_.GetPacket(_packetId, _packet);
193  }
194 
201  int RequestPacket(packet_id_e);
202 
210  int Cleanup();
211 
212  }; //end: class Driver
213 
214 } // namespace kvh
std::string port_
Port to connect to the kvh through. Ex. "/dev/ttyUSB0".
Driver worker class for the KVH Geo Fog 3D.
global variables used to store packet information.
Helper functions for configuring the hardware.
bool connected_
True if we&#39;re connected to the localization unit.
packet_id_e
KVH Packet storing class header.
std::vector< packet_id_e > packetRequests_
int GetPacket(packet_id_e _packetId, T &_packet)
Retrieves the requested packets that are currently stored. Use PacketIsUpdated and SetPacketUpdated t...
std::vector< std::pair< packet_id_e, uint16_t > > KvhPacketRequest
int GetPacket(packet_id_e _packetId, T &_packet)
KvhPacketStorage packetStorage_
Class responsible for handling packets and ensuring consistency.
KvhDeviceConfig deviceConfig_
Class responsible for configuring kvh geo fog.


kvh_geo_fog_3d_driver
Author(s): Trevor Bostic , Zach LaCelle
autogenerated on Mon Feb 28 2022 22:39:53