Common
common packages for kyubic
 
Loading...
Searching...
No Matches
dvl_driver.hpp
Go to the documentation of this file.
1
10#ifndef _DVL_DRIVER_HPP
11#define _DVL_DRIVER_HPP
12
13#include <driver_msgs/msg/dvl.hpp>
14#include <driver_msgs/srv/command.hpp>
15#include <rclcpp/rclcpp.hpp>
16
18#include "timer/timeout.hpp"
19
24namespace driver::dvl_driver
25{
26
31class DVLDriver : public rclcpp::Node
32{
33public:
37 explicit DVLDriver();
38
42 ~DVLDriver();
43
44private:
45 std::string address;
46 int listener_port;
47 int sender_port;
48 int64_t timeout_ms;
49 bool turning;
50
51 bool command_mode = false;
52 bool break_cmd = false;
53 std::shared_ptr<timer::Timeout> timeout_;
54
55 // DVL Interface
56 std::shared_ptr<path_finder::Sender> sender_;
57 std::shared_ptr<path_finder::Listener> listener_;
58
59 // ROS Interface
60 rclcpp::Publisher<driver_msgs::msg::DVL>::SharedPtr pub_;
61 rclcpp::Service<driver_msgs::srv::Command>::SharedPtr srv_;
62 rclcpp::TimerBase::SharedPtr timer_;
63
68 bool setup();
69
74 bool _update();
75
79 void update();
80
87 template <typename T>
88 void _convertVelocity(const T & raw_vel, driver_msgs::msg::DVL & msg);
89
97 void _extractPd0Data(
98 const std::shared_ptr<path_finder::pd0::Pd0Ensemble> & data, driver_msgs::msg::DVL & msg);
99
106 void _extractPd5Data(
107 const std::shared_ptr<path_finder::pd5::Pd5Ensemble> & data, driver_msgs::msg::DVL & msg);
108
114 double _calculate_average_altitude(const float ranges[4]);
115
121 void sendCommandCallback(
122 const driver_msgs::srv::Command::Request::SharedPtr request,
123 driver_msgs::srv::Command::Response::SharedPtr response);
124};
125
126} // namespace driver::dvl_driver
127
128#endif // _DVL_DRIVER_HPP
ROS 2 Node for interfacing with Teledyne Pathfinder DVL.
Definition: dvl_driver.hpp:32
~DVLDriver()
Destructor. Sends break command to stop DVL output.
Definition: dvl_driver.cpp:59
DVLDriver()
Constructor. Establishes connection and initializes publishers/services.
Definition: dvl_driver.cpp:24
Namespace for DVL driver components.
Definition: setup.py:1
Path Finder DVL Interface Library.
timeout library