waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
Loading...
Searching...
No Matches
waterlinkedsonar

CI Docs Release [License](LICENSE)

C++17 client library for the Water Linked Sonar 3D-15.

  • Configuration over the sonar's HTTP API: acoustics, imaging range and mode, salinity, speed of sound, UDP and IMU batch output, time and NTP, plus device identity and status.
  • UDP receiver that decodes the Range Image Protocol stream (range images, signal-strength or shaded bitmap images, IMU batches) and passes the messages to callbacks.
  • Conversions from range images to distances and point clouds, and from signal-strength images to linear strength.

Requires sonar firmware 1.5.1 or newer.

Build

sudo apt-get install cmake g++ libcurl4-openssl-dev libsnappy-dev zlib1g-dev \
nlohmann-json3-dev libprotobuf-dev protobuf-compiler libgtest-dev
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir build
sudo cmake --install build

-DBUILD_TESTING=OFF and -DWATERLINKEDSONAR_BUILD_EXAMPLES=OFF skip the tests and the examples. The package also builds with colcon.

Use in your project

find_package(waterlinkedsonar REQUIRED)
target_link_libraries(your_target PRIVATE waterlinkedsonar::waterlinkedsonar)
Header Contents
waterlinkedsonar/http/client.hpp SonarClient for the HTTP API
waterlinkedsonar/http/types.hpp Data types of the HTTP API
waterlinkedsonar/http/errors.hpp Exceptions thrown by SonarClient
waterlinkedsonar/udp/receiver.hpp Receiver, which decodes the data stream on a thread
waterlinkedsonar/udp/socket.hpp UdpSocket for the data stream
waterlinkedsonar/rip/decoder.hpp rip::Decoder for single packets
waterlinkedsonar/rip/messages.hpp Views of decoded range images, bitmap images and IMU batches
waterlinkedsonar/rip/conversions.hpp Distance, point cloud and strength conversions
waterlinkedsonar/span.hpp Span, the view type used by the API
waterlinkedsonar/ntp/sntp.hpp sntp_query() for checking an NTP server

Complete programs are in examples/, and the API reference is at bumblebeeas.github.io/waterlinkedsonar.

Configure the sonar

waterlinked::sonar::SonarClient client("192.168.194.96");
client.set_range({0.5, 10.0});
client.set_acoustics_enabled(true);
Blocking client for the integration API (https://docs.waterlinked.com/sonar-3d/sonar-3d-15-api/).
Definition client.hpp:31
Client for the Sonar 3D-15 HTTP API.

Receive data

using namespace waterlinked::sonar;
std::vector<float> points;
receiver.on_range_image([&](const RangeImageView& image) {
range_image_to_points(image, points, PointLayout::UNORGANIZED);
});
receiver.start();
Receives datagrams on a thread of its own, decodes them and passes the messages to the registered cal...
Definition receiver.hpp:51
IPv4 UDP socket bound for the sonar's multicast or unicast stream.
Definition socket.hpp:42
Conversions of decoded images to distances, point clouds and linear signal strength.
bool range_image_to_points(const RangeImageView &image, std::vector< float > &points, PointLayout layout)
Converts a range image to x, y, z triples in meters.
Thread that receives, decodes and dispatches the sonar's data stream.
Distance to the strongest reflection for each pixel.
Definition messages.hpp:26
Addressing, port and receive buffer of a UdpSocket.
Definition socket.hpp:22

Callbacks run on the receiver's thread. The views they receive are valid until the callback returns, so copy any data you keep.

Attribution

The protocol definition (proto/WaterLinkedSonarIntegrationProtocol.proto) and the test recording (test/data/ship_short.sonar) are copied from Water Linked's wlsonar under the MIT license in proto/LICENSE and test/data/LICENSE.

include/waterlinkedsonar/detail/tcb_span.hpp is Tristan Brindle's span implementation (Boost Software License 1.0).

License

MIT. See [LICENSE](LICENSE).