Common
common packages for kyubic
 
Loading...
Searching...
No Matches
depth_odometry_component.hpp
Go to the documentation of this file.
1
13#ifndef _DEPTH_ODOMETRY_HPP
14#define _DEPTH_ODOMETRY_HPP
15
16#include <driver_msgs/msg/depth.hpp>
17#include <localization_msgs/msg/odometry.hpp>
18#include <rclcpp/rclcpp.hpp>
19#include <std_srvs/srv/trigger.hpp>
20
25namespace localization::depth
26{
27
29const float EMA_ALPHA = 0.4;
30
32const int DEPTH_SMA_SUMPLE_NUM = 32;
33
35const float sea2fresh_scale = 1029.0 / 1000.0;
36
40class DepthOdometry : public rclcpp::Node
41{
42private:
43 rclcpp::Publisher<localization_msgs::msg::Odometry>::SharedPtr pub_;
44 rclcpp::Subscription<driver_msgs::msg::Depth>::SharedPtr sub_;
45 rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr srv_;
46
47 bool fresh_water;
48
49 rclcpp::Time pre_time;
50 double pre_pos_z = 0.0;
51
52 uint8_t idx = 0;
53 std::array<double, DEPTH_SMA_SUMPLE_NUM> vel_z_list;
54 double offset_pos_z = 0.0;
55 double pos_z = 0.0;
56
63 void update_callback(const driver_msgs::msg::Depth::UniquePtr msg);
64
69 void reset_callback(
70 const std_srvs::srv::Trigger::Request::SharedPtr request,
71 const std_srvs::srv::Trigger::Response::SharedPtr response);
72
73public:
79 explicit DepthOdometry(const rclcpp::NodeOptions & options);
80
84 void reset();
85};
86
87} // namespace localization::depth
88
89#endif // !_DEPTH_ODOMETRY_HPP
Depth odometry class.
Definition: depth_odometry_component.hpp:41
void reset()
Set previous depth data to 0, and Reset timer.
Definition: depth_odometry_component.cpp:92
const int DEPTH_SMA_SUMPLE_NUM
Number of TAP for simple moving average.
Definition: depth_odometry_component.hpp:32
const float sea2fresh_scale
Convert to sea to fresh density.
Definition: depth_odometry_component.hpp:35
const float EMA_ALPHA
parameter of Exponential Moving Average
Definition: depth_odometry_component.hpp:29