Skip to content

Commit 159546a

Browse files
author
ryohei sasaki
authored
Illegal value guard for eagleye/fix (#295)
1 parent 94228d3 commit 159546a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

eagleye_rt/src/position_interpolate_node.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ rclcpp::Publisher<sensor_msgs::msg::NavSatFix>::SharedPtr pub2;
4747
struct PositionInterpolateParameter position_interpolate_parameter;
4848
struct PositionInterpolateStatus position_interpolate_status;
4949

50+
std::string node_name = "eagleye_position_interpolate";
51+
5052
void gga_callback(const nmea_msgs::msg::Gpgga::ConstSharedPtr msg)
5153
{
5254
gga = *msg;
@@ -85,8 +87,15 @@ void enu_vel_callback(const geometry_msgs::msg::Vector3Stamped::ConstSharedPtr m
8587
position_interpolate_estimate(enu_absolute_pos,enu_vel,gnss_smooth_pos,height,heading_interpolate_3rd,position_interpolate_parameter,&position_interpolate_status,&enu_absolute_pos_interpolate,&eagleye_fix);
8688
if (enu_absolute_pos.status.enabled_status == true)
8789
{
88-
pub1->publish(enu_absolute_pos_interpolate);
89-
pub2->publish(eagleye_fix);
90+
if(eagleye_fix.latitude == 0 && eagleye_fix.longitude == 0)
91+
{
92+
RCLCPP_WARN(rclcpp::get_logger(node_name), "eagleye_fix is not published because latitude and longitude are 0.");
93+
}
94+
else
95+
{
96+
pub1->publish(enu_absolute_pos_interpolate);
97+
pub2->publish(eagleye_fix);
98+
}
9099
}
91100
else if (gga_time != 0)
92101
{
@@ -102,7 +111,7 @@ void enu_vel_callback(const geometry_msgs::msg::Vector3Stamped::ConstSharedPtr m
102111
int main(int argc, char** argv)
103112
{
104113
rclcpp::init(argc, argv);
105-
auto node = rclcpp::Node::make_shared("eagleye_position_interpolate");
114+
auto node = rclcpp::Node::make_shared(node_name);
106115

107116
std::string subscribe_gga_topic_name = "gnss/gga";
108117

0 commit comments

Comments
 (0)