-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1/3 Scale Car - write firmware for motors #11
Comments
Status: In progress-Researching on the docyke servo motor and how to program it to an arduino |
09/09/2024 Update:
|
09/16/2024 Update:
|
|
Just some thoughts to answer your questions here:
|
Status: Got the servo motor to work in Arduino IDE by using the map function to map different reference values for both brake and steering |
#include <Servo.h> //CODE FOR STEERING const int leftTurn = -24; //left angle void setup() { void loop() { float referenceVal = -1; // map the reference value (-1) to the angle range (-24 to 24 degrees) //Syntax of map function: // shift the servo to the calculated angle myServo.write(defaultPos); //map new input of 1 // Move to the mapped angle (shifted by the default position) // Return to the default position (90 degrees) } |
#include <Servo.h> Servo brakeServo; void setup() { //Serial.begin(9600); //serial communicaiton from ROS brakeServo.attach(servoPin); void loop() float referenceVal = 0.25; // shift the servo to the calculated angle brakeServo.write(noBrake); //go back to initial //try new input // shift the servo to the calculated angle brakeServo.write(noBrake); //go back to initial //try new input // shift the servo to the calculated angle brakeServo.write(noBrake); //go back to initial } |
Status: in progress |
Two identical motors are used to steer and apply the brake on the 1/3 scale car. There is an arduino that needs to be programmed with the logic to turn the motors to achieve these goals. Basic motor control has been tested, but now we need code that turns the motor to apply the brake to a set "value" (0-1) and code that turns the motor to steer the vehicle to a desired turn angle (-X degrees to X degrees).
The text was updated successfully, but these errors were encountered: