beltransen / velo2cam_gazebo

Repository including Gazebo models, plugins and worlds to test calibration algorithms for Lidar-camera setups.
http://wiki.ros.org/velo2cam_gazebo
GNU General Public License v2.0
141 stars 41 forks source link

class gazebo::physics::World’ has no member named ‘GetSimTime’ #16

Closed linClubs closed 1 month ago

beltransen commented 1 year ago

Please, provide details of the error you are experiencing and the versions of the software (e.g. ROS, Gazebo) you are using so that we are able to understand what's going on.

linClubs commented 1 year ago

Hello,thank your answer. i run catkin_make error. My versions of the software ros:noetic ,Gazebo version 11.11.0 and ros:melodic,Gazebo version 9.0.0,both versions is the same error.

Consolidate compiler generated dependencies of target gazebo_ros_velodyne_laser [ 50%] Building CXX object velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/CMakeFiles/gazebo_ros_velodyne_laser.dir/src/GazeboRosVelodyneLaser.cpp.o /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp: In member function ‘void gazebo::GazeboRosVelodyneLaser::putLaserData(gazebo::common::Time&)’: /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:240:3: error: ‘math’ has not been declared 240 | math::Angle maxAngle = parent_raysensor->AngleMax(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:241:3: error: ‘math’ has not been declared 241 | math::Angle minAngle = parent_raysensor->AngleMin(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:251:3: error: ‘math’ has not been declared 251 | math::Angle verticalMaxAngle = parent_raysensor->VerticalAngleMax(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:252:3: error: ‘math’ has not been declared 252 | math::Angle verticalMinAngle = parent_raysensor->VerticalAngleMin(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:269:18: error: ‘maxAngle’ was not declared in this scope 269 | double yDiff = maxAngle.Radian() - minAngle.Radian(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:269:38: error: ‘minAngle’ was not declared in this scope 269 | double yDiff = maxAngle.Radian() - minAngle.Radian(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:270:18: error: ‘verticalMaxAngle’ was not declared in this scope 270 | double pDiff = verticalMaxAngle.Radian() - verticalMinAngle.Radian(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:270:46: error: ‘verticalMinAngle’ was not declared in this scope 270 | double pDiff = verticalMaxAngle.Radian() - verticalMinAngle.Radian(); | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp: In member function ‘void gazebo::GazeboRosVelodyneLaser::onStats(const boost::shared_ptr&)’: /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:425:3: error: ‘math’ has not been declared 425 | math::Pose pose; | ^~~~ /home/lin/ros_code/test_ws/src/velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/src/GazeboRosVelodyneLaser.cpp:426:3: error: ‘pose’ was not declared in this scope 426 | pose.pos.x = 0.5sin(0.01simtime.Double()); | ^~~~ make[2]: [velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/CMakeFiles/gazebo_ros_velodyne_laser.dir/build.make:76: velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/CMakeFiles/gazebo_ros_velodyne_laser.dir/src/GazeboRosVelodyneLaser.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:500: velo2cam_gazebo/gazebo_plugins/velodyne_gazebo_plugin/CMakeFiles/gazebo_ros_velodyne_laser.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 Invoking "make -j20 -l20" failed

beltransen commented 1 year ago

Please check #13. I think you are facing the same issue.

oscarkfpang commented 5 months ago

I managed to compile it successfully based on the suggestion and the forum in the reply

Please check #13. I think you are facing the same issue.

My environment is ROS melodic with Gazebo 9. I made the following changes:

add this #include <ignition/math/Vector3.hh>

change any math to ignition::math as in this example (about line 239-240, and other similar places in the file) ignition::math::Angle maxAngle = parent_ray_sensor_->AngleMax();

change the last function at the end of the file to this: ignition::math::Pose3d pose; pose.Pos().X() = 0.5*sin(0.01*sim_time_.Double()); gzdbg << "plugin simTime [" << sim_time_.Double() << "] update pose [" << pose.Pos().X() << "]\n";

beltransen commented 1 month ago

Thank you @oscarkfpang for sharing your experience. It may be useful for other users.