Scratch Swerve

With downtime distanced from both our team and our shop, I was trying to find something meaningful to do for my programmers. Most only have Chromebooks at home (school issued), and a lack of access to any robots make testing difficult.

They really want to try to learn swerve for the 2021 season, which I have personally never done. I thought I’d better at least start to understand the basics, so I made this…

https://scratch.mit.edu/projects/377491822/

v2 (adds field oriented option) https://scratch.mit.edu/projects/377637510/

I’m going to challenge my programmers to try to recreate something similar on their own and understand what it’s doing. One of my favorite things about Scratch is the ability to peek inside other people’s code and see how it works, so be sure to click the “see inside” button if you are curious.

Big shoutout to @Ether for his paper on swerve.

11 Likes

I love this! I love creating complex things with simple tools (robots with legos, swerve with scratch). I think I am going to challenge my monogramming friends to do this with me!

I still hope to add field oriented control, and eventually some logic on which way to rotate wheels and when its more efficient to change wheel directions.

1 Like

I did something like this with mecanum a couple years back, it was a great resource to play with. Keep us updated!

This is amazing. I love complex math and algorithms but there is something so oddly satisfying about this, you’ve really got me wanting to play with scratch again for the first time in 7 years. :grin:

Russ hasn’t been active on CD for a couple of years now. I last saw him in person a little while before the end of the 2018 season. He also visited Stryke Force about that same time.

His papers continue to inspire.

3 Likes

I’ve spent some(way too much) time programming my own take on this. I’ve never done swerve before so this was pretty fun; if you’re interested, you can find it here.

Nice work! I made something similar in the offseason last year, only I used JavaScript. It’s cool to see more swerve simulations being created. Another one that comes to mind was created by @retrodaredevil here.

1 Like

updated to publish v2, which adds a slider to select the direction of downfield and a toggle to enable field oriented control.

1 Like

If anyone is curious about writing their own swerve drive controller from the ground up (without the ubiquitous Ether paper), I’ve also written a similar swerve drive simulation, except that mine doesn’t ship with working control code. Instead, I have a bunch of tasks that help walk you through writing your own swerve controller from scratch! All of the code you will write is in Java and the interfaces are simple enough that the code you write will transfer to a real robot fairly simply.
it’s a lot more work to set up on your computer than the others shared here (sorry), but I would love for everybody to check it out, give me feedback, and hopefully learn something. You can find it here: https://github.com/Bobobalink/Swerve-Simulator

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.