Driver worker class for the KVH Geo Fog 3D. More...
#include <kvh_geo_fog_3d_driver.hpp>
Public Member Functions | |
int | AddPacket (packet_id_e) |
int | Cleanup () |
Cleanup and close our connections. More... | |
Driver (bool _debug=false) | |
Initializes connected status, port to use, and if debug printing is turned on. More... | |
template<class T > | |
int | GetPacket (packet_id_e _packetId, T &_packet) |
Retrieves the requested packets that are currently stored. Use PacketIsUpdated and SetPacketUpdated to keep track of if the packets have been updated since last use. More... | |
int | Init (const std::string &_port, KvhPacketRequest &_packetsRequested) |
int | Init (const std::string &_port, KvhPacketRequest &_packetsRequested, KvhInitOptions _initOptions) |
int | Once () |
Do a single data read from the device. More... | |
bool | PacketIsUpdated (packet_id_e) |
Use this function to determine if new packet data has arrived since the last time you checked. More... | |
int | RequestPacket (packet_id_e) |
This function is used to request packets that you only want once or that cannot be requested through the packet periods packet. For example, we wish to access the pulse length from the odom configuration packet, which is only available by requesting in this method. More... | |
int | SetPacketUpdated (packet_id_e, bool) |
Use this function to set that the packet has been updated (though the driver will usually do that itself), or use it to notify the driver that you have used the most recent packet. More... | |
~Driver () | |
Destructor. Will automatically cleanup the driver. More... | |
Private Member Functions | |
int | DecodePacket (an_packet_t *) |
int | DecodeUtmFix (utm_fix *, an_packet_t *) |
The current api given by kvh incorrectly deals with this packet so we needed to write our own decoder to capture all of the data. The utm_fix struct type is extended from utm_packet to include the missing zone information. More... | |
int | SendPacket (an_packet_t *) |
Wrapper function for more easily sending an packets via serial port. More... | |
Private Attributes | |
an_decoder_t | anDecoder_ |
Decoder for decoding incoming AN encoded packets. More... | |
bool | connected_ |
True if we're connected to the localization unit. More... | |
bool | debug_ {false} |
Set true to print debug statements. More... | |
KvhInitOptions | defaultOptions_ |
If no init options are passed in, use this as the default. More... | |
KvhDeviceConfig | deviceConfig_ |
Class responsible for configuring kvh geo fog. More... | |
const uint32_t | PACKET_PERIOD {50} |
equal packet frequency. See manual for equation on how Packet Period affects packet rate. More... | |
std::vector< packet_id_e > | packetRequests_ |
KvhPacketStorage | packetStorage_ |
Class responsible for handling packets and ensuring consistency. More... | |
std::string | port_ |
Port to connect to the kvh through. Ex. "/dev/ttyUSB0". More... | |
Driver worker class for the KVH Geo Fog 3D.
Add functions for changing output packets and packet rate
Make packet output rate variable
Definition at line 83 of file kvh_geo_fog_3d_driver.hpp.
|
explicit |
Initializes connected status, port to use, and if debug printing is turned on.
_debug | [in] Determines if debug statements are printed. |
Definition at line 61 of file driver_main.cpp.
kvh::Driver::~Driver | ( | ) |
Destructor. Will automatically cleanup the driver.
Definition at line 71 of file driver_main.cpp.
int kvh::Driver::AddPacket | ( | packet_id_e | _packetId | ) |
_packetId | The id of the packet to set the status of |
Definition at line 358 of file driver_main.cpp.
int kvh::Driver::Cleanup | ( | ) |
Cleanup and close our connections.
Definition at line 394 of file driver_main.cpp.
|
private |
_anPacket | [in] The packet to decode into a Kvh packet type |
replace if(debug) statements with logging
Should decode packets be moved out of driver?
Definition at line 79 of file decode_packets.cpp.
|
private |
The current api given by kvh incorrectly deals with this packet so we needed to write our own decoder to capture all of the data. The utm_fix struct type is extended from utm_packet to include the missing zone information.
_utmPacket | [out] Our corrected utm packet |
_anPacket | [in] The an packet to decode |
Definition at line 54 of file decode_packets.cpp.
|
inline |
Retrieves the requested packets that are currently stored. Use PacketIsUpdated and SetPacketUpdated to keep track of if the packets have been updated since last use.
[in] | _packetId | The id of the packet you wish to retrieve |
[out] | _packet | The retrieved packet data |
Definition at line 190 of file kvh_geo_fog_3d_driver.hpp.
int kvh::Driver::Init | ( | const std::string & | _port, |
KvhPacketRequest & | _packetsRequested | ||
) |
Definition at line 115 of file driver_main.cpp.
int kvh::Driver::Init | ( | const std::string & | _port, |
KvhPacketRequest & | _packetsRequested, | ||
KvhInitOptions | _initOptions | ||
) |
Definition at line 138 of file driver_main.cpp.
int kvh::Driver::Once | ( | ) |
Do a single data read from the device.
Single data packet read.
Definition at line 276 of file driver_main.cpp.
bool kvh::Driver::PacketIsUpdated | ( | packet_id_e | _packetId | ) |
Use this function to determine if new packet data has arrived since the last time you checked.
_packetId | The id of the packet you are checking |
Definition at line 334 of file driver_main.cpp.
int kvh::Driver::RequestPacket | ( | packet_id_e | _requestedPacket | ) |
This function is used to request packets that you only want once or that cannot be requested through the packet periods packet. For example, we wish to access the pulse length from the odom configuration packet, which is only available by requesting in this method.
_requestedPacket | The id of the packet you want to request |
Definition at line 376 of file driver_main.cpp.
|
private |
Wrapper function for more easily sending an packets via serial port.
_anPacket | [in] The an packet to transmit |
Definition at line 86 of file driver_main.cpp.
int kvh::Driver::SetPacketUpdated | ( | packet_id_e | _packetId, |
bool | _updateStatus | ||
) |
Use this function to set that the packet has been updated (though the driver will usually do that itself), or use it to notify the driver that you have used the most recent packet.
_packetId | The id of the packet you want to set the status of |
_updateStatus | The value you want to set the packet to. |
Definition at line 348 of file driver_main.cpp.
|
private |
Decoder for decoding incoming AN encoded packets.
Definition at line 90 of file kvh_geo_fog_3d_driver.hpp.
|
private |
True if we're connected to the localization unit.
Definition at line 86 of file kvh_geo_fog_3d_driver.hpp.
|
private |
Set true to print debug statements.
Definition at line 91 of file kvh_geo_fog_3d_driver.hpp.
|
private |
If no init options are passed in, use this as the default.
Definition at line 95 of file kvh_geo_fog_3d_driver.hpp.
|
private |
Class responsible for configuring kvh geo fog.
Definition at line 97 of file kvh_geo_fog_3d_driver.hpp.
|
private |
equal packet frequency. See manual for equation on how Packet Period affects packet rate.
Setting for determining packet rate. Note: Does not
Definition at line 88 of file kvh_geo_fog_3d_driver.hpp.
|
private |
Keeps a list of packet requests we have sent that we should recieve achknowledgement packets for. Add to list in SendPacket, remove in Once (this may cause a time delay problem where the packet is already gone by the time this function is called)
Definition at line 92 of file kvh_geo_fog_3d_driver.hpp.
|
private |
Class responsible for handling packets and ensuring consistency.
Definition at line 96 of file kvh_geo_fog_3d_driver.hpp.
|
private |
Port to connect to the kvh through. Ex. "/dev/ttyUSB0".
Definition at line 87 of file kvh_geo_fog_3d_driver.hpp.