How can I navigate the car with Neo 6m gps with my RPI-4 model-B. I'm receiving the data from gps correctly but how can I get the turn angle form gps data to rotate the steering to get the directions. I have placed a dc motor and motor driver on the steering of car to rotate the steering. but I'm unable to find the way how much I have to rotate the motor using that gps data.

Note: The car will run on constant speed and plane road. The purpose is only to auto-steer the car using the gps data

The Component I already have:

  1. Raspberry pi - 4
  2. Dc motor
  3. Motor driver(bts6760)
  4. Ultra sonic distance sensor

Any other component needed for this?


  • 1
    This is typically done by programming an observer which predicts a future position using the current position, speed and steering angle. Then you feed the difference between predicted and wanted position as error and the observer tells you what the steering angle should be. Google "Kalman filter" to get the math background. More to the point, your question is too broad for this Q&A site and is only tangentially related to the Raspberry Pi. Sorry. Mar 10, 2020 at 8:03
  • Hello @Rahul Saini, Welcome and nice and meet you. Let me see. So you are designing a Rpi and GPS based driverless car. Now suppose Rpi "reads" GPS and consults the road map and "thinks" that it should turn left, it just "PWM" the "servo" connected to the "rocker arm" to turn left. It is that simple. References: (1) Serve and Rocker Arm Assembly": imgur.com/7DKWyB1. (2) "Rpi Mars Rover": raspberrypi.stackexchange.com/questions/108873/…. Cheers.
    – tlfong01
    Mar 10, 2020 at 8:41
  • @Rahul Saini, my apologies for not reading your question carefully. I misunderstood that you need a servo to change the car's direction. I agree that both #Dmitry Grigoryev, and #CoderMike are answering in the right direction. Cheers.
    – tlfong01
    Mar 10, 2020 at 12:13
  • Thanks *Dmitry Grigoryev and * tlfong01 for your help. I thing, I have to study more about observers. Mar 11, 2020 at 5:47

1 Answer 1


One method to achieve this is to use the pynmea2 library to parse the GPS position and get the true_course (the direction the car is heading). Then use the pure pursuit algorithm to work which way your car needs to turn to achieve its desired waypoint.


  • Thanks *CoderMike for your suggestion. Mar 11, 2020 at 5:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.