Gazebo | Ignition | Community
Ask Your Question
0

How to stop the polaris_ranger immediately?

asked 2014-11-20 07:34:15 -0600

anonymous gravatar image

updated 2014-11-20 07:34:42 -0600

How can I stop the polaris_ranger immediately ,so that when it detects the object it should stop. can anyone plz suggest . Thanks!

edit retag flag offensive close merge delete

Comments

Can you add some more detail to your question? Please include how you are controlling the polaris, and how it is detecting an object?

nkoenig gravatar imagenkoenig ( 2014-11-24 15:55:25 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
1

answered 2014-12-01 12:00:52 -0600

nkoenig gravatar image

Here is code that can control the polaris ranger. Please refer to the aforementioned for moving and stopping the polaris.

edit flag offensive delete link more

Comments

ohk .. Thanks a lot.

anonymous gravatar imageanonymous ( 2014-12-01 23:12:18 -0600 )edit
0

answered 2014-11-25 09:51:11 -0600

nkoenig gravatar image

Take a look at this example vehicle control plugin. It should have a good solution for you.

edit flag offensive delete link more

Comments

Hi, Thanks for the tutorial. It helped me a lot but still now the problem has not been resolved , it stops the polaris immediately when obstacle is detected but when i remove the obstacle and give it negative force it doesnt move reverse. And also sometimes it is changing the steering angle hence the polaris stops with tiltd tires , which is I thnk wrong. plz suggest what should i do . Thanks!

anonymous gravatar imageanonymous ( 2014-11-26 03:13:19 -0600 )edit

You'll have to control the angle of the front wheels, in addition to the rotational velocity. I think the two steering joints are front_left_steering_joint and front_right_steering_joint.

nkoenig gravatar imagenkoenig ( 2014-11-26 10:46:34 -0600 )edit

Hi, Here in my code joint1 is frontleftwheel and joint2 is frontrightwheel. I am able to control the steering joints angle as in if suppose I am giving 45 degrees angle then it will move 45 degrees,. But I am not able to understand controlling the angle of front wheels. can you please give some guidance realted to it. If you want I can mail you my whole code . Thanks!

anonymous gravatar imageanonymous ( 2014-11-27 06:47:04 -0600 )edit

I just want it to be lyk a real simulation, that when it detects it should apply brake and stops , and then it should take a reverse and then decide the direction accordingly whether to move right or left. By using vehicle control plugin I am able to stop the vehicle because of wheel angle but I am not able to take reverse when key2 is pressed.

anonymous gravatar imageanonymous ( 2014-11-27 06:51:08 -0600 )edit
0

answered 2014-11-24 23:28:50 -0600

anonymous gravatar image

updated 2014-11-25 05:20:45 -0600

Hi, I am using hukuyo sensor on polaris and I am using Tutorials/1.2/control robot/mobile base laser. The code is given below

public: void OnUpdate()

{

if(key is pressed)

{

joint1->SetForce(0,15);

joint2->SetForce(0,15);

}

unsigned int n = this->laser->GetRangeCount();

double min_dist = 1e6;

for(unsigned int i = 0; i < n; i++)

      {

        if(this->sicksensor->GetRange(i) < min_dist)

          min_dist = this->sicksensor->GetRange(i);
      }

      if(min_dist < this->sicksensor->GetRangeMax())
      {
        printf("obstacle is detected");
        this->joint1->SetForce(0,0);
        this->joint2->SetForce(0,0);
      }

}

whenever the obstacle is placed it is printing obstacle is detected but it is not setting the force 0. I also tried giving it reverse force then set to 0 , but then also it is not working.It is going in reverse direction but not stoping .

        this->joint1->SetForce(0,-20);
        this->joint2->SetForce(0,-20);
        this->joint1->SetForce(0,0);
        this->joint2->SetForce(0,0);

I want that when it detects the object it should stop at certain distance and hukuyo range is 10. Please help .Basically how can we apply brake on polaris. i think brake is not working of Polaris ranger. Thanks!

edit flag offensive delete link more
0

answered 2014-11-26 03:18:42 -0600

anonymous gravatar image

here is my code:

int min_dist = 1e6;

if(key1 pressed)

       {
           joint1->SetForce(0,15);
           joint2->SetForce(0,15);
        }

        else if(key2 pressed)
        {
            joint1->SetForce(0,-40);
            joint2->SetForce(0,-40);
        }

         for(unsigned int i = 0; i < n; i++)
            {
              if(this->sicksensor->GetRange(i) < min_dist)
                min_dist = this->sicksensor->GetRange(i);

            }

            if(min_dist < this->sicksensor->GetRangeMax())
            {
              printf("object is detected");
              double velocity=this->joint1->GetForce(0);
              int t=1;
              double acceleration=(velocity/t);
              double target_dist=((velocity*velocity)/(2*acceleration));

              if(min_dist<=target_dist)
              {

double steeringRange=this->steeringjoint->GetHighStop(0).Radian()-this->steeringjoint->GetLowStop(0).Radian();

                  double steeringRatio= steeringRange / tireAngleRange;

                  double steeringAngle=this->steering_joint->GetAngle(0).Radian();

                  double wheelAngle=steeringAngle/steeringRatio;


                  this->joint1->SetLowStop(0,wheelAngle);
                  this->joint1->SetHighStop(0,wheelAngle);
                  this->joint1->SetLowStop(0,wheelAngle);
                  this->joint1->SetHighStop(0,wheelAngle);

                  this->joint2->SetHighStop(0,wheelAngle);
                  this->joint2->SetLowStop(0,wheelAngle);
                  this->joint2->SetHighStop(0,wheelAngle);
                  this->joint2->SetLowStop(0,wheelAngle);

              }
            }
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-11-20 07:34:15 -0600

Seen: 882 times

Last updated: Dec 01 '14