DRC Vehicle is not moving after giving velocity to wheel joint

asked 2015-06-24 09:34:25 -0500

Rahul Sharma gravatar image


I'm currently working on developing algorithms for path planning on DRC Vehicle. For that I used the existing plugin and did some changes in it. I have been able to control the steering via command SetAngle on steering joint but when I give velocity via SetVelocity to rear wheel joints, the vehicle is stationary.

I have added the following in the existing plugin in Load part

if (!ros::isInitialized())
int argc = 0;
char** argv = NULL;
ros::init(argc, argv, "hello");
 rosnode_ = new ros::NodeHandle( node_namespace_ )
 cmd_vel_sub_ = rosnode_->subscribe("/cmd_vel", 1, &DRCVehiclePlugin::OnCmdVel, this );

And the following I added after the Updates

 void DRCVehiclePlugin::OnCmdVel( const geometry_msgs::TwistConstPtr &msg)
 this->lastTime = this->world->GetSimTime();
 double vr, va;
 vr = msg->linear.x;
 va = msg->angular.z;

this->brWheelJoint->SetVelocity(0, 10);
this->handWheelJoint->SetAngle(0, 2*atan (va*1.88/(sqrt(vr*vr -va*va*.85*.85))));

The handwheel joint is working but the brwheeljoint is not moving. I don't know why this thing is not working, If anyone have solved this sort of problem kindly help me. A little help would be appreciated.

Thank You

edit retag flag offensive close merge delete


Hi, since you're using the DRC Vehicle, why not pass commands to it via a separate script (python/C++) to accelerate/brake/turn? There are pre-defined variables setting the state of the gas pedal, brake pedal and steering wheel, so simply publishing data to these variables should do the job.

karthikj219 gravatar imagekarthikj219 ( 2015-06-25 07:04:05 -0500 )edit
scpeters gravatar imagescpeters ( 2015-06-25 11:13:57 -0500 )edit