projectatctu / ocs2_fun

ROS package for controlling Anymal and Spot in Gazebo using the OCS2 toolbox
40 stars 2 forks source link

The issues related to compiling ocs2_gazebo #4

Closed widthstudio closed 5 months ago

widthstudio commented 5 months ago

First of all, thank you so much for open source this very good project. But I had the following problem when compiling ocs2_gazebo in this project

Errors     << ocs2_gazebo:make /home/yck/ocs2_fun/logs/ocs2_gazebo/build.make.000.log            
In file included from /usr/include/ignition/math6/gz/math/Box.hh:23,
                 from /usr/include/ignition/math6/gz/math.hh:30,
                 from /usr/include/ignition/math6/ignition/math.hh:18,
                 from /usr/include/sdformat-9.8/sdf/Param.hh:33,
                 from /usr/include/sdformat-9.8/sdf/Element.hh:28,
                 from /usr/include/sdformat-9.8/sdf/Actor.hh:25,
                 from /usr/include/sdformat-9.8/sdf/sdf.hh:2,
                 from /usr/include/gazebo-11/gazebo/common/Battery.hh:25,
                 from /usr/include/gazebo-11/gazebo/common/common.hh:8,
                 from /home/yck/ocs2_fun/src/ocs2_fun/ocs2_gazebo/include/ocs2_gazebo/StateEstimator.h:6,
                 from /home/yck/ocs2_fun/src/ocs2_fun/ocs2_gazebo/src/StateEstimator.cpp:1:
/usr/include/ignition/math6/gz/math/Plane.hh:133:20: error: ‘optional’ in namespace ‘std’ does not name a template type
  133 |       public: std::optional<Vector3<T>> Intersection(
      |                    ^~~~~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/StateEstimator.dir/build.make:63:CMakeFiles/StateEstimator.dir/src/StateEstimator.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:237:CMakeFiles/StateEstimator.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
In file included from /usr/include/ignition/math6/gz/math/Box.hh:23,
                 from /usr/include/ignition/math6/gz/math.hh:30,
                 from /usr/include/ignition/math6/ignition/math.hh:18,
                 from /usr/include/sdformat-9.8/sdf/Param.hh:33,
                 from /usr/include/sdformat-9.8/sdf/Element.hh:28,
                 from /usr/include/sdformat-9.8/sdf/Actor.hh:25,
                 from /usr/include/sdformat-9.8/sdf/sdf.hh:2,
                 from /usr/include/gazebo-11/gazebo/common/Battery.hh:25,
                 from /usr/include/gazebo-11/gazebo/common/common.hh:8,
                 from /usr/include/gazebo-11/gazebo/gazebo_core.hh:19,
                 from /usr/include/gazebo-11/gazebo/gazebo.hh:20,
                 from /home/yck/ocs2_fun/src/ocs2_fun/ocs2_gazebo/include/ocs2_gazebo/ContactSensor.h:4,
                 from /home/yck/ocs2_fun/src/ocs2_fun/ocs2_gazebo/src/ContactSensor.cpp:1:
/usr/include/ignition/math6/gz/math/Plane.hh:133:20: error: ‘optional’ in namespace ‘std’ does not name a template type
  133 |       public: std::optional<Vector3<T>> Intersection(
      |                    ^~~~~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/ContactSensor.dir/build.make:63:CMakeFiles/ContactSensor.dir/src/ContactSensor.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:210:CMakeFiles/ContactSensor.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

After reviewing the materials, I have determined that specifying the C++ compilation version 17 is essential. However, even after making this change, I am still unable to compile successfully. Therefore, I would like to seek guidance on how to resolve this issue.

widthstudio commented 5 months ago

hi, the above problem was solved by modifying the configuration in OCS2_CXX_FLAGS. However, when I run roslaunch ocs2_anymal_robot simple_gazebo.launch, the robot model doesn't show up in rviz, and rviz crashes and exits. When I change description_name to ocs2_anymal_description, rviz works but does not display the robot model either.