Skip to content

Commit

Permalink
Fix uninitialized parameter exception in gpsd_client
Browse files Browse the repository at this point in the history
When trying to run the constructor throws an exception:
"Component constructor threw an exception: Statically typed parameter
'use_gps_time' must be initialized."

This problem is described here:
ros2/rclcpp#1691

Solve this by using the non-template way of declaring the parameters.
  • Loading branch information
erikboto committed Sep 6, 2023
1 parent fa2ac9d commit 1df30bb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gpsd_client/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ namespace gpsd_client

bool start()
{
this->declare_parameter<bool>("use_gps_time");
this->declare_parameter<bool>("check_fix_by_variance");
this->declare_parameter<std::string>("frame_id");
this->declare_parameter<int>("publish_rate");
this->declare_parameter<std::string>("host");
this->declare_parameter<int>("port");
this->declare_parameter("use_gps_time", rclcpp::PARAMETER_BOOL);
this->declare_parameter("check_fix_by_variance", rclcpp::PARAMETER_BOOL);
this->declare_parameter("frame_id", rclcpp::PARAMETER_STRING);
this->declare_parameter("publish_rate", rclcpp::PARAMETER_INTEGER);
this->declare_parameter("host", rclcpp::PARAMETER_STRING);
this->declare_parameter("port", rclcpp::PARAMETER_INTEGER);

gps_fix_pub_ = create_publisher<gps_msgs::msg::GPSFix>("extended_fix", 1);
navsatfix_pub_ = create_publisher<sensor_msgs::msg::NavSatFix>("fix", 1);
Expand Down

0 comments on commit 1df30bb

Please # to comment.