Omnimaga

General Discussion => Technology and Development => Computer Projects and Ideas => Topic started by: epic7 on June 06, 2014, 09:48:54 pm

Title: Swerve Drive Simulator
Post by: epic7 on June 06, 2014, 09:48:54 pm
This year, my robotics team (FRC 2067) used a swerve drive, which uses 4 independently controlled modules to allow any combination of rotation and translation.
I recently made a simulator/game for this in Java.


Here are the controls:
(http://i.imgur.com/9rhMAIR.png)
*the harvester has to be down before you can shoot
Scoring in this game can be done by throwing the ball over the truss in the middle of the field, or shooting into the blue goal at the end of the field.

It's a bit buggy, like when interacting with other robots, but I figured I'll share what I have, since I haven't posted anything in such a long time

Here are the links:

Html5 version:
http://applepi.tk/swerve (http://applepi.tk/swerve)


Desktop, which supports USB controllers:
http://applepi.tk/swerve.jar (http://applepi.tk/swerve.jar)
Controller functionality tested on a Logitech Gamepad F310. Left stick for translation, right stick for rotation, LT and LB for harvester, RT for shoot, A for field centric, B for robot centric, D-pad for move rotation point, back for reset rotation point.


Tell me what you think :)
Title: Re: Swerve Drive Simulator
Post by: pimathbrainiac on June 06, 2014, 10:11:49 pm
Okay, you're back. YAY!
now to start programming your 83+


As I said on chief delphi, I think you should Github the source. It would help a lot of people, as well as allow for contributions. Also: You should try your hand at a Java code simulator once the new control system comes out.
Title: Re: Swerve Drive Simulator
Post by: Streetwalrus on June 07, 2014, 01:32:01 am
Yay Epic7 is back ! :D That robotics thingy sounds awesome. Do you have a video ?
Title: Re: Swerve Drive Simulator
Post by: epic7 on June 07, 2014, 06:20:42 pm
Made collisions a bit less terrible, and added a menu that can be accessed with esc.

And here's one of our matches, with us the red robot labelled 2067, scoring for the alliance.
Despite being 2 on 3 with one of our robots dead, we won the match.
This is at the world championships in St Louis.
Title: Re: Swerve Drive Simulator
Post by: 123outerme on June 07, 2014, 07:48:32 pm
I feel like the HUD at the top of the arena should float around and follow the camera.
But maybe that's just my spoiled-ness talking :P
Title: Re: Swerve Drive Simulator
Post by: flyingfisch on June 07, 2014, 08:04:42 pm
As I said on chief delphi, I think you should Github the source. It would help a lot of people, as well as allow for contributions. Also: You should try your hand at a Java code simulator once the new control system comes out.

Java, oh ouch. I wish java would go die in a hole somewhere. Python++!

Title: Re: Swerve Drive Simulator
Post by: pimathbrainiac on June 07, 2014, 08:11:35 pm
You can't write FRC-legal code in Python :P

EDIT: 100 moar posts until I'm 1337!
Title: Re: Swerve Drive Simulator
Post by: Streetwalrus on June 07, 2014, 08:17:28 pm
FRC-legal ? ???
Title: Re: Swerve Drive Simulator
Post by: pimathbrainiac on June 07, 2014, 08:21:58 pm
There are only 3 languages you are allowed to program FRC robots in: Java, C, and Labview.
Title: Re: Swerve Drive Simulator
Post by: Streetwalrus on June 07, 2014, 08:23:43 pm
Oh OK I guess they're too lazy to learn asm.
/me runs
Title: Re: Swerve Drive Simulator
Post by: flyingfisch on June 07, 2014, 08:25:05 pm
Um, then use C, not Java.
Title: Re: Swerve Drive Simulator
Post by: pimathbrainiac on June 07, 2014, 08:26:06 pm
Well, you can't program a cRIO-controlled robot in asm. There is no existing assembly language for the cRIO.

EDIT: :ninja: 'd

And flyingfisch, you don't have a choice. You program the robots in whatever your team says you program them in. For me, it's Java. For him, it's LabView. He also doesn't program C.
Title: Re: Swerve Drive Simulator
Post by: Streetwalrus on June 07, 2014, 08:27:56 pm
If there's a CPU, there's asm.
Title: Re: Swerve Drive Simulator
Post by: DJ Omnimaga on June 08, 2014, 02:12:21 am
This is awesome epic7. Also I think juju participated in similar competitions before, but the robots seemed different in style.
Title: Re: Swerve Drive Simulator
Post by: pimathbrainiac on June 08, 2014, 09:31:44 am
If there's a CPU, there's asm.

As I said. There is no supported assembly language for the cRIO. There are no assemblers, and the processor is proprietary (National Instruments). You can't program it in asm, even if you wanted to.
Title: Re: Swerve Drive Simulator
Post by: Streetwalrus on June 08, 2014, 12:14:08 pm
Welp, reverse engineering compiler output. :P
Nah jk, it's not worth the trouble I guess.
Title: Re: Swerve Drive Simulator
Post by: bb010g on June 08, 2014, 09:37:18 pm
You can't write FRC-legal code in Python :P

EDIT: 100 moar posts until I'm 1337!
You can. A project like robotpy is legal because the Python interpreter is C. You may or may not find a wizard at the match to help, but it's legal. A sister school of mine won a match on it and got into the last one of another. It runs perfectly fine. What's the difference between Java and a Java program that parses a text file written in a custom utility Turing-complete language and executes it live and a Python interpreter? Also, GCC for cRIO.
Title: Re: Swerve Drive Simulator
Post by: pimathbrainiac on June 08, 2014, 10:08:14 pm
I never knew, so I'm sorry for saying that. I only know what FIRST says :P
Title: Re: Swerve Drive Simulator
Post by: bb010g on June 08, 2014, 11:35:27 pm
It is confusingly worded if you don't look into it that much.