Mecanum Code #7

Merged
merged 24 commits into from Jan 21, 2015

Projects

None yet

2 participants

@AidanSmith
Contributor

I think I was able to figure this out by myself. This is just a test to make sure I can make a pull request correctly.

@celskeggs celskeggs commented on an outdated diff Jan 14, 2015
...lios2015/src/org/team1540/quasarhelios/DriveCode.java
public class DriveCode {
public static FloatInput leftJoystickChannel;
public static FloatInput rightJoystickChannel;
public static BooleanInput octocanumShifting;
+ private static FloatOutput rightFrontMotor = Igneous.makeTalonMotor(1, Igneous.MOTOR_FORWARD, .1f);
+ private static FloatOutput leftFrontMotor = Igneous.makeTalonMotor(2, Igneous.MOTOR_FORWARD, .1f);
+ private static FloatOutput rightBackMotor = Igneous.makeTalonMotor(3, Igneous.MOTOR_FORWARD, .1f);
+ private static FloatOutput leftBackMotor = Igneous.makeTalonMotor(4, Igneous.MOTOR_FORWARD, .1f);
@celskeggs
celskeggs Jan 14, 2015 Member

Two comments - remember that you can combine the motors on the same side with Mixing.combine (for the normal drive mode, not mechanum) - and that half of the motors will need to be reversed (Igneous.MOTOR_REVERSE, I think.)

@celskeggs celskeggs self-assigned this Jan 14, 2015
@AidanSmith
Contributor

I added mecanum code that we can hopefully test on the practice robot soon. It seems to work fine in the emulator.

@AidanSmith AidanSmith changed the title from Testing: Added Motors to Mecanum Code Jan 15, 2015
@celskeggs
Member

Looks good - can you reformat this with Eclipse's formatter? Once you've done that and tested it on the robot, I'll merge this pull request.

@AidanSmith
Contributor

It has been reformatted by Eclipse's standards.

@celskeggs celskeggs and 1 other commented on an outdated diff Jan 16, 2015
...lios2015/src/org/team1540/quasarhelios/DriveCode.java
+ }
+ if (normalize < Math.abs(speed)) {
+ float multiplier = Math.abs(speed) / normalize;
+ leftFront *= multiplier;
+ rightFront *= multiplier;
+ leftBack *= multiplier;
+ rightBack *= multiplier;
+ }
+ rightFrontMotor.set(rightFront);
+ leftFrontMotor.set(leftFront);
+ rightBackMotor.set(rightBack);
+ leftBackMotor.set(leftBack);
+ }
+ };
+
+ private static EventOutput tankDrive = new EventOutput() {
@celskeggs
celskeggs Jan 16, 2015 Member

Recall that a tank drive implementation is provided by DriverImpls. This may be a more concise way to express this.

@AidanSmith
AidanSmith Jan 18, 2015 Contributor

I don't know how to get DriverImpls.createSyncTankDriver to work with filterEvent, because DriverImpls sends it immediately when it is called (it doesn't return an eventOutput).

@celskeggs
celskeggs Jan 18, 2015 Member

Two possible ways: call filterEvent on Igneous.duringTele instead, or use one of the other methods in DriverImpls that returns an EventOutput but is otherwise equivalent to createSyncTankDriver.

@celskeggs celskeggs commented on an outdated diff Jan 16, 2015
...lios2015/src/org/team1540/quasarhelios/DriveCode.java
public static void setup() {
-
+ Igneous.duringTele.send(mecanum);
+ BooleanMixing.whenBooleanBecomes(octocanumShifting, true).send(new EventOutput(){
+ public void event(){
+ Igneous.duringTele.unsend(mecanum);
+ Igneous.duringTele.send(tankDrive);
+ }
+ });
+ BooleanMixing.whenBooleanBecomes(octocanumShifting, false).send(new EventOutput(){
+ public void event(){
+ Igneous.duringTele.unsend(tankDrive);
+ Igneous.duringTele.send(mecanum);
@celskeggs
celskeggs Jan 16, 2015 Member

Interesting choice of way to switch. This should work, though I would recommend using filterEvent instead - should be clearer what you're doing.

@celskeggs
Member

Just a couple of suggestions. Besides that, good work.

@AidanSmith
Contributor

The code now works on the practice robot, so it should be ready to be merged. The filterEvent has not been tested on the robot, but it works on the emulator so I see no reason why it wouldn't work on the robot.

@AidanSmith
Contributor

I have at least one merge conflict. (On QuasarHelios.java) Do you have any advice for how to get rid of it?

@celskeggs
Member

You'll need to pull from the repository. It'll complain and put the repo into merge conflict mode. Then go to each of the files with an issue - each will contain marked sections of the different versions. Merge them into what makes sense, and git add the file. Once all are resolved, commit.

Also, FYI, we had to change two of the drive motor port numbers for the real robots.

@AidanSmith
Contributor

I fixed the merge conflicts. A few binary files appeared in my file change history. Is that normal?

@celskeggs
Member

No. You went and committed some Mac OS X specific files. You should delete those from the repository.

@AidanSmith
Contributor

I'm not sure why it generated that last commit, but, anyway, it looks good now. I changed the tank drive to DriverImpls.

@AidanSmith
Contributor

Clamp is using talon 2 right now for speed control. Should I switch clamp's speed control to talon 11 (the next available one)? I don't see it on the port numbers document you shared with us.

@celskeggs
Member

The clamp winch runs over CAN. For now, talon 11 works fine.

Can you cut that last line up or shorten it? It seems a bit long.

@AidanSmith
Contributor

Changed both. I also made the controls to more like how I envision them actually looking for competition. The old way was good for testing weird angles, but I think the new way is more intuitive for now.

@celskeggs
Member

Looks good. Once you've tested the latest version, I can merge it.

@AidanSmith
Contributor

Ready to merge. Works perfectly well on the practice bot.

@celskeggs
Member

Looks good.

@celskeggs celskeggs merged commit 7c42afe into master Jan 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment