|
2 | 2 | #include "rclcpp/rclcpp.hpp" |
3 | 3 | #include "gnss_converter/nmea2fix.hpp" |
4 | 4 | #include <ublox_msgs/msg/nav_pvt.hpp> |
| 5 | +#include <septentrio_gnss_driver/msg/pvt_geodetic.hpp> |
5 | 6 | #include <geometry_msgs/msg/twist_with_covariance_stamped.hpp> |
6 | 7 | #include "eagleye_coordinate/eagleye_coordinate.hpp" |
7 | 8 | #include "eagleye_navigation/eagleye_navigation.hpp" |
@@ -107,6 +108,36 @@ void navpvt_callback(const ublox_msgs::msg::NavPVT::ConstSharedPtr msg) |
107 | 108 | rtklib_nav_pub->publish(r); |
108 | 109 | } |
109 | 110 |
|
| 111 | +void pvtgeodetic_callback(const septentrio_gnss_driver::msg::PVTGeodetic::ConstSharedPtr msg) |
| 112 | +{ |
| 113 | + rtklib_msgs::msg::RtklibNav r; |
| 114 | + r.header.frame_id = "gps"; |
| 115 | + r.header.stamp = msg->header.stamp; |
| 116 | + if (nav_msg_ptr != nullptr) |
| 117 | + r.status = *nav_msg_ptr; |
| 118 | + r.tow = msg->block_header.tow; |
| 119 | + |
| 120 | + double llh[3]; |
| 121 | + llh[0] = msg->latitude; |
| 122 | + llh[1] = msg->longitude; |
| 123 | + llh[2] = msg->height; |
| 124 | + double ecef_pos[3]; |
| 125 | + llh2xyz(llh, ecef_pos); |
| 126 | + |
| 127 | + double enu_vel[3] = {msg->ve, msg->vn, msg->vu}; |
| 128 | + double ecef_vel[3]; |
| 129 | + enu2xyz_vel(enu_vel, ecef_pos, ecef_vel); |
| 130 | + |
| 131 | + r.ecef_pos.x = ecef_pos[0]; |
| 132 | + r.ecef_pos.y = ecef_pos[1]; |
| 133 | + r.ecef_pos.z = ecef_pos[2]; |
| 134 | + r.ecef_vel.x = ecef_vel[0]; |
| 135 | + r.ecef_vel.y = ecef_vel[1]; |
| 136 | + r.ecef_vel.z = ecef_vel[2]; |
| 137 | + |
| 138 | + rtklib_nav_pub->publish(r); |
| 139 | +} |
| 140 | + |
110 | 141 | void gnss_velocity_callback(const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr msg) |
111 | 142 | { |
112 | 143 | if(msg->twist.covariance[0] > twist_covariance_thresh) |
@@ -161,6 +192,7 @@ int main(int argc, char** argv) |
161 | 192 | rclcpp::Subscription<nmea_msgs::msg::Sentence>::SharedPtr nmea_sentence_sub; |
162 | 193 | rclcpp::Subscription<ublox_msgs::msg::NavPVT>::SharedPtr navpvt_sub; |
163 | 194 | rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr gnss_velocity_sub; |
| 195 | + rclcpp::Subscription<septentrio_gnss_driver::msg::PVTGeodetic>::SharedPtr pvtgeodetic_sub; |
164 | 196 | rclcpp::Subscription<sensor_msgs::msg::NavSatFix>::SharedPtr navsatfix_sub; |
165 | 197 |
|
166 | 198 | node->declare_parameter("is_sub_antenna",is_sub_antenna); |
@@ -228,6 +260,11 @@ int main(int argc, char** argv) |
228 | 260 | gnss_velocity_sub = node->create_subscription<geometry_msgs::msg::TwistWithCovarianceStamped>( |
229 | 261 | velocity_source_topic, 1000, gnss_velocity_callback); |
230 | 262 | } |
| 263 | + else if(velocity_source_type == 4) |
| 264 | + { |
| 265 | + pvtgeodetic_sub = node->create_subscription<septentrio_gnss_driver::msg::PVTGeodetic>( |
| 266 | + velocity_source_topic, 1000, pvtgeodetic_callback); |
| 267 | + } |
231 | 268 | else |
232 | 269 | { |
233 | 270 | RCLCPP_ERROR(node->get_logger(),"Invalid velocity_source_type"); |
|
0 commit comments