Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码编译错误 #1

Open
yyds623 opened this issue Aug 18, 2024 · 1 comment
Open

代码编译错误 #1

yyds623 opened this issue Aug 18, 2024 · 1 comment

Comments

@yyds623
Copy link

yyds623 commented Aug 18, 2024

您好我在Ubuntu20.04的ROS2的foxy版本编译时遇到问题,我不知道该怎么结局这个问题,我是正常下载代码库直接编译遇到的问题

报错日志:

In file included from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:1:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp: At global scope:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:27:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
27 | hardware_interface::CallbackReturn on_configure(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:31:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
31 | hardware_interface::CallbackReturn on_cleanup(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:35:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
35 | hardware_interface::CallbackReturn on_shutdown(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:39:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
39 | hardware_interface::CallbackReturn on_activate(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:43:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
43 | hardware_interface::CallbackReturn on_deactivate(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:47:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
47 | hardware_interface::CallbackReturn on_error(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:51:33: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
51 | hardware_interface::CallbackReturn on_init(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:63:27: error: ‘rclcpp’ does not name a type
63 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:63:39: error: expected unqualified-id before ‘&’ token
63 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:63:39: error: expected ‘)’ before ‘&’ token
63 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^
| )
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:62:49: note: to match this ‘(’
62 | hardware_interface::return_type read(
| ^
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:63:39: error: expected ‘;’ at end of member declaration
63 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^
| ;
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:63:41: error: ‘time’ does not name a type
63 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:67:27: error: ‘rclcpp’ does not name a type
67 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:67:39: error: expected unqualified-id before ‘&’ token
67 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:67:39: error: expected ‘)’ before ‘&’ token
67 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^
| )
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:66:50: note: to match this ‘(’
66 | hardware_interface::return_type write(
| ^
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:67:39: error: expected ‘;’ at end of member declaration
67 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^
| ;
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:67:41: error: ‘time’ does not name a type
67 | const rclcpp::Time& time, const rclcpp::Duration& period
| ^~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:85:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
85 | hardware_interface::CallbackReturn Z1HwInterface::on_configure(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:103:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
103 | hardware_interface::CallbackReturn Z1HwInterface::on_cleanup(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:124:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
124 | hardware_interface::CallbackReturn
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:132:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
132 | hardware_interface::CallbackReturn Z1HwInterface::on_activate(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:148:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
148 | hardware_interface::CallbackReturn Z1HwInterface::on_deactivate(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:165:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
165 | hardware_interface::CallbackReturn Z1HwInterface::on_error(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:190:21: error: ‘CallbackReturn’ in namespace ‘hardware_interface’ does not name a type
190 | hardware_interface::CallbackReturn Z1HwInterface::on_init(
| ^~~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp: In member function ‘virtual std::vector<hardware_interface::StateInterface> unitree::z1::Z1HwInterface::export_state_interfaces()’:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:258:17: error: ‘info_’ was not declared in this scope
258 | info_.joints[i].name, hardware_interface::HW_IF_POSITION, &state_q[i]
| ^~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:275:17: error: ‘info_’ was not declared in this scope
275 | info_.joints[6].name,
| ^~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp: At global scope:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:297:2: warning: extra ‘;’ [-Wpedantic]
297 | };
| ^
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp: In member function ‘virtual std::vector<hardware_interface::CommandInterface> unitree::z1::Z1HwInterface::export_command_interfaces()’:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:308:17: error: ‘info_’ was not declared in this scope
308 | info_.joints[i].name, hardware_interface::HW_IF_POSITION, &cmd_q[i]
| ^~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:317:17: error: ‘info_’ was not declared in this scope
317 | info_.joints[6].name, hardware_interface::HW_IF_POSITION, &gripper_cmd_q
| ^~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp: At global scope:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:327:28: error: ‘Time’ in namespace ‘rclcpp’ does not name a type
327 | read(const rclcpp::Time& /* time /, const rclcpp::Duration& / period /) {
| ^~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:327:60: error: ‘Duration’ in namespace ‘rclcpp’ does not name a type
327 | read(const rclcpp::Time& /
time /, const rclcpp::Duration& / period /) {
| ^~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:326:33: error: no declaration matches ‘hardware_interface::return_type unitree::z1::Z1HwInterface::read(const int&, const int&)’
326 | hardware_interface::return_type Z1HwInterface::
| ^~~~~~~~~~~~~
In file included from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:1:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:62:45: note: candidate is: ‘hardware_interface::return_type unitree::z1::Z1HwInterface::read(...) &’
62 | hardware_interface::return_type read(
| ^~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:20:15: note: ‘class unitree::z1::Z1HwInterface’ defined here
20 | class Z1HwInterface : public hardware_interface::SystemInterface {
| ^~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:345:29: error: ‘Time’ in namespace ‘rclcpp’ does not name a type
345 | write(const rclcpp::Time& /
time /, const rclcpp::Duration& / period /) {
| ^~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:345:61: error: ‘Duration’ in namespace ‘rclcpp’ does not name a type
345 | write(const rclcpp::Time& /
time /, const rclcpp::Duration& / period */) {
| ^~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:344:33: error: no declaration matches ‘hardware_interface::return_type unitree::z1::Z1HwInterface::write(const int&, const int&)’
344 | hardware_interface::return_type Z1HwInterface::
| ^~~~~~~~~~~~~
In file included from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:1:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:66:45: note: candidate is: ‘hardware_interface::return_type unitree::z1::Z1HwInterface::write(...) &’
66 | hardware_interface::return_type write(
| ^~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:20:15: note: ‘class unitree::z1::Z1HwInterface’ defined here
20 | class Z1HwInterface : public hardware_interface::SystemInterface {
| ^~~~~~~~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp: In function ‘std::vector<std::pair<Eigen::Matrix<double, 6, 1>, Eigen::Matrix<double, 6, 1> > > interpolate(const Vector6d&, const Vector6d&, double, double)’:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:462:31: warning: unused variable ‘tf_pow2’ [-Wunused-variable]
462 | double tf_pow2 = pow(tf, 2);
| ^~~~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp: At global scope:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:509:88: warning: extra ‘;’ [-Wpedantic]
509 | nitree::z1::Z1HwInterface, hardware_interface::SystemInterface);
| ^

In file included from /opt/ros/foxy/include/class_loader/class_loader_core.hpp:57,
from /opt/ros/foxy/include/class_loader/class_loader.hpp:55,
from /opt/ros/foxy/include/pluginlib/class_list_macros.hpp:40,
from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:507:
/opt/ros/foxy/include/class_loader/meta_object.hpp: In instantiation of ‘B* class_loader::impl::MetaObject<C, B>::create() const [with C = unitree::z1::Z1HwInterface; B = hardware_interface::SystemInterface]’:
/opt/ros/foxy/include/class_loader/meta_object.hpp:216:7: required from here
/opt/ros/foxy/include/class_loader/meta_object.hpp:218:12: error: invalid new-expression of abstract class type ‘unitree::z1::Z1HwInterface’
218 | return new C;
| ^~~~~
In file included from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:1:
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:20:15: note: because the following virtual functions are pure within ‘unitree::z1::Z1HwInterface’:
20 | class Z1HwInterface : public hardware_interface::SystemInterface {
| ^~~~~~~~~~~~~
In file included from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/include/z1_hw_interface/z1_hw_interface.hpp:9,
from /home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:1:
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:48:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::configure(const hardware_interface::HardwareInfo&)’
48 | virtual return_type configure(const HardwareInfo & system_info) = 0;
| ^~~~~~~~~
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:116:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::start()’
116 | virtual return_type start() = 0;
| ^~~~~
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:122:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::stop()’
122 | virtual return_type stop() = 0;
| ^~~~
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:128:23: note: ‘virtual std::string hardware_interface::SystemInterface::get_name() const’
128 | virtual std::string get_name() const = 0;
| ^~~~~~~~
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:134:18: note: ‘virtual hardware_interface::status hardware_interface::SystemInterface::get_status() const’
134 | virtual status get_status() const = 0;
| ^~~~~~~~~~
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:144:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::read()’
144 | virtual return_type read() = 0;
| ^~~~
/opt/ros/foxy/include/hardware_interface/system_interface.hpp:153:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::write()’
153 | virtual return_type write() = 0;
| ^~~~~
/home/shansu/ROS2/src/z1_ros2/z1_hw_interface/src/z1_hw_interface.cpp:441:13: warning: ‘void to_lower_string(std::string&)’ defined but not used [-Wunused-function]
441 | static void to_lower_string(std::string& str) {
| ^~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/z1_hw_interface.dir/build.make:63:CMakeFiles/z1_hw_interface.dir/src/z1_hw_interface.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:98:CMakeFiles/z1_hw_interface.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

Failed <<< z1_hw_interface [2.35s, exited with code 2]

@matteodv99tn
Copy link
Collaborator

Sorry for the late reply, I didn't see the issue before.

Unfortunately, we have issues with the robot on our laboratory, and the hardware interface is not yet completed and working.
Hopefully in the next month we will have a working version.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants