Open kisdia opened 2 months ago
In bunker_base_ros.cpp need to add
namespace westonrobot {
BunkerBaseRos::BunkerBaseRos(std::string node_name)
: rclcpp::Node(node_name), keeprunning(false) {
this->declare_parameter
this->declare_parameter
this->declare_parameter
LoadParameters(); }
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
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"); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~