osrf / rmf_core

Provides the centralized functions of RMF: scheduling, etc.
Apache License 2.0
102 stars 41 forks source link

convert negotiation issue #196

Closed Jason-Zhou1 closed 3 years ago

Jason-Zhou1 commented 4 years ago

Hi friends, I met some error when I colcon build:

error: could not convert ‘negotiation’ from ‘rmf_traffic::schedule::Negotiation’ to ‘rmf_utils::optional {aka std::optional}’ return negotiation;

May I know how to solve it?

codebot commented 4 years ago

Is this error showing up when compiling your own code (for example, a new fleet adapter), or the code in this repository? All commits to this repo are automatically compiled in a GitHub action. For example, here is the latest commit to this repo, which shows successful compilation: https://github.com/osrf/rmf_core/pull/186/checks

mxgrey commented 4 years ago

In addition to Morgan's comments, it's impossible for us to diagnose where an error might be without more of the compiler output. For example:

  1. What file did this happen in?
  2. What line of code?
  3. What operating system are you using?
  4. What compiler are you using, and what version?
Jason-Zhou1 commented 4 years ago

Hi mxgrey, We are operating in Eloquent Ubuntu18.04. The overall error messages are: --- stderr: rmf_traffic
/home/jaosn/rmf_demos_ws/src/rmf/rmf_core/rmf_traffic/src/rmf_traffic/schedule/Negotiation.cpp: In static member function ‘static rmf_utils::optional rmf_traffic::schedule::Negotiation::make(std::shared_ptr, std::vector)’: /home/jaosn/rmf_demos_ws/src/rmf/rmf_core/rmf_traffic/src/rmf_traffic/schedule/Negotiation.cpp:897:10: error: could not convert ‘negotiation’ from ‘rmf_traffic::schedule::Negotiation’ to ‘rmf_utils::optional {aka std::optional}’ return negotiation; ^~~ make[2]: [CMakeFiles/rmf_traffic.dir/src/rmf_traffic/schedule/Negotiation.cpp.o] Error 1 make[1]: [CMakeFiles/rmf_traffic.dir/all] Error 2 make: *** [all] Error 2

codebot commented 4 years ago

On Ubuntu 18.04, you need to override the default compiler to a newer version (gcc 8), as per the installation instructions: https://github.com/osrf/rmf_core#installation

Are you doing that? (Note that if you have previously partially built the system with the "stock" gcc 7 compiler, you'll want to erase the build and install directories and start over, to make sure it's all "clean" when the build is being configured.

Jason-Zhou1 commented 4 years ago

Hi codebot, I have done according to your advice, the above issue disappears, but others error occurs about the rmf_traffic_ros2: --- stderr: rmf_traffic_ros2
CMake Error at CMakeLists.txt:58 (ament_export_targets): Unknown CMake command "ament_export_targets".

Failed <<< rmf_traffic_ros2 [0.30s, exited with code 1]

Summary: 12 packages finished [2.92s] 1 package failed: rmf_traffic_ros2 1 package had stderr output: rmf_traffic_ros2 1 package not processed

Thanks!

mxgrey commented 4 years ago

The latest master branch depends on the foxy distribution of ROS2.

If you're on 18.04, then you'll need to build ROS2 foxy from source and then build your RMF workspace on top of that overlay.

Or upgrading your system to 20.04 may be an easier path.