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

Ros2 Humble Ubuntu 22.04 colcon build error (error: ‘Node’ in namespace ‘rclcpp’ does not name a type...) #34

Open
TacHuynh opened this issue Jan 7, 2025 · 1 comment

Comments

@TacHuynh
Copy link

TacHuynh commented Jan 7, 2025

colcon build --symlink-install produce compiling error

How to fix?
Thanks.

th@th-UpProSquared:/ros2_ws1$ colcon build --symlink-install
Starting >>> hoverboard_driver
--- stderr: hoverboard_driver
In file included from /opt/ros/humble/include/control_toolbox/control_toolbox/pid.hpp:41,
from /home/th/ros2_ws1/src/hoverboard-driver/hardware/include/hoverboard_driver/pid.hpp:3,
from /home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:2:
/opt/ros/humble/include/realtime_tools/realtime_tools/realtime_buffer.h:22:100: note: ‘#pragma message: This header include is deprecated. Please update your code to use 'realtime_buffer.hpp' header.’
22 | "This header include is deprecated. Please update your code to use 'realtime_buffer.hpp' header.") //NOLINT
| ^
In file included from /opt/ros/humble/include/control_toolbox/control_toolbox/pid.hpp:41,
from /home/th/ros2_ws1/src/hoverboard-driver/hardware/include/hoverboard_driver/pid.hpp:3,
from /home/th/ros2_ws1/src/hoverboard-driver/hardware/include/hoverboard_driver/hoverboard_driver.hpp:34,
from /home/th/ros2_ws1/src/hoverboard-driver/hardware/hoverboard_driver.cpp:15:
/opt/ros/humble/include/realtime_tools/realtime_tools/realtime_buffer.h:22:100: note: ‘#pragma message: This header include is deprecated. Please update your code to use 'realtime_buffer.hpp' header.’
22 | "This header include is deprecated. Please update your code to use 'realtime_buffer.hpp' header.") //NOLINT
| ^
In file included from /home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:2:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/include/hoverboard_driver/pid.hpp:122:17: error: ‘Node’ in namespace ‘rclcpp’ does not name a type
122 | rclcpp::Node::SharedPtr node_;
| ^~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp: In member function ‘void PID::init(double, double, double, double, double, double, bool, double, double)’:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:17:25: error: ‘get_logger’ is not a member of ‘rclcpp’
17 | RCLCPP_INFO(rclcpp::get_logger("hoverboard_driver"), "Initialize PID");
| ^~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:17:5: error: ‘RCLCPP_INFO’ was not declared in this scope; did you mean ‘RCLCPP_IMPORT’?
17 | RCLCPP_INFO(rclcpp::get_logger("hoverboard_driver"), "Initialize PID");
| ^~~~~~~~~~~
| RCLCPP_IMPORT
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:26:33: error: ‘get_logger’ is not a member of ‘rclcpp’
26 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Initialized PID: F=" << f << ", P=" << gains.p_gain_ << ", I=" << gains.i_gain_ << ", D=" << gains.d_gain_ << ", out_min=" << out_min_ << ", out_max=" << out_max_);
| ^~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:26:88: error: invalid operands of types ‘const char [20]’ and ‘double’ to binary ‘operator<<’
26 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Initialized PID: F=" << f << ", P=" << gains.p_gain_ << ", I=" << gains.i_gain_ << ", D=" << gains.d_gain_ << ", out_min=" << out_min_ << ", out_max=" << out_max_);
| ~~~~~~~~~~~~~~~~~~~~~ ^
~
| | |
| const char [20] double
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:26:5: error: ‘RCLCPP_DEBUG_STREAM’ was not declared in this scope
26 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Initialized PID: F=" << f << ", P=" << gains.p_gain_ << ", I=" << gains.i_gain_ << ", D=" << gains.d_gain_ << ", out_min=" << out_min_ << ", out_max=" << out_max_);
| ^~~~~~~~~~~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp: In member function ‘void PID::setParameters(double, double, double, double, double, double, bool)’:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:81:33: error: ‘get_logger’ is not a member of ‘rclcpp’
81 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Update PID Gains: F=" << f << ", P=" << gains.p_gain_ << ", I=" << gains.i_gain_ << ", D=" << gains.d_gain_ << ", out_min=" << out_min_ << ", out_max=" << out_max_);
| ^~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:81:89: error: invalid operands of types ‘const char [21]’ and ‘double’ to binary ‘operator<<’
81 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Update PID Gains: F=" << f << ", P=" << gains.p_gain_ << ", I=" << gains.i_gain_ << ", D=" << gains.d_gain_ << ", out_min=" << out_min_ << ", out_max=" << out_max_);
| ~~~~~~~~~~~~~~~~~~~~~~ ^~ ~
| | |
| const char [21] double
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:81:5: error: ‘RCLCPP_DEBUG_STREAM’ was not declared in this scope
81 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Update PID Gains: F=" << f << ", P=" << gains.p_gain_ << ", I=" << gains.i_gain_ << ", D=" << gains.d_gain_ << ", out_min=" << out_min_ << ", out_max=" << out_max_);
| ^~~~~~~~~~~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp: In member function ‘void PID::setOutputLimits(double, double)’:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:88:33: error: ‘get_logger’ is not a member of ‘rclcpp’
88 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Update PID output limits: lower=" << out_min_ << ", upper=" << out_max_);
| ^~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:88:101: error: invalid operands of types ‘const char [33]’ and ‘double’ to binary ‘operator<<’
88 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Update PID output limits: lower=" << out_min_ << ", upper=" << out_max_);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~
| | |
| const char [33] double
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:88:5: error: ‘RCLCPP_DEBUG_STREAM’ was not declared in this scope
88 | RCLCPP_DEBUG_STREAM(rclcpp::get_logger("hoverboard_driver"), "Update PID output limits: lower=" << out_min_ << ", upper=" << out_max_);
| ^~~~~~~~~~~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp: In member function ‘double PID::clamp(const double&, const double&, const double&)’:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:94:13: error: ‘Clock’ is not a member of ‘rclcpp’
94 | rclcpp::Clock clock;
| ^~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:97:21: error: ‘get_logger’ is not a member of ‘rclcpp’
97 | rclcpp::get_logger("hoverboard_driver"), clock, 1000000000,
| ^~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:98:22: error: invalid operands of types ‘const char [7]’ and ‘const double’ to binary ‘operator<<’
98 | "Clamp " << value << " to upper limit " << upper_limit);
| ~~~~~~~~ ^~ ~~~~~
| | |
| | const double
| const char [7]
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:96:9: error: ‘RCLCPP_DEBUG_STREAM_THROTTLE’ was not declared in this scope
96 | RCLCPP_DEBUG_STREAM_THROTTLE(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:102:21: error: ‘get_logger’ is not a member of ‘rclcpp’
102 | rclcpp::get_logger("hoverboard_driver"), clock, 1000000000,
| ^~~~~~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:103:22: error: invalid operands of types ‘const char [7]’ and ‘const double’ to binary ‘operator<<’
103 | "Clamp " << value << " to lower limit " << upper_limit);
| ~~~~~~~~ ^~ ~~~~~
| | |
| | const double
| const char [7]
/home/th/ros2_ws1/src/hoverboard-driver/hardware/pid.cpp:101:9: error: ‘RCLCPP_DEBUG_STREAM_THROTTLE’ was not declared in this scope
101 | RCLCPP_DEBUG_STREAM_THROTTLE(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/th/ros2_ws1/src/hoverboard-driver/hardware/include/hoverboard_driver/hoverboard_driver.hpp:34,
from /home/th/ros2_ws1/src/hoverboard-driver/hardware/hoverboard_driver.cpp:15:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/include/hoverboard_driver/pid.hpp:122:17: error: ‘Node’ in namespace ‘rclcpp’ does not name a type
122 | rclcpp::Node::SharedPtr node_;
| ^~~~
gmake[2]: *** [CMakeFiles/hoverboard_driver.dir/build.make:90: CMakeFiles/hoverboard_driver.dir/hardware/pid.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
/home/th/ros2_ws1/src/hoverboard-driver/hardware/hoverboard_driver.cpp: In member function ‘virtual hardware_interface::return_type hoverboard_driver::hoverboard_driver::read(const rclcpp::Time&, const rclcpp::Duration&)’:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/hoverboard_driver.cpp:336:57: warning: unused parameter ‘period’ [-Wunused-parameter]
336 | const rclcpp::Time &time, const rclcpp::Duration &period)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/home/th/ros2_ws1/src/hoverboard-driver/hardware/hoverboard_driver.cpp: In member function ‘virtual hardware_interface::return_type hoverboard_driver::hoverboard_driver::write(const rclcpp::Time&, const rclcpp::Duration&)’:
/home/th/ros2_ws1/src/hoverboard-driver/hardware/hoverboard_driver.cpp:440:27: warning: unused parameter ‘time’ [-Wunused-parameter]
440 | const rclcpp::Time &time, const rclcpp::Duration &period)
| ~~~~~~~~~~~~~~~~~~~~^~~~
gmake[2]: *** [CMakeFiles/hoverboard_driver.dir/build.make:76: CMakeFiles/hoverboard_driver.dir/hardware/hoverboard_driver.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/hoverboard_driver.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Failed <<< hoverboard_driver [16.8s, exited with code 2]

Summary: 0 packages finished [18.0s]
1 package failed: hoverboard_driver
1 package had stderr output: hoverboard_driver
th@th-UpProSquared:~/ros2_ws1$

@Glistore
Copy link

Hey, any updates? I'm facing the same error

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