Python Script for servo motors
Posted: Fri Apr 08, 2016 8:57 pm
Hi! I'm a new raspberry pi user, and right now I'm struggling with code for my project. I was hoping to get some answers/inspiration from everyone here.
(Imagine a bike that could drive and steer it self while keeping balance).
The project is to build a monorail robot that can self balance on two wheels, and make 90 degrees turns without deviating from its path which is 5cm. The robot is 1 meter long. The plan is to make it take a 90 degrees turn with servo steering both wheels. And within the path. So basically if the wheels go outside this given path, I failed. Its body is allowed to go outside the path, that isn't as important.
*My question is, is it possible to code the servos to behave as I want? Turning both wheels at the turn, simultaneously OR even with different angles.
-i.e. if its a right turn, wheel_front 60 degrees , wheel_back 90 degrees.
wheel_front 50 degrees , wheel_back 95 degrees.
wheel_front 40 degrees , wheel_back 100 degrees. And so on.
I know these angles do not correspond to the angles of a servo, I'm just using the basic unit circle. ( I do know how to use servos to a certain degree ).
I'm planning to make the turn in sequences and at low velocity, but unfortunately I've hit a big experience barrier I can't overcome , and that is coding, I'm a beginner-ish.
I humbly ask for your opinions & help. If I left out important stuff , you could ask or assume ideal situations.
(Imagine a bike that could drive and steer it self while keeping balance).
The project is to build a monorail robot that can self balance on two wheels, and make 90 degrees turns without deviating from its path which is 5cm. The robot is 1 meter long. The plan is to make it take a 90 degrees turn with servo steering both wheels. And within the path. So basically if the wheels go outside this given path, I failed. Its body is allowed to go outside the path, that isn't as important.
*My question is, is it possible to code the servos to behave as I want? Turning both wheels at the turn, simultaneously OR even with different angles.
-i.e. if its a right turn, wheel_front 60 degrees , wheel_back 90 degrees.
wheel_front 50 degrees , wheel_back 95 degrees.
wheel_front 40 degrees , wheel_back 100 degrees. And so on.
I know these angles do not correspond to the angles of a servo, I'm just using the basic unit circle. ( I do know how to use servos to a certain degree ).
I'm planning to make the turn in sequences and at low velocity, but unfortunately I've hit a big experience barrier I can't overcome , and that is coding, I'm a beginner-ish.
I humbly ask for your opinions & help. If I left out important stuff , you could ask or assume ideal situations.