waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
waterlinked::sonar Namespace Reference

Namespaces

namespace  rip
 

Classes

struct  About
 Device identity from GET /about. More...
 
struct  BitmapImageView
 8-bit greyscale image, displayable without further processing. More...
 
class  CurlTransport
 libcurl easy-interface transport: one handle, blocking, not thread-safe. More...
 
class  ForceSyncOngoingError
 force_sync_ntp() while another force-sync is running; the device answers HTTP 409. More...
 
struct  ForceSyncResult
 Outcome of a forced NTP sync. More...
 
class  HttpError
 Transport failure or non-2xx HTTP response. More...
 
class  HttpTransport
 Blocking HTTP transport. More...
 
struct  ImuBatchView
 Batch of approximately 100 Hz IMU samples sent while acoustics is enabled. More...
 
struct  MessageHeader
 Per-shot metadata shared by image message types. More...
 
class  ProtocolError
 Device answered with a body the client cannot interpret. More...
 
struct  Range
 Imaging range limits in meters. More...
 
struct  RangeImageView
 Per-pixel distance to the strongest reflection. More...
 
class  Receiver
 Owns the receive thread: reads datagrams from the injected socket, decodes them, and dispatches to the registered callbacks on that thread. More...
 
struct  ReceiverOptions
 Datagram filtering applied before decoding. More...
 
struct  ReceiverStats
 Snapshot of the receive thread's counters, cumulative since start(). More...
 
class  SonarClient
 Client for the Sonar 3D-15 integration API. More...
 
struct  Status
 Subsystem health from GET /status. More...
 
struct  StatusEntry
 One subsystem's health from GET /status. More...
 
class  TimeAlreadySynchronizedError
 set_time_manual() while the device is already NTP-synchronized; the device answers HTTP 409. More...
 
struct  TimeStatus
 Device clock state from GET /time/status. More...
 
struct  UdpConfig
 How the sonar streams data, from GET/POST /udp. More...
 
class  UdpSocket
 Receive-only UDP socket for the sonar's data stream. More...
 
struct  UdpSocketConfig
 Socket setup for the sonar's data stream. More...
 
class  VersionError
 Device firmware is older than the endpoint requires. More...
 

Typedefs

template<typename T >
using Span = tcb::span< T >
 Non-owning view over a contiguous sequence.
 

Enumerations

enum class  BitmapImageType : std::uint8_t { SIGNAL_STRENGTH , SHADED }
 What a BitmapImageView shows. More...
 
enum class  AcousticsMode : std::uint8_t { LOW_FREQUENCY , HIGH_FREQUENCY }
 Imaging mode: low frequency gives a 90x40 degree field of view at 5 Hz, high frequency 40x40 degrees at 20 Hz. More...
 
enum class  Salinity : std::uint8_t { SALT , FRESH }
 Water salinity, used by the sonar's automatic speed of sound. More...
 

Functions

bool range_image_to_distances (const RangeImageView &img, std::vector< float > &out)
 Converts a range image to per-pixel distances.
 
bool range_image_to_points (const RangeImageView &img, std::vector< float > &out, bool organized)
 Converts a range image to XYZ float32 triples using the pixel-to-angle mapping from the Water Linked docs:
 
bool bitmap_to_strength_linear (const BitmapImageView &img, std::vector< std::uint16_t > &out)
 Recovers linear 15-bit signal strength from a SIGNAL_STRENGTH bitmap, inverting the device's logarithmic mapping: pixel = 100 * log10(linear / 30).
 
std::optional< std::chrono::system_clock::time_point > sntp_query (const std::string &server, std::chrono::milliseconds timeout, std::uint16_t port=123)
 Asks an NTP server for its current time with a single SNTP (RFC 4330) query.
 
const char * to_string (AcousticsMode mode)
 Name used on the wire by the HTTP API: "low-frequency" or "high-frequency".
 
const char * to_string (Salinity salinity)
 Name used on the wire by the HTTP API: "salt" or "fresh".
 
const char * to_string (UdpConfig::Mode mode)
 Name used on the wire by the HTTP API: "multicast", "unicast" or "disabled".
 

Variables

constexpr const char * DEFAULT_IP = "192.168.194.96"
 Factory default IP address of the sonar.
 
constexpr const char * MULTICAST_GROUP = "224.0.0.96"
 Multicast group address for sonar data streams.
 
constexpr std::uint16_t MULTICAST_PORT = 4747
 Multicast port for sonar data streams.
 
constexpr std::size_t MAX_DATAGRAM_SIZE = 65507
 Largest UDP payload the sonar can send; receive buffers are sized to it.
 

Typedef Documentation

◆ Span

template<typename T >
using waterlinked::sonar::Span = typedef tcb::span<T>

Non-owning view over a contiguous sequence.

API-compatible with C++20 std::span. Aliases the vendored tcb::span under every language standard so the library and its consumers agree on the type regardless of the standard each is compiled with.

