agilexrobotics / bunker_ros2

bunker ros2 package
Apache License 2.0
5 stars 11 forks source link

Build error with ROS2 Jazzy #6

Open kisdia opened 2 months ago

kisdia commented 2 months ago

Getting the following error during building:

src/bunker_ros2/bunker_base/src/bunker_base_ros.cpp: In constructor ‘westonrobot::BunkerBaseRos::BunkerBaseRos(std::string)’: /home/robot/head360_ws/src/bunker_ros2/bunker_base/src/bunker_base_ros.cpp:18:26: error: no matching function for call to ‘westonrobot::BunkerBaseRos::declare_parameter(const char [10])’ 18 | this->declare_parameter("port_name"); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ In file included from /opt/ros/jazzy/include/rclcpp/rclcpp/executors/single_threaded_executor.hpp:28, from /opt/ros/jazzy/include/rclcpp/rclcpp/executors.hpp:22, from /opt/ros/jazzy/include/rclcpp/rclcpp/rclcpp.hpp:172, from /home/robot/head360_ws/src/bunker_ros2/bunker_base/include/bunker_base/bunker_base_ros.hpp:16, from /home/robot/head360_ws/src/bunker_ros2/bunker_base/src/bunker_base_ros.cpp:10: /opt/ros/jazzy/include/rclcpp/rclcpp/node.hpp:500:3: note: candidate: ‘template<class ParameterT> auto rclcpp::Node::declare_parameter(const std::string&, const ParameterT&, const rcl_interfaces::msg::ParameterDescriptor&, bool)’ 500 | declare_parameter( | ^~~~~~~~~~~~~~~~~ /opt/ros/jazzy/include/rclcpp/rclcpp/node.hpp:500:3: note: template argument deduction/substitution failed: /home/robot/head360_ws/src/bunker_ros2/bunker_base/src/bunker_base_ros.cpp:18:26: note: candidate expects 4 arguments, 1 provided 18 | this->declare_parameter("port_name"); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ /opt/ros/jazzy/include/rclcpp/rclcpp/node.hpp:513:3: note: candidate: ‘template<class ParameterT> auto rclcpp::Node::declare_parameter(const std::string&, const rcl_interfaces::msg::ParameterDescriptor&, bool)’ 513 | declare_parameter( | ^~~~~~~~~~~~~~~~~ /opt/ros/jazzy/include/rclcpp/rclcpp/node.hpp:513:3: note: template argument deduction/substitution failed: /home/robot/head360_ws/src/bunker_ros2/bunker_base/src/bunker_base_ros.cpp:18:26: note: couldn’t deduce template parameter ‘ParameterT’ 18 | this->declare_parameter("port_name"); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

kisdia commented 2 months ago

In bunker_base_ros.cpp need to add to all declare parameter.

namespace westonrobot { BunkerBaseRos::BunkerBaseRos(std::string node_name) : rclcpp::Node(node_name), keeprunning(false) { this->declare_parameter("port_name");

this->declare_parameter("odom_frame"); this->declare_parameter("base_frame"); this->declare_parameter("odom_topic_name");

this->declare_parameter("is_bunker_mini"); this->declare_parameter("simulated_robot"); this->declare_parameter("control_rate");

LoadParameters(); }

kisdia commented 3 weeks ago

this->declare_parameterstd::bool("is_bunker_mini"); this->declare_parameterstd::bool("simulated_robot"); this->declare_parameterstd::int("control_rate");

The last 3 variables are not strings the above is the correct declaration