Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omst/seatrac #246

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ec22971
Transports/Seatrac: Fixed small typos.
Mar 4, 2023
66ea7e8
Transports/Seatrac: Pedantic changes.
Mar 7, 2023
b606254
Transports/Seatrac: Moved modem configuration to dedicated method and…
Mar 8, 2023
cdf9ee9
Transports/Seatrac: Use NodeMap class.
Mar 8, 2023
e1d52c1
Transports/Seatrac: Making honour medium options more streamlined.
Mar 8, 2023
fff9c79
Transports/Seatrac: Extract driver.
Mar 9, 2023
9287b48
Transports/Seatrac: Changed acknowledge time multiplier parameter to …
Mar 9, 2023
7d93764
Transports/Seatrac: Clarified 'Max Range' parameter description.
Mar 9, 2023
858ef71
Transports/Seatrac: Added missing MagneticField bind and other small …
Mar 10, 2023
4619ad9
Transports/Seatrac: When modem is busy queue message to send, thus pi…
Mar 20, 2023
5562929
Transports/Seatrac: Reinstated 'Transmit Only Underwater' parameter (…
Mar 21, 2023
2842798
Transports/Seatrac: Renamed DataTypes.hpp as Constants.hpp and slight…
Mar 21, 2023
b6cbe91
Transports/Seatrac: Entity state will only be idle if communications …
Mar 22, 2023
0704323
Config: etc/hardware: Updated default seatrac configurations for lctr…
May 26, 2023
7bfa81e
Transports/Seatrac: Updated copyright.
Mar 27, 2023
1020516
Transports/Seatrac: Added parameter to set transponder's turn around …
Mar 28, 2023
95e65af
Transports/Seatrac: SoundSpeed is now manually set on transponder (us…
Mar 28, 2023
716ca6d
Transports/Seatrac: Only save new hard-iron calibration parameters to…
Mar 29, 2023
59ebaae
Transports/Seatrac: Fixed verification of velocity of sound setting.
Mar 29, 2023
f78269a
Transports/Seatrac: Improved handling of communication errors.
Mar 29, 2023
5748400
Transports/Seatrac: Use attitude from system in transponder if 'AHRS …
Apr 5, 2023
792f14a
Transports/Seatrac: Removed 'Log AHRS Data' parameter and changed sco…
Apr 5, 2023
178e3fa
Transports/Seatrac: Incresead attitude sending rate.
Apr 6, 2023
e5780b1
Transports/Seatrac: Calculate relative position of the other modem wh…
zepinto Apr 10, 2023
403a5f3
Transports/Seatrac: Fixed typo.
Apr 10, 2023
744e7de
Transports/Seatrac: Reformatted code.
zepinto Apr 10, 2023
681ce5a
Transports/Seatrac: Frequency at which attitude is manually set is no…
Apr 10, 2023
67aeb38
Transports/Seatrac: Added parameter to define threshold to discard po…
Apr 10, 2023
0585ec9
Transports/Seatrac: Avoid repeated error output messages when modem n…
Apr 11, 2023
8b10f88
Transports/Seatrac: Accuracy field on UsblPosition and UsblAngles mes…
Apr 11, 2023
402d2a2
Transports/Seatrac: Fix usage of 'Active' parameter - if disabled mod…
Apr 19, 2023
47d58be
Transports/Seatrac: Improve handling communication error on boot.
Apr 20, 2023
8ccf471
Revert "Transports/Seatrac: Calculate relative position of the other …
Apr 20, 2023
83f9896
Transports/Seatrac: Complete revert of local relative position calcul…
Apr 20, 2023
9ff0beb
DUNE/Network: added utility class NodeMap (import from OMST).
rasmartins Jan 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions etc/hardware/acoustic-modems/seatrac_uart.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Serial Port - Device = /dev/uart/1
Pressure Sensor Mode = true
Address Section = Seatrac Addresses
Debug Level = Debug
Honour Medium = false
Pressure Sensor Mode = true
Use Internal Pressure Sensor as Medium = true

[UserInterfaces.MantaPanel]
Sections of System Addresses = Seatrac Addresses
Expand Down
10 changes: 7 additions & 3 deletions etc/hardware/lctr-a6xx/seatrac.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,26 @@
[Transports.Seatrac]
Enabled = Hardware
Debug Level = None
Active = true # keep always active for LAUVs
Entity Label = Acoustic Modem
Serial Port - Device = /dev/uart/10
Serial Port - Baud Rate = 115200
Activation Time = 3.5
Activation Time = 5
Deactivation Time = 0
Transmit Only Underwater = true
Address Section = Seatrac Addresses
Honour Medium = true
Max Range = 1000
AHRS Mode = false
Turn Around Time = 10
Pressure Sensor Mode = true
Use Internal Pressure Sensor for Medium = true
Use Internal Pressure Sensor as Medium = false
USBL Mode = true
Enhanced USBL = true
# If modem not installed upright either invert output with Blueprint's Seatrac Tools or rotate matrix 180º around Y-Axis (refer to "Beacon User Manual" section 6.5)
AHRS Rotation Matrix = 1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
Calibration Threshold = 0.005
Hard-Iron Calibration = 0.0, 0.0, 0.0

[Transports.UAN]
Expand Down
1 change: 1 addition & 0 deletions src/DUNE/Network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ namespace DUNE
#include <DUNE/Network/Interface.hpp>
#include <DUNE/Network/TDMA.hpp>
#include <DUNE/Network/UpstreamTCPServer.hpp>
#include <DUNE/Network/NodeMap.hpp>

#endif
112 changes: 112 additions & 0 deletions src/DUNE/Network/NodeMap.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
//***************************************************************************
// Copyright 2017 OceanScan - Marine Systems & Technology, Lda. *
//***************************************************************************
// This file is subject to the terms and conditions defined in file *
// 'LICENCE.md', which is part of this source code package. *
//***************************************************************************
// Author: Ricardo Martins *
//***************************************************************************

#ifndef DUNE_NETWORK_NODE_MAP_HPP_INCLUDED_
#define DUNE_NETWORK_NODE_MAP_HPP_INCLUDED_

// ISO C++ 98 headers.
#include <map>
#include <string>

// DUNE headers.
#include <DUNE/Parsers/Config.hpp>

namespace DUNE
{
namespace Network
{
//! Utility class that enables mapping node names to addresses and
//! vice versa.
template <typename T>
class NodeMap
{
public:
//! Initialize node map from configuration section.
//!
//! @param[in] config config parser instance.
//! @param[in] section config section name.
void
readConfigSection(Parsers::Config& config, const std::string& section)
{
clear();

std::vector<std::string> addrs = config.options(section);
for (unsigned i = 0; i < addrs.size(); ++i)
{
T addr;
config.get(section, addrs[i], "", addr);
add(addrs[i], addr);
}
}

//! Add a node to the map.
//!
//! @param[in] name canonical node name.
//! @param[in] address node address.
void
add(const std::string& name, const T& address)
{
m_node_names[name] = address;
m_node_addresses[address] = name;
}

//! Remove all elements from the map.
void
clear()
{
m_node_names.clear();
m_node_addresses.clear();
}

//! Lookup a node's address given its name.
//!
//! @param[in] name canonical node name.
//! @param[out] address node address.
//!
//! @return true if the canonical node name has a corresponding
//! address, false otherwise.
bool
lookupAddress(const std::string& name, T& address) const
{
typename std::map<std::string, T>::const_iterator itr = m_node_names.find(name);
if (itr == m_node_names.end())
return false;

address = itr->second;
return true;
}

//! Lookup a node's name given its address.
//!
//! @param[in] address node address.
//! @param[out] name canonical node name.
//!
//! @return true if the node address has a corresponding
//! canonical name, false otherwise.
bool
lookupName(const T& address, std::string& name) const
{
typename std::map<T, std::string>::const_iterator itr = m_node_addresses.find(address);
if (itr == m_node_addresses.end())
return false;

name = itr->second;
return true;
}

private:
//! Map node names to addresses.
std::map<std::string, T> m_node_names;
//! Map node addresses to names.
std::map<T, std::string> m_node_addresses;
};
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Copyright 2007-2023 Universidade do Porto - Faculdade de Engenharia *
// Laboratório de Sistemas e Tecnologia Subaquática (LSTS) *
//***************************************************************************
// Copyright 2023 OceanScan - Marine Systems & Technology, Lda. *
//***************************************************************************
// This file is part of DUNE: Unified Navigation Environment. *
// *
// Commercial Licence Usage *
Expand All @@ -26,10 +28,11 @@
//***************************************************************************
// Author: João Teixeira *
// Author: Raúl Sáez *
// Author: Maria Costa (small refactor and fix for iUSBL implementation) *
//***************************************************************************

#ifndef TRANSPORTS_SEATRAC_DATA_TYPES_HPP_INCLUDED_
#define TRANSPORTS_SEATRAC_DATA_TYPES_HPP_INCLUDED_
#ifndef TRANSPORTS_SEATRAC_CONSTANTS_HPP_INCLUDED_
#define TRANSPORTS_SEATRAC_CONSTANTS_HPP_INCLUDED_

#define MESSAGE_NUMBER (0x77 +0x1)
#define MAX_MESSAGE_ERRORS 5
Expand All @@ -39,20 +42,46 @@
//! Defines the minimum message length without preamble nor postamble
#define MIN_MESSAGE_LENGTH 6

// ISO C++ 98 headers.
#include <string>
#include <vector>

// DUNE headers.
#include <DUNE/DUNE.hpp>

namespace Transports
{
namespace Seatrac
{
using DUNE_NAMESPACES;

//! Hard Iron calibration parameter name.
static const std::string c_hard_iron_param = "Hard-Iron Calibration";
//! Number of axis.
static const uint8_t c_number_axis = 3;
//! Acknowledged timeout time multiplier
static const uint8_t c_ack_timeout_multiplier = 6;
//! Input Timeout (s).
static const double c_input_tout = 5;
static const double c_input_tout = 5;
//! The bitrate of acoustic communication (bits/second).
static const double c_acoustic_bitrate = 100;
static const double c_acoustic_bitrate = 100;
//! Message preamble
static const char c_preamble = '$';
//! Maximum buffer size.
static const int c_bfr_size = 256;
//! Sound speed update window (m/s).
static const uint16_t c_sspeed_window = 1;

//! Entity states.
enum EntityStates
{
STA_BOOT,
STA_IDLE,
STA_ACTIVE,
STA_ERR_COM,
STA_ERR_STP,
STA_MAX
};

//! States of the internal SM.
enum ParserStates
Expand Down Expand Up @@ -137,7 +166,6 @@ namespace Transports
BT_X150 = 0x31B
};


// Status Output Mode
enum StatusMode_E
{
Expand Down Expand Up @@ -174,7 +202,8 @@ namespace Transports
};

// Control XCVR flags
enum ControlXcvrFlags_E {
enum ControlXcvrFlags_E
{
USBL_USE_AHRS_FLAG = 0x1,
XCVR_POSFLT_ENABLE_FLAG = 0x2,
XCVR_USBL_MSGS_FLAG = 0x20,
Expand Down Expand Up @@ -338,7 +367,7 @@ namespace Transports
int16_t position_easting;
int16_t position_northing;
int16_t position_depth;
uint8_t outputflags_list[4];
uint8_t outputflags_list[5];

void
outputFlagsComp(void)
Expand All @@ -347,6 +376,7 @@ namespace Transports
outputflags_list[1] = (0x02 & flags);
outputflags_list[2] = (0x04 & flags);
outputflags_list[3] = (0x08 & flags);
outputflags_list[4] = (0x10 & flags);
}
};
}
Expand Down
Loading