USMA Jumping Agile Ground Robot

Dependencies:   mbed Servo PPM_USMA UM7_USMA CAN_FIFO_USMA Roboteq_CANOpen_USMA

Committer:
joshlhsoj1
Date:
Wed Nov 06 02:25:59 2019 +0000
Revision:
7:8605925653cb
Parent:
6:b1d81a112343
Child:
11:799693c71751
Added preliminary CAN support (Not working yet) and cleaned up tests

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DGonz 1:2aecd43e9e7b 1 /*
DGonz 1:2aecd43e9e7b 2 JAGBot main program
DGonz 1:2aecd43e9e7b 3 USMA Jumping Agile Ground Robot
DGonz 1:2aecd43e9e7b 4 Fall 2019
agentarod23 0:4c71421f2822 5
DGonz 1:2aecd43e9e7b 6 Authors:
DGonz 1:2aecd43e9e7b 7 Dr. Daniel J. Gonzalez - daniel.gonzalez@westpoint.edu
DGonz 1:2aecd43e9e7b 8 CDT Andy Rodriguez - andres.rodriguez@westpont.edu
DGonz 1:2aecd43e9e7b 9 CDT Josh Loyd - joshua.loyd@westpoint.edu
DGonz 1:2aecd43e9e7b 10 */
DGonz 1:2aecd43e9e7b 11 #include "main.h"
agentarod23 0:4c71421f2822 12
agentarod23 4:1efc88189b46 13 void Servo() {
agentarod23 5:e480cc23ad42 14 float myRange = .000675;
agentarod23 6:b1d81a112343 15 float myDegrees = 90;
agentarod23 3:be7e8f2ca326 16 myservo1.calibrate(myRange, myDegrees);
agentarod23 3:be7e8f2ca326 17 myservo2.calibrate(myRange, myDegrees);
agentarod23 3:be7e8f2ca326 18 myservo3.calibrate(myRange, myDegrees);
agentarod23 3:be7e8f2ca326 19 myservo4.calibrate(myRange, myDegrees);
agentarod23 3:be7e8f2ca326 20 }
agentarod23 3:be7e8f2ca326 21
DGonz 1:2aecd43e9e7b 22 int main() {
joshlhsoj1 7:8605925653cb 23 if (CANTEST){
joshlhsoj1 7:8605925653cb 24 CANTest();
joshlhsoj1 7:8605925653cb 25 }else if(SERVOTEST){
joshlhsoj1 7:8605925653cb 26 calibMain();
joshlhsoj1 7:8605925653cb 27 }else{
joshlhsoj1 7:8605925653cb 28 while(true){
joshlhsoj1 7:8605925653cb 29 for(double p=0; p<=1.0; p += 0.001) {
joshlhsoj1 7:8605925653cb 30 myservo1.write(p);
joshlhsoj1 7:8605925653cb 31 // wait(0.1);
joshlhsoj1 7:8605925653cb 32 myservo2.write(p);
joshlhsoj1 7:8605925653cb 33 // wait(0.1);
joshlhsoj1 7:8605925653cb 34 myservo3 = p;
joshlhsoj1 7:8605925653cb 35 // wait(0.1);
joshlhsoj1 7:8605925653cb 36 myservo4 = p;
joshlhsoj1 7:8605925653cb 37 wait(0.01);
joshlhsoj1 7:8605925653cb 38 }
joshlhsoj1 7:8605925653cb 39 for(double p=1; p>=0; p -= 0.001) {
joshlhsoj1 7:8605925653cb 40 myservo1.write(p);
joshlhsoj1 7:8605925653cb 41 // wait(0.1);
joshlhsoj1 7:8605925653cb 42 myservo2.write(p);
joshlhsoj1 7:8605925653cb 43 // wait(0.1);
joshlhsoj1 7:8605925653cb 44 myservo3 = p;
joshlhsoj1 7:8605925653cb 45 // wait(0.1);
joshlhsoj1 7:8605925653cb 46 myservo4 = p;
joshlhsoj1 7:8605925653cb 47 wait(0.01);
joshlhsoj1 7:8605925653cb 48 }
DGonz 1:2aecd43e9e7b 49 }
agentarod23 0:4c71421f2822 50 }
agentarod23 0:4c71421f2822 51 }