Gazebo crashing when setting VelocityTarget with joint controller

asked 2021-07-18 06:23:20 -0500

Juleslcmt gravatar image

Hello, I want to use JointController with PID to make my wheels moving realistically with forces. My code is working when using the usual joint motors, just like in the tutorial :

  this->model->GetJoint("orange_joint")->SetParam("fmax", 0, 100.0);
  this->model->GetJoint("orange_joint")->SetParam("vel", 0, 1.0);

But I want to use jointcontrollers as the speed is not continuous with this method. When I am trying with the jointcontroller :

this->driving_joint_controller = this->parent->GetJointController();
this->joint_name = this->driving_joint->GetScopedName();
this->driving_joint_controller->SetVelocityPID(this->joint_name, common::PID(100.0, 0.0, 0.0));

and in my update function :

double driving_joint_speed =
    this->target_drive_state.speed / this->wheel_radius;
this->driving_joint_controller->SetVelocityTarget(this->joint_name, driving_joint_speed); 

It is crashing with this message :

gzclient: /build/ogre-1.9-kiU5_5/ogre-1.9-1.9.0+dfsg1/OgreMain/include/OgreAxisAlignedBox.h:251: void Ogre::AxisAlignedBox::setExtents(const Ogre::Vector3&, const Ogre::Vector3&): Assertion `(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"' failed.

I don't know how it is related, and it appears that the crash occurs only when the line this->driving_joint_controller->SetVelocityTarget(this->joint_name, driving_joint_speed); is in the code. Can you please help me with this ?

edit retag flag offensive close merge delete