gazebo7---->gazebo9代码迁移

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.

 234public:
   double getLeftJointPosition()
   {
     return left_wheel_joint_->GetAngleCount();
   }
 
  public:
   double getRightJointPosition()
   {
     return right_wheel_joint_->GetAngleCount();
244}
  • 3
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值