How to fixed this problem when run the sitl


I am trying to run the fixed wing UAV SITL in gazebo and use this command: make px4_sitl gazebo_plane

However, I meet this problem.

[44/56] Linking CXX shared library
[45/56] Building CXX object CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o
[46/56] Building CXX object CMakeFiles/gazebo_vision_plugin.dir/src/gazebo_vision_plugin.cpp.o
[47/56] Building CXX object CMakeFiles/gazebo_controller_interface.dir/src/gazebo_controller_interface.cpp.o
[48/56] Linking CXX shared library
[49/56] Building CXX object CMakeFiles/gazebo_lidar_plugin.dir/src/gazebo_lidar_plugin.cpp.o
[50/56] Building CXX object CMakeFiles/gazebo_opticalflow_plugin.dir/src/gazebo_opticalflow_plugin.cpp.o
FAILED: CMakeFiles/gazebo_opticalflow_plugin.dir/src/gazebo_opticalflow_plugin.cpp.o
/usr/bin/c++ -DLIBBULLET_VERSION=2.87 -DLIBBULLET_VERSION_GT_282 -Dgazebo_opticalflow_plugin_EXPORTS -isystem /usr/include/gazebo-9 -isystem /usr/include/bullet -isystem /usr/include/simbody -isystem /usr/include/sdformat-6.2 -isystem /usr/include/ignition/math4 -isystem /usr/include/OGRE -isystem /usr/include/OGRE/Terrain -isystem /usr/include/OGRE/Paging -isystem /usr/include/ignition/transport4 -isystem /usr/include/ignition/msgs1 -isystem /usr/include/ignition/common1 -isystem /usr/include/ignition/fuel_tools1 -I/home/wangximan/Firmware/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-9/gazebo/msgs -I/home/wangximan/Firmware/mavlink/include -I/usr/include/Paging -isystem /usr/include/opencv -I/home/wangximan/Firmware/Tools/sitl_gazebo/external/OpticalFlow/include -isystem /usr/include/uuid -isystem /usr/include/x86_64-linux-gnu -I/home/wangximan/Firmware/Tools/sitl_gazebo/external/OpticalFlow/external/klt_feature_tracker/include -Wno-deprecated-declarations -fPIC -I/usr/include/uuid -I/usr/include/x86_64-linux-gnu -std=gnu++1z -MD -MT CMakeFiles/gazebo_opticalflow_plugin.dir/src/gazebo_opticalflow_plugin.cpp.o -MF CMakeFiles/gazebo_opticalflow_plugin.dir/src/gazebo_opticalflow_plugin.cpp.o.d -o CMakeFiles/gazebo_opticalflow_plugin.dir/src/gazebo_opticalflow_plugin.cpp.o -c /home/wangximan/Firmware/Tools/sitl_gazebo/src/gazebo_opticalflow_plugin.cpp
In file included from /home/wangximan/Firmware/Tools/sitl_gazebo/src/gazebo_opticalflow_plugin.cpp:24:0:
/home/wangximan/Firmware/Tools/sitl_gazebo/src/gazebo_opticalflow_plugin.cpp: In member function ‘virtual void gazebo::OpticalFlowPlugin::Load(gazebo::sensors::SensorPtr, sdf::ElementPtr)’:
/home/wangximan/Firmware/Tools/sitl_gazebo/include/gazebo_opticalflow_plugin.h:43:18: error: ‘TRUE’ was not declared in this scope
/home/wangximan/Firmware/Tools/sitl_gazebo/include/gazebo_opticalflow_plugin.h:43:18: note: in definition of macro ‘HAS_GYRO’
[51/56] Linking CXX shared library
[52/56] Linking CXX shared library
[53/56] Linking CXX shared library
[54/56] Building CXX object CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o
ninja: build stopped: subcommand failed.
ninja: build stopped: subcommand failed.
Makefile:200: recipe for target ‘px4_sitl’ failed

Could you please tell me how to fixed it?

Thank you!

1 Like

@JulianOes Maybe you could help us. If I modify TRUE to true, it can be compiled. However, I think this is not a good way to solve it. Is that because the plugin is installed incomplete?

1 Like

@JefferWang I ran into the same issue. Modifying TRUE to true resolved it for me as well. IIRC C++ bool is case sensitive? So this was maybe a syntax error?

Per, the bug’s been fixed and updating the repo should resolve the issue.

Thanks for your information!

Did you manage to solve this issue?
I get the same error on stable branch.

@iftahnaf Please see the fix above. What is the stable branch?

I tried to update the repositories and it’s still doesn’t work.
I’m on release/1.10 branch.

@iftahnaf Have you tried manually fixing it as mentioned here?

Thanks for the help,
Ill try to fix it manually and update here if it works.

So in the gazebo_opticalflow_plugin.h I edit the #define HAS_GYRO true -->#define HAS_GYRO 1
now it works.
Thanks again!