Help with steering

Hi!I'm working on a custom autopilot, and as a first step I'm using a wheeled platform that is supposed to navigate to waypoints. I have written code for navigation and I use only a GPS as a sensor at the moment. I tested my setup today and the robot navigates to the desired waypoint, but on it's way there, it moves in 8's before circuling around the waypoint.The rover has 4 wheels, and two motors (one for each side). Now my question is: Should a GPS be enough for this kind of application or am I in of a compass to take care of the navigation between the GPS data (1Hz).My algorithm looks like this (extracted only the navigation-part1. PIC parses lat,long, true heading data2. Calculates bearing to the waypoint3. Calculates the error = bearing - true heading ,4. Calls the following function which is my attempt to the "P" in "P.I.D"void steer(long error){long motor1, motor2;motor1 = cruisingSpeed + error; // add the error to motor1motor2 = cruisingSpeed - error; // and subtract the error from motor2 to make a turnif(motor1if(motor1>motorMax) motor1=motorMax; if(motor2if(motor2>motorMax) motor2=motorMax; CCPR1L = motor1; // change the pwm dutycycle for motor1CCPR2L = motor2; // change the pwm dutycycle for motor2} I have tested the navigation algorithm manually by bicykling to a waypoint and that works good. So I figured my steeringfunction has to be improved..Does anybody have some suggestion on improvement and is it enough with a GPS receiver for a robot that travels at fast-walkingspeed? I know that GPS:s give different locations around a center when standing still so that may cause some trouble since the robot isn't moving very fast..  Thankful for your input! regards / Christian

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • The "figure eight" path is one that I have seen a lot, especially the first time someone takes their rover outside for a test.  There are a few things that can cause it.  You might want to test your heading error calculation on paper to make sure it behaves the way you want it to when your vehicle needs to steer through North.  In other words, make sure you calculate a 10 deg left turn instead of a 350 deg right turn.  You could also try a really weak gain for your steering and see if that helps you debug the behavior. 

    I would recommend keeping manual control of the steering for a test where you connect your autopilot's steering signal to a plain servo that has a piece of paper attached to it indicating left/straight/right and watching this servo while you drive the car around and create different test cases for your code.  If it is always max left or max right or doesn't reverse direction when it should, you have a place to start debugging... Good luck!

  • Admin

    Christian,

    A four wheel rover usually moves too slowly to receive accurate GPS data.

    You might want to add a compass to your mix.

    The GPS would show the desired heading to the waypoint while the compass would show the present heading.

    If you do a search of web, you can find example programs that use both GPS and a compass to guide a rover between waypoints.

    Just a thought.

    Regards,

    TCIII

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…