ProposalBot/Spring/2020
How ProposalBot is programmed…
Author/s: Haydon Chiu
Table of Contents
MARRY ME: Behind the Scenes
There is a lot of software regarding Proposal Bot, this section will explain the basics behind some of the logic of how the bot will move omnidirectionally in this first iteration.
MARRYME.ino
The end goal for our groups ProposalBot was to essentially spell out the words “MARRY ME”. In our first iteration of programming our omnidirectional bot, our code was essentially the one provided from by Dejan from howtomechatronics.com with some obvious modifications necessary for our project. However, the code provided only had the basics of moving the omnidirectional bot in all directions. In order to complete our goals, our team had to understand how the source code operates and then plan an implementation to work with our needs. First, it was necessary to understand the code that was used in V1 of our code. This allowed us to figure out which functions and libraries to use for our project. I decided to move forward with this project by using the AccelStepper library made by Airspayce. Airspayce provides a built in function called moveTo(), this function allowed us to put in a parameter (in this case 300) and our bot would move a server in that direction to a spiral of 300. If one was to put a negative value as a parameter, then it would go in the negative direction. As seen in the V1 code, the way our proposal bot works is by having wheels move in opposition to one another in order for them to move left, right, right-forward, etc. So our moveTo() function would just have the same parameters, but in opposite directions depending on the route the proposalbot needed to go. Before the moveTo() function was used, it may have been necessary to use a .setCurrentPosition() function which was a way to set the location of the server. For example, the servos will always start at 0, but if one were to move the servo with the moveTo() function it would move it to whatever parameter was. So if the parameter was 300 then 300 would be the new current position, so to make the numbers easier I thought it best just to reset the current position to 0 so one never has to question the current position. Lastly, in order to make the moveTo() function to work it will be necessary to use .runSpeedToPosition() which will essentially use the designated speed given earlier in the code and then run the code. The servos will move in a similar fashion as V1 except it will use the functions described in this post. In order to draw the letters “MARRY ME” I fashioned the move functions in a manner that will trace the letters. Our design will essentially have a servo that implements the pen plotter and it will have a fine tip that would allow the bot to drag the pen while driving in a direction and draw the words out. The code for this can be shown below.
/*MARRY ME CODE V1*/ #include #include SoftwareSerial Bluetooth(A8, 38); // Arduino(RX, TX) - HC-05 Bluetooth (TX, RX) // Define the stepper motors and the pins the will use AccelStepper LeftBackWheel(1, 42, 43); // (Type:driver, STEP, DIR) - Stepper1 AccelStepper LeftFrontWheel(1, 40, 41); // Stepper2 AccelStepper RightBackWheel(1, 44, 45); // Stepper3 AccelStepper RightFrontWheel(1, 46, 47); // Stepper4 int wheelSpeed = 1500; void setup() { // Set initial seed values for the steppers LeftFrontWheel.setMaxSpeed(3000); LeftBackWheel.setMaxSpeed(3000); RightFrontWheel.setMaxSpeed(3000); RightBackWheel.setMaxSpeed(3000); delay(20); // pinMode(led, OUTPUT); } void loop() { // put your main code here, to run repeatedly: } void moveForward() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(wheelSpeed); } void moveBackward() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(-wheelSpeed); } void moveSidewaysRight() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(wheelSpeed); } void moveSidewaysLeft() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(-wheelSpeed); } void rotateLeft() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(wheelSpeed); } void rotateRight() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(-wheelSpeed); } void moveRightForward() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(0); RightFrontWheel.setSpeed(0); RightBackWheel.setSpeed(wheelSpeed); } void moveRightBackward() { LeftFrontWheel.setSpeed(0); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(0); } void moveLeftForward() { LeftFrontWheel.setSpeed(0); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(0); } void moveLeftBackward() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(0); RightFrontWheel.setSpeed(0); RightBackWheel.setSpeed(-wheelSpeed); } void stopMoving() { LeftFrontWheel.setSpeed(0); LeftBackWheel.setSpeed(0); RightFrontWheel.setSpeed(0); RightBackWheel.setSpeed(0); } void m(){ LeftFrontWheel.moveTo(300); RightBackWheel.moveTo(300); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); LeftBackWheel.moveTo(300); RightFrontWheel.moveTo(300); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); } void a(){ LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(300); RightBackWheel.moveTo(300); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(-50); LeftBackWheel.moveTo(50); RightFrontWheel.moveTo(50); RightBackWheel.moveTo(-50); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(50); LeftBackWheel.moveTo(-50); RightFrontWheel.moveTo(-50); RightBackWheel.moveTo(50); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); } void r(){ LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(300); LeftBackWheel.moveTo(300); RightFrontWheel.moveTo(300); RightBackWheel.moveTo(300); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.setSpeed(-150); RightBackWheel.setSpeed(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftBackWheel.moveTo(-100); RightFrontWheel.moveTo(-100); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); } void y(){ LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); LeftBackWheel.moveTo(150); RightFrontWheel.moveTo(150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(-150); RightBackWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftBackWheel.moveTo(150); RightFrontWheel.moveTo(150); } void e(){ LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(-150); LeftBackWheel.moveTo(150); RightFrontWheel.moveTo(150); RightBackWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(100); LeftBackWheel.moveTo(100); RightFrontWheel.moveTo(100); RightBackWheel.moveTo(100); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(-150); LeftBackWheel.moveTo(150); RightFrontWheel.moveTo(150); RightBackWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(100); LeftBackWheel.moveTo(100); RightFrontWheel.moveTo(100); RightBackWheel.moveTo(100); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(-150); LeftBackWheel.moveTo(150); RightFrontWheel.moveTo(150); RightBackWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(100); LeftBackWheel.moveTo(100); RightFrontWheel.moveTo(100); RightBackWheel.moveTo(100); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(150); LeftBackWheel.moveTo(-150); RightFrontWheel.moveTo(-150); RightBackWheel.moveTo(150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); LeftFrontWheel.setCurrentPosition(0); LeftBackWheel.setCurrentPosition(0); RightFrontWheel.setCurrentPosition(0); RightBackWheel.setCurrentPosition(0); LeftFrontWheel.moveTo(-150); LeftBackWheel.moveTo(150); RightFrontWheel.moveTo(150); RightBackWheel.moveTo(-150); LeftFrontWheel.runSpeedToPosition(); LeftBackWheel.runSpeedToPosition(); RightFrontWheel.runSpeedToPosition(); RightBackWheel.runSpeedToPosition(); }
Arxterra App code
Another code that was written for this project was a code to interface with the Arxterra App. In order to do this, it was necessary to learn the interface and how to program with the template code that was given. Fortunately, Dejan from “How To Mechatronics” wrote his code to operate with his own application. The way that he implemented his code was using IF/ELSE statements and when a button was pressed, the servos would call one of the functions of moving forward, moving left, and so on. Arxterra was made to operate with the 3Dotboard but in order to utilize the Arduino Uno, it was necessary to modify some of the library code. The code for the Arxterra app can be seen below.
/* * Telemetry and Custom Command Sample Arduino Code * Telemetry Example: Monitor an extended I/O register value and send to control panel display * Command Example: Add Robot unique MOVE, BLINK, and SERVO commands */ // include C:\Program Files (x86)\Arduino 1_6_5\hardware\arduino\avr\libraries #include // instantiated as ArxRobot at end of class header #include #include // I2C support #include #include ArxRobot ArxRobot; // instantiated as ArxRobot at end of class header AccelStepper LeftBackWheel(1, 42, 43); // (Type:driver, STEP, DIR) - Stepper1 AccelStepper LeftFrontWheel(1, 40, 41); // Stepper2 AccelStepper RightBackWheel(1, 44, 45); // Stepper3 AccelStepper RightFrontWheel(1, 46, 47); // Stepper4 /* * Command Example * Step 1: Assign new command mnemonics ID numbers * In our example we will be adding 3 custom comma * nds (2 new and one predefined). * The predefined MOVE command is intercepted and our robot unique code is to be * run instead. The MOVE command mnemonic ID 0x01 is already defined in Configure.h * The next two commands are new and assigned to the first two addresses in the * custom command address space 0x40 - 0x5F. */ #define BLINK 0x40 #define SERVO 0x41 const uint8_t CMD_LIST_SIZE = 3; // we are adding 3 commands (MOVE, BLINK, SERVO) int wheelSpeed = 500; /* * Command Example * Step 4: Write command handlers */ /* * User Defined Command BLINK (0x40) Example * A5 01 40 E4 */ void blinkHandler (uint8_t cmd, uint8_t param[], uint8_t n) { int dataIn = param[0]; int m = 0; if (dataIn == 0x0C) { m = 0; } if (dataIn == 0x0A) { m = 1; } if (dataIn == 0x04) { m = 2; } if (dataIn == 0x07) { m = 3; } if (dataIn == 0x0B) { m = 4; } if (dataIn == 0x05) { m = 5; } if (dataIn == 0x09) { m = 6; } if (dataIn == 0x03) { m = 7; } if (dataIn == 0x08) { m = 8; } //if (dataIn == 9) { //m = 9; //} //if (dataIn == 10) { //m = 10; //} /* if (dataIn == 11) { m = 11; } if (dataIn == 12) { m = 12; } if (dataIn == 14) { m = 14; }*/ // Set speed /* if (dataIn >= 16) { wheelSpeed = dataIn * 10; Serial.println(wheelSpeed); } } */ if (m == 4) { moveSidewaysLeft(); } if (m == 5) { moveSidewaysRight(); } if (m == 2) { moveForward(); } if (m == 7) { moveBackward(); } if (m == 3) { moveRightForward(); } if (m == 1) { moveLeftForward(); } if (m == 8) { moveRightBackward(); } if (m == 6) { moveLeftBackward(); } // if (m == 9) { // rotateLeft(); //} //if (m == 10) { //rotateRight(); //} if (m == 0) { stopMoving(); } } // blinkHandler /* * Override MOVE (0x01) Command Example * A5 05 01 01 80 01 80 A1 */ void moveHandler (uint8_t cmd, uint8_t param[], uint8_t n) { Serial.write(cmd); // move command = 0x01 Serial.write(n); // number of param = 4 for (int i=0;iBoard. */ #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__) uint16_t pwm_reading = (uint16_t) OCR4D; // read 8-bit Output Compare Register Timer 4D and cast to 16-bit signed word motorPWM.sendSensor(pwm_reading); #else // Timer/Counter 0 registers set by UNO Bootloader (freq. = 1 Khz) // Timer/Counter Control Registers TCCR0B = 0x03 (Prescaler of 64) and TCCR0A (Fast PWM, TOP = 0xFF) = 0x03 uint16_t pwm_reading = (uint16_t) OCR0B; motorPWM.sendSensor(pwm_reading); #endif } void moveForward() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(wheelSpeed); } void moveBackward() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(-wheelSpeed); } void moveSidewaysRight() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(wheelSpeed); } void moveSidewaysLeft() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(-wheelSpeed); } void rotateLeft() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(wheelSpeed); } void rotateRight() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(-wheelSpeed); } void moveRightForward() { LeftFrontWheel.setSpeed(wheelSpeed); LeftBackWheel.setSpeed(0); RightFrontWheel.setSpeed(0); RightBackWheel.setSpeed(wheelSpeed); } void moveRightBackward() { LeftFrontWheel.setSpeed(0); LeftBackWheel.setSpeed(-wheelSpeed); RightFrontWheel.setSpeed(-wheelSpeed); RightBackWheel.setSpeed(0); } void moveLeftForward() { LeftFrontWheel.setSpeed(0); LeftBackWheel.setSpeed(wheelSpeed); RightFrontWheel.setSpeed(wheelSpeed); RightBackWheel.setSpeed(0); } void moveLeftBackward() { LeftFrontWheel.setSpeed(-wheelSpeed); LeftBackWheel.setSpeed(0); RightFrontWheel.setSpeed(0); RightBackWheel.setSpeed(-wheelSpeed); } void stopMoving() { LeftFrontWheel.setSpeed(0); LeftBackWheel.setSpeed(0); RightFrontWheel.setSpeed(0); RightBackWheel.setSpeed(0); }
What’s next?
Due to the circumstances regarding COVID-19, a lot of our classes resources have become unavailable along with in-person collaboration on our project. At this point, it is more likely to create a proof of concept of our project and it was suggested to use a system called “Processing” to potentially create an omnidirectional simulation of said project.
References/Resources
- https://howtomechatronics.com/projects/arduino-mecanum-wheels-robot/
- https://www.arxterra.com/