joschu / trajopt

Trajectory Optimization
http://rll.berkeley.edu/trajopt
Other
383 stars 160 forks source link

Make bool conversion explicit #42

Open mfinean opened 4 years ago

mfinean commented 4 years ago

Error: cpp:543:65: error: cannot convert ‘OpenRAVE::UserDataPtr {aka boost::shared_ptr}’ to ‘bool’ in initialization

Line: https://github.com/joschu/trajopt/blob/9c634c060f7e2d61c4a888b0a5700d668a5d16f8/src/trajopt/bullet_collision_checker.cpp#L543

Fix: bool useTrimesh = bool(trajopt::GetUserData(*body, "bt_use_trimesh"));

QAbot-zh commented 4 years ago

Thank you so much! I got the same problem And your solution works.

QAbot-zh commented 4 years ago

@mfinean Do you meet the problem as below?

In file included from /home/zxy/learning-code/trajopt-lfd/src/cloudproc/mesh_simplification.cpp:8:0:
/home/zxy/learning-code/trajopt-lfd/src/cloudproc/vtkQuadricDecimation2.h:64:49: error: expected initializer before ‘:’ token
 class VTK_GRAPHICS_EXPORT vtkQuadricDecimation2 : public vtkPolyDataAlgorithm
                                                 ^
In file included from /usr/include/boost/type_traits/has_operator.hpp:30:0,
                 from /usr/include/boost/type_traits.hpp:35,
                 from /usr/include/pcl-1.7/pcl/register_point_struct.h:65,
                 from /usr/include/pcl-1.7/pcl/point_types.h:44,
                 from /home/zxy/learning-code/trajopt-lfd/src/cloudproc/mesh_simplification.cpp:10:
/usr/include/boost/type_traits/has_logical_not.hpp:13:28: error: expected declaration before end of line
src/cloudproc/CMakeFiles/cloudproc.dir/build.make:110: recipe for target 'src/cloudproc/CMakeFiles/cloudproc.dir/mesh_simplification.cpp.o' failed
make[2]: *** [src/cloudproc/CMakeFiles/cloudproc.dir/mesh_simplification.cpp.o] Error 1
CMakeFiles/Makefile2:793: recipe for target 'src/cloudproc/CMakeFiles/cloudproc.dir/all' failed
make[1]: *** [src/cloudproc/CMakeFiles/cloudproc.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

why the boost library will get the error?