v1.0.0
This is code for my XRP Differential Swerve Drive Robot.
IMPORTANT: This code is a WIP. use at your own peril!
Right now each module can rotate and translate very well (what I consider the hard part) but all the modules rotate and translate the same, so the robot itself still can't rotate! I will find a few hours sometime eventually to figure out the final bit of fun vector math.
- Both XRPs run the same code, except I give them both a different Bluetooth name. You can connect to either of them to drive the robot.
- The XRPs need a wired serial connection to communicate with each other. I used 3 Dupont female-female wires to connect D16->D17, D17->D16, and GND->GND
- The zero angle for each module is determined when the robot is turned on, all modules must be manually aligned at that time.
- even if all the wheels are pointed the same way, some of them might be 180 degrees out of alignment. look for the small bevel gears for alignment.
- Huge props to FTC team 9048, this repo is not much more than a python version of their java differential swerve drive code
-
Your robot needs Pestolink-MicroPython. Follow the first two steps in that repo. (doesn't hurt to go through all the steps just to get familiar with Pestolink).
-
Upload
Vector2D.py
to your XRP robot- Click here to download this repository. After that, unzip it
- In the XRP Code editor, go to
file > Upload to XRP
and selectVector2D.py
from the repo you just downloaded - Save the file at the top level, so that
FINAL PATH: /Vector2D.py
-
Upload
swervemodule.py
to your XRP robot- In the XRP Code editor, go to
file > Upload to XRP
and selectswervemodule.py
from the repo you just downloaded - Save the file at the top level, so that
FINAL PATH: /swervemodule.py
- In the XRP Code editor, go to
-
Upload
swervemain.py
to your XRP robot- In the XRP Code editor, go to
file > Upload to XRP
and selectswervemain.py
from the repo you just downloaded - Save the file at the top level, so that
FINAL PATH: /swervemain.py
- change the
robot_name
string to what you want the robot to be named for Bluetooth pairing - Save the file again
- In the XRP Code editor, go to
-
Repeat the previous steps for the second XRP
-
Pairing and connecting
- Go to PestoLink-Online.
- Press/click
Connect BLE
. A pairing menu will appear, find and select the robot name you chose. After the connection opens, you can now drive your robot!