Home | Tutorials | Wiki | Issues
Ask Your Question
0

Tutorial: Controlling a Mobile Robot with its Range Sensor

asked 2013-04-02 19:16:38 -0500

amit gravatar image

updated 2013-04-02 19:23:38 -0500

Hi,

I tried to implement the tutorial plugin my_plugin_with_sensor.cc (explained here) in the Pioneer robot I am using in my world model. The simulation is not working as expected and mentioned in the tutorial page. The moment I start Gazebo, my robot starts moving back if gain <= 2.0 else starts tumbling and goes crazy and goes out of the solid boundary walls.

What shall I do ?

edit retag flag offensive close merge delete

Comments

can u plz tell me how u solve the problem as i m aslo facing same

suvrat gravatar imagesuvrat ( 2013-07-25 02:24:02 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-30 15:44:07 -0500

suvrat gravatar image

i have solved this problem by little modification in my code if (min_dist < this->laser->GetRangeMax()) {

    **double torque = this->gain *( (min_dist - target_dist)*0.1 );**
printf("torque %lf\n",torque);

    this->leftWheelJoint->SetForce(0, torque);
    this->rightWheelJoint->SetForce(0, torque);
  }

now it is not starts tumbling and goes crazy and goes out of the solid boundary walls.

edit flag offensive delete link more
0

answered 2013-04-11 18:43:27 -0500

Try to print the force applied to robot, if the force was so high perharps this is the problem.

If your robot is moving back, probably the force applied is negative.

double target_dist = 2.0;

 if (min_dist < this->laser->GetRangeMax())
{
     double torque = this->gain*( min_dist - target_dist );
     this->leftWheelJoint->SetForce(0, torque);
     this->rightWheelJoint->SetForce(0, torque);
}

Print the mindist value and targetdist to ensure what values are being used.

edit flag offensive delete link more

Comments

i have tried to print the values they are like mindist 0.081051 targetdist 2.000000 torque -4.029793 .now what should i do ?

suvrat gravatar imagesuvrat ( 2013-07-30 11:03:36 -0500 )edit
0

answered 2013-04-24 16:48:35 -0500

nkoenig gravatar image

The tutorial that you point to is for demonstration purposes only. The code applies an additive force to the robot, which is not what you want to do when controlling the robot. Instead you should use a velocity PID controller.

edit flag offensive delete link more

Comments

i m a beginner in gazebo could you please tell ma or give me some link how to apply PID controller.

suvrat gravatar imagesuvrat ( 2013-07-30 11:06:06 -0500 )edit
Login/Signup to Answer

Question Tools

3 followers

Stats

Asked: 2013-04-02 19:16:38 -0500

Seen: 765 times

Last updated: Jul 30 '13