Pathfinding

Requests regarding how to set up experiments in ARGoS.
squiddon
Posts: 12
Joined: Mon Sep 15, 2014 10:25 am

Pathfinding

Postby squiddon » Wed Sep 17, 2014 11:09 pm

Are there any pathfinding implementations (dijkstra, A*, etc) for ARGoS or shall I write my own?

Any code I'll produce I'll put on Github/BitBucket when I've completed my project.

Nick

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Pathfinding

Postby pincy » Wed Sep 17, 2014 11:14 pm

Hi Nick,

I don't have any ready-made implementation, but if you feel like contributing your own, go ahead! That would be really nice :-)

Cheers,
Carlo
I made ARGoS.

squiddon
Posts: 12
Joined: Mon Sep 15, 2014 10:25 am

Re: Pathfinding

Postby squiddon » Fri Oct 10, 2014 11:01 am

Will do :)

squiddon
Posts: 12
Joined: Mon Sep 15, 2014 10:25 am

Re: Pathfinding

Postby squiddon » Fri Nov 21, 2014 4:44 pm

Hi,

I ended up using boost's graph and astar implementation in the end (not enough time to implement my own, although I'd like to as a programming challenge).

However, I seem to be having troubles with my robot's movement towards a specified point. This is more than likely and issue with my own maths but was wondering if you might be able to help.

Here's the function: https://gist.github.com/squiddon/ab9aab96e812421687dc

When robot starts at origin and the goal point is directly behind it the robot does a little shuffle (alternating velocity to left and right wheels) motion forward and never turns around. Wondering if you've encountered this behaviour before?

Nick

squiddon
Posts: 12
Joined: Mon Sep 15, 2014 10:25 am

Re: Pathfinding

Postby squiddon » Fri Nov 21, 2014 5:04 pm

I think I've cracked it already, needed to play about with the min/max angle range.

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Pathfinding

Postby pincy » Fri Nov 21, 2014 5:08 pm

If I understood correctly, you want to go to a specific point in the environment stored in the variable m_sCurrentGoal.

The untested code, just out of my head, could be:

Code: Select all

void CSingleRobot::SetWheelSpeeds(const CCI_PositioningSensor::SReading& s_me_inworld, const CVector2& c_target_inworld) { // Get my rotation in the world CRadians cZAngle, cYAngle, cXAngle; s_me_inworld.Orientation.ToEulerAngles(cZAngle, cYAngle, cXAngle); // Get position of target wrt robot CVector2 cMeToTarget( c_target_inworld.GetX() - s_me_inworld.Position.GetX(), c_target_inworld.GetY() - s_me_inworld.Position.GetY()); cMeToTarget.Rotate(-cZAngle); // Get direction angle CRadians cAngle = cMeToTarget.Angle(); // Set wheel speed depending on angle if(m_cGoStraightAngleRange.WithinMinBoundIncludedMaxBoundIncluded(cAngle)) { // straight m_pcWheels->SetLinearVelocity(m_fWheelVelocity, m_fWheelVelocity); } else { if(cAngle.GetValue() >= 0.0) { // go left m_pcWheels->SetLinearVelocity(0.0, m_fWheelVelocity); } else { // go right m_pcWheels->SetLinearVelocity(m_fWheelVelocity, 0.0); } } }
I made ARGoS.

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Pathfinding

Postby pincy » Fri Nov 21, 2014 5:09 pm

NOTE: Your original code has a bug in wheel actuation (you rotate left when you should rotate right, and viceversa).
I made ARGoS.

squiddon
Posts: 12
Joined: Mon Sep 15, 2014 10:25 am

Re: Pathfinding

Postby squiddon » Fri Nov 21, 2014 7:58 pm

Good spot, although the behaviour seemed to work my end. My maths were definitely wrong.

Your function works perfectly, thanks very much :)

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Pathfinding

Postby pincy » Fri Nov 21, 2014 8:16 pm

Cool! :mrgreen:
I made ARGoS.

Waqar731
Posts: 65
Joined: Thu Oct 23, 2014 12:33 pm
Location: Pakistan
Contact:

Unable to Increase length of Proximity sensor rays in Argos

Postby Waqar731 » Fri Nov 21, 2014 8:42 pm

Hello!
I am trying to increase the length of rays shot by proximity sensor using Argos 2 Simulator.
Special thanks to all of you.
Waqar Hussain


Return to “How to... ?”