Ask Your Question

Nav2: nav2_planner fails with -Werror=maybe-uninitialized

asked 2021-05-28 16:44:25 -0500

JuBorto gravatar image

updated 2021-05-31 15:30:15 -0500


I'm new to ROS, and I'm currently exploring Nav2 (and I have to say, Linux as well). I haven't found a related topic, and would like to know if anyone has encountered a similar issue.

When trying to setup a Nav2 workspace by following the build instructions, a warning ends up being treated as an error when processing nav2_planner:

[Processing: nav2_planner, nav2_recoveries, nav2_regulated_pure_pursuit_controller, smac_planner] --- stderr: nav2_planner In file included from /opt/ros/foxy/include/rclcpp/node_interfaces/node_parameters_interface.hpp:28,
from /opt/ros/foxy/include/rclcpp/node.hpp:51,
from /opt/ros/foxy/include/rclcpp/executors/single_threaded_executor.hpp:28,
from /opt/ros/foxy/include/rclcpp/executors.hpp:22,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/xxxxxx/nav2_ws/install/nav2_util/include/nav2_util/costmap.hpp:21,
from /home/xxxxxx/nav2_ws/src/navigation2/nav2_planner/src/planner_server.cpp:27:
/opt/ros/foxy/include/rclcpp/parameter.hpp: In member function ‘virtual nav2_util::CallbackReturn nav2_planner::PlannerServer::on_configure(const rclcpp_lifecycle::State&)’: /opt/ros/foxy/include/rclcpp/parameter.hpp:70:42: error: ‘expected_planner_frequency’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
70 | : Parameter(name, ParameterValue(value))
| ^
/home/xxxxxx/nav2_ws/src/navigation2/nav2_planner/src/planner_server.cpp:117:10: note: ‘expected_planner_frequency’ was declared here
117 | double expected_planner_frequency;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/planner_server_core.dir/build.make:63: CMakeFiles/planner_server_core.dir/src/planner_server.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:107: CMakeFiles/planner_server_core.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Failed <<< nav2_planner [1min 21s, exited with code 2]

Instructions being used:

Changes I made to the original instructions because I'm using Linux Mint:

$ rosdep install -y -r -q --from-paths src --ignore-src --rosdistro foxy --os=ubuntu:focal

Error shows while running:

$ colcon build --symlink-install

I'm running Linux Mint 20.1 Ulyssa (kernel 5.4.0-73)

ROS information:

  • ROS_DISTRO=foxy

Any help is greatly appreciated, thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-05-31 14:40:12 -0500

JuBorto gravatar image

updated 2021-05-31 15:30:37 -0500

I found my answer by disabling warnings from the CMake CXXFLAGS:

$ colcon build --symlink-install --cmake-args -DCMAKE_CXX_FLAGS="-w"

I agree that ignoring warnings should be avoided, but since I found no issues logged for ROS2 or Nav2, as well as no reports of similar errors, I'm guessing this is just something with my environment.

Any other input is greatly appreciated!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-05-28 16:44:25 -0500

Seen: 247 times

Last updated: May 31 '21