Our rules are not developed enough to cover that case well. Informally, the robot needs to generally be following the path of the line. It would be nice if we could develop objective criteria for "following the line" that still allows the behavior you are describing.
The motor driver library functions aren't the right place to look. You are on the right track by controlling the motor speed based on the position. What you are doing is called proportional feedback control. You can smooth it out by using PID control. You can learn the basics here https://www.youtube.com/watch?v=UR0hOmjaHp0&list=PLUMWjy5jgHK20UW0yM22HYEUTMJfla7Mb and then write some code for it. You might be able to adapt the 3pi line-following code here https://www.pololu.com/docs/0J21/7.c to fit your application. For additional questions, we hope you'll post on our forum, where your questions will have more visibility.
That's exciting that you are trying to make this project! I hope you are in a timezone where you can still celebrate Halloween with your skeleton, if you get it working.
The servo should be on channel zero. One analog sensor should be on channel 1 and one on channel 2.
Which channel the analog signals are on definitely matters. If it is not going in the correct direction, with power off, you can try swapping which analog signal is on channel 1 and 2.
The code is checking for a difference between the two analog sensors. If the difference is greater than 140 it moves one way; if it is less than -140 it moves the other way.
David's line following robot that learns the course
- 4 May 2015Hi, Dan.
Our rules are not developed enough to cover that case well. Informally, the robot needs to generally be following the path of the line. It would be nice if we could develop objective criteria for "following the line" that still allows the behavior you are describing.
Ryan
New revision of the Dual VNH5019 motor driver shield for Arduino
- 30 January 2015Hi, Sina.
The motor driver library functions aren't the right place to look. You are on the right track by controlling the motor speed based on the position. What you are doing is called proportional feedback control. You can smooth it out by using PID control. You can learn the basics here https://www.youtube.com/watch?v=UR0hOmjaHp0&list=PLUMWjy5jgHK20UW0yM22HYEUTMJfla7Mb and then write some code for it. You might be able to adapt the 3pi line-following code here https://www.pololu.com/docs/0J21/7.c to fit your application. For additional questions, we hope you'll post on our forum, where your questions will have more visibility.
Ryan
Pololu and LVBots CES Open House 2015
- 23 January 2015Mike Szczys from Hackaday posted about the Open House: http://hackaday.com/2015/01/23/lvbots-ces-open-house-tabletop-challenge-and-clothes-bot/
Motion tracking skull Halloween prop
- 31 October 2014Hi, Ken.
That's exciting that you are trying to make this project! I hope you are in a timezone where you can still celebrate Halloween with your skeleton, if you get it working.
The servo should be on channel zero. One analog sensor should be on channel 1 and one on channel 2.
Which channel the analog signals are on definitely matters. If it is not going in the correct direction, with power off, you can try swapping which analog signal is on channel 1 and 2.
The code is checking for a difference between the two analog sensors. If the difference is greater than 140 it moves one way; if it is less than -140 it moves the other way.
Ryan