In member function ‘virtual bool xarm_control::XArmHW::init(ros::NodeHandle&, ros::NodeHandle&)’: /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:155:3: error: ‘hw_nh_’ was not declared in this scope; did you mean ‘hw_ns_’? 155 | hw_nh_ = robot_hw_nh; | ^~~~~~ | hw_ns_ /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:156:3: error: ‘root_nh_’ was not declared in this scope; did you mean ‘root_nh’? 156 | root_nh_ = root_nh; | ^~~~~~~~ | root_nh /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:206:3: error: ‘locked_ip_key_’ was not declared in this scope 206 | locked_ip_key_ = "/uf_robot/" + robot_ip; | ^~~~~~~~~~~~~~ /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:225:48: error: no matching function for call to ‘xarm_api::XArmDriver::init(ros::NodeHandle&, std::string&, bool)’ 225 | xarm_driver_.init(robot_hw_nh, robot_ip, true); | ^ In file included from /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/include/xarm_controller/xarm_hw.h:36, from /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:8: /home/sparks/xarm_ws/src/xarm_ros/xarm_api/include/xarm_api/xarm_driver.h:21:14: note: candidate: ‘void xarm_api::XArmDriver::init(ros::NodeHandle&, std::string&)’ 21 | void init(ros::NodeHandle& root_nh, std::string &server_ip); | ^~~~ /home/sparks/xarm_ws/src/xarm_ros/xarm_api/include/xarm_api/xarm_driver.h:21:14: note: candidate expects 2 arguments, 3 provided /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp: In destructor ‘virtual xarm_control::XArmHW::~XArmHW()’: /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:258:3: error: ‘root_nh_’ was not declared in this scope 258 | root_nh_.setParam(locked_ip_key_, false); | ^~~~~~~~ /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:258:21: error: ‘locked_ip_key_’ was not declared in this scope 258 | root_nh_.setParam(locked_ip_key_, false); | ^~~~~~~~~~~~~~ /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp: In member function ‘virtual void xarm_control::XArmHW::write(const ros::Time&, const ros::Duration&)’: /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:456:5: error: ‘hw_nh_’ was not declared in this scope; did you mean ‘hw_ns_’? 456 | hw_nh_.param<float>("velo_duration", velo_duration, VELO_DURATION); | ^~~~~~ | hw_ns_ /home/sparks/xarm_ws/src/xarm_ros/xarm_controller/src/xarm_hw.cpp:456:18: error: expected primary-expression before ‘float’ 456 | hw_nh_.param<float>("velo_duration", velo_duration, VELO_DURATION); | ^~~~~ make[2]: *** [xarm_ros/xarm_controller/CMakeFiles/xarm_hw.dir/build.make:63:xarm_ros/xarm_controller/CMakeFiles/xarm_hw.dir/src/xarm_hw.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:6937:xarm_ros/xarm_controller/CMakeFiles/xarm_hw.dir/all] 错误 2 make: *** [Makefile:141:all] 错误 2 如何解决
时间: 2024-01-28 07:03:37 浏览: 134
layered_hardware:采用分层方案的ros_control实现
根据错误信息,有几个问题需要解决:
1. 'hw_nh_'变量未在作用域内声明。可能是在代码中忘记声明该变量或者使用了错误的变量名。请检查代码,并确保在使用该变量之前进行了正确的声明。
2. 'root_nh_'变量未在作用域内声明。可能是在代码中忘记声明该变量或者使用了错误的变量名。请检查代码,并确保在使用该变量之前进行了正确的声明。
3. 'locked_ip_key_'变量未在作用域内声明。可能是在代码中忘记声明该变量或者使用了错误的变量名。请检查代码,并确保在使用该变量之前进行了正确的声明。
4. 'xarm_driver_.init()'函数调用的参数个数不匹配。根据错误信息,该函数期望两个参数,但是提供了三个参数。请检查代码,并确保传递正确的参数数量和类型。
5. 'root_nh_'和'locked_ip_key_'变量在析构函数中未在作用域内声明。可能是在代码中忘记声明这些变量或者使用了错误的变量名。请检查代码,并确保在使用这些变量之前进行了正确的声明。
6. 'hw_nh_'变量未在作用域内声明。可能是在代码中忘记声明该变量或者使用了错误的变量名。请检查代码,并确保在使用该变量之前进行了正确的声明。
根据具体情况,你可以检查并修复这些问题,以解决编译错误。
阅读全文