UR5-grasp-and-kinect-demo-on-gazebo/src/UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/src/mimic_joint_plugin.cpp
gazebo7---->gazebo9
/usr/include/gazebo-9/gazebo/physics/World.hh:351:20: note: candidate: void gazebo::physics::World::SetPhysicsEnabled(bool)
public: void SetPhysicsEnabled(const bool _enable);
^~~~~~~~~~~~~~~~~
/usr/include/gazebo-9/gazebo/physics/World.hh:351:20: note: candidate expects 1 argument, 0 provided
/home/guocheng/UR5-grasp-and-kinect-demo-on-gazebo/src/UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/src/mimic_joint_plugin.cpp:155:38: error: request for member ‘Radian’ in ‘((gazebo::MimicJointPlugin*)this)->gazebo::MimicJointPlugin::joint_.boost::shared_ptr<gazebo::physics::Joint>::operator->()->gazebo::physics::Joint::GetForce(0)’, which is of non-class type ‘double’
double angle = joint_->GetForce(0).Radian()*multiplier_+offset_;
^~~~~~
/home/guocheng/UR5-grasp-and-kinect-demo-on-gazebo/src/UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/src/mimic_joint_plugin.cpp:157:42: error: request for member ‘Radian’ in ‘((gazebo::MimicJointPlugin*)this)->gazebo::MimicJointPlugin::mimic_joint_.boost::shared_ptr<gazebo::physics::Joint>::operator->()->gazebo::physics::Joint::GetForce(0)’, which is of non-class type ‘double’
if(abs(angle-mimic_joint_->GetForce(0).Radian())>=sensitiveness_)
^~~~~~
/home/guocheng/UR5-grasp-and-kinect-demo-on-gazebo/src/UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/src/mimic_joint_plugin.cpp:161:44: error: request for member ‘Radian’ in ‘((gazebo::MimicJointPlugin*)this)->gazebo::MimicJointPlugin::mimic_joint_.boost::shared_ptr<gazebo::physics::Joint>::operator->()->gazebo::physics::Joint::GetForce(0)’, which is of non-class type ‘double’
double a = mimic_joint_->GetForce(0).Radian();
^~~~~~
/home/guocheng/UR5-grasp-and-kinect-demo-on-gazebo/src/UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/src/mimic_joint_plugin.cpp:165:31: error: ‘gazebo::math’ has not been declared
double effort = gazebo::math::clamp(pid_.computeCommand(error, period), -max_effort_, max_effort_);
^~~~
UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/CMakeFiles/roboticsgroup_gazebo_mimic_joint_plugin.dir/build.make:62: recipe for target 'UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/CMakeFiles/roboticsgroup_gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o' failed
make[2]: *** [UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/CMakeFiles/roboticsgroup_gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o] Error 1
CMakeFiles/Makefile2:17976: recipe for target 'UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/CMakeFiles/roboticsgroup_gazebo_mimic_joint_plugin.dir/all' failed
make[1]: *** [UR_with_Robotiq_grasp_gazebo/ur_tc/robotiq_85_gripper/robotiq_85_simulation/roboticsgroup_gazebo_plugins/CMakeFiles/roboticsgroup_gazebo_mimic_joint_plugin.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed
1.
I had the same problem, you can fix it by replacing the folowing:
event::Events::DisconnectWorldUpdateBegin(this->updateConnection);
to
this->updateConnection.reset();
GetPhysicsEngine()->
to
Physics()
GetAngle(0).Radian();
to
Position ( 0 )
gazebo::math::clamp
to
ignition::math::clamp
it should work fine
2.
二、错误原因
在类gazebo::physics::Joint中找不到成员函数GetAngle,导致/home/chan/turtlebot3_gazebo_plugin/src/turtlebot3.cc编译失败
三、解决方法
/usr/include/gazebo-9/gazebo/physics下找到Joint.hh,添加以下头文件和成员函数:
//头文件
#include <ignition/math/Angle.hh>
//成员函数
public: virtual unsigned int GetAngleCount() const;
/// \brief Get the joint position.
///
/// For rotational axes, the value is in radians. For prismatic axes,
/// it is in meters.
///
/// It returns ignition::math::NAN_D in case the position can't be
/// obtained. For instance, if the index is invalid.
///
/// \param[in] _index Index of the axis, defaults to 0.
/// \return Position of the axis.
234:public:
double getLeftJointPosition()
{
return left_wheel_joint_->GetAngleCount();
}
public:
double getRightJointPosition()
{
return right_wheel_joint_->GetAngleCount();
244: }