Enumeration Type Documentation

◆ AcousticsMode

enum class waterlinked::sonar::AcousticsMode : std::uint8_t
strong

Imaging mode: low frequency gives a 90x40 degree field of view at 5 Hz, high frequency 40x40 degrees at 20 Hz.

Enumerator
LOW_FREQUENCY 
HIGH_FREQUENCY 

◆ BitmapImageType

enum class waterlinked::sonar::BitmapImageType : std::uint8_t
strong

What a BitmapImageView shows.

Enumerator
SIGNAL_STRENGTH 

Logarithmic strength of the strongest reflection per pixel.

Computed as pixel = 100 * log10(linear / 30), where linear strength is 15-bit.

SHADED 

Shaded rendering of the range image.

Experimental on the device; may be removed by Water Linked.

◆ Salinity

enum class waterlinked::sonar::Salinity : std::uint8_t
strong

Water salinity, used by the sonar's automatic speed of sound.

Enumerator
SALT 
FRESH 

Function Documentation

◆ bitmap_to_strength_linear()

bool waterlinked::sonar::bitmap_to_strength_linear ( const BitmapImageView img,
std::vector< std::uint16_t > &  out 
)

Recovers linear 15-bit signal strength from a SIGNAL_STRENGTH bitmap, inverting the device's logarithmic mapping: pixel = 100 * log10(linear / 30).

Parameters
imgImage to convert.
outResized to width * height; 0 where the pixel has no data.
Returns
False when the pixel count does not equal width * height (out is left cleared); true otherwise.

◆ range_image_to_distances()

bool waterlinked::sonar::range_image_to_distances ( const RangeImageView img,
std::vector< float > &  out 
)

Converts a range image to per-pixel distances.

Parameters
imgImage to convert.
outResized to width * height; out[i] = pixel[i] * image_pixel_scale in meters, 0.0 where the pixel has no data.
Returns
False when the pixel count does not equal width * height (out is left cleared); true otherwise.

◆ range_image_to_points()

bool waterlinked::sonar::range_image_to_points ( const RangeImageView img,
std::vector< float > &  out,
bool  organized 
)

Converts a range image to XYZ float32 triples using the pixel-to-angle mapping from the Water Linked docs:

  • yaw = (px / (width - 1)) * fov_h - fov_h / 2
  • pitch = (py / (height - 1)) * fov_v - fov_v / 2
  • (x, y, z) = d * (cos p * cos y, cos p * sin y, -sin p)
Parameters
imgImage to convert.
outOrganized: width * height triples in row-major pixel order, NaN for pixels with no data. Unorganized: one triple per valid pixel.
organizedSelects the output layout.
Returns
False when width or height is less than 2 or the pixel count does not equal width * height (out is left cleared); true otherwise.

◆ sntp_query()

std::optional< std::chrono::system_clock::time_point > waterlinked::sonar::sntp_query ( const std::string &  server,
std::chrono::milliseconds  timeout,
std::uint16_t  port = 123 
)

Asks an NTP server for its current time with a single SNTP (RFC 4330) query.

Intended as a pre-flight check of a time source before configuring it on a device, not as a time synchronization mechanism.

Parameters
serverHostname or IP address.
timeoutMaximum wait for the response.
portNTP port.
Returns
The server's time, or nullopt if it does not answer within the timeout or answers with anything other than a valid, synchronized server response (mode 4, stratum 1-15, no alarm condition, non-zero transmit time).

◆ to_string() [1/3]

const char * waterlinked::sonar::to_string ( AcousticsMode  mode)

Name used on the wire by the HTTP API: "low-frequency" or "high-frequency".

◆ to_string() [2/3]

const char * waterlinked::sonar::to_string ( Salinity  salinity)

Name used on the wire by the HTTP API: "salt" or "fresh".

◆ to_string() [3/3]

const char * waterlinked::sonar::to_string ( UdpConfig::Mode  mode)

Name used on the wire by the HTTP API: "multicast", "unicast" or "disabled".

Variable Documentation

◆ DEFAULT_IP

constexpr const char* waterlinked::sonar::DEFAULT_IP = "192.168.194.96"
inlineconstexpr

Factory default IP address of the sonar.

◆ MAX_DATAGRAM_SIZE

constexpr std::size_t waterlinked::sonar::MAX_DATAGRAM_SIZE = 65507
inlineconstexpr

Largest UDP payload the sonar can send; receive buffers are sized to it.

◆ MULTICAST_GROUP

constexpr const char* waterlinked::sonar::MULTICAST_GROUP = "224.0.0.96"
inlineconstexpr

Multicast group address for sonar data streams.

◆ MULTICAST_PORT

constexpr std::uint16_t waterlinked::sonar::MULTICAST_PORT = 4747
inlineconstexpr

Multicast port for sonar data streams.