How to stop the polaris_ranger immediately?
How can I stop the polaris_ranger immediately ,so that when it detects the object it should stop. can anyone plz suggest . Thanks!
How can I stop the polaris_ranger immediately ,so that when it detects the object it should stop. can anyone plz suggest . Thanks!
Here is code that can control the polaris ranger. Please refer to the aforementioned for moving and stopping the polaris.
Take a look at this example vehicle control plugin. It should have a good solution for you.
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!
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!
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.
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!
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);
}
}
Asked: 2014-11-20 07:34:15 -0600
Seen: 882 times
Last updated: Dec 01 '14
Can you add some more detail to your question? Please include how you are controlling the polaris, and how it is detecting an object?