Go to Post I (personally) am not involved in FIRST because I want to win (of course, that would still be nice ;) ). - pogenwurst [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-03-2014, 18:21
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Remap Button Action

Using Command Based Java, is it safe and will it work to remap a Button action at run-time?

Example, in the OI class:

Code:
public Button stick2_B = new JoystickButton(stick2, RobotMap.XBOX_B); 
stick2_B.whenPressed(new Command1());
Later, in the execute method of a command I want to do:

Code:
if(SOME_CONDITION)
{
    oi.stick2_B.whenPressed(new Command2());
}
I've already confirmed it will compile so the question is really if it will behave correctly at run-time. Specifically do I need to do anything to de-register stick2_B as a trigger for Command1 or any other sort up cleanup first? I would just test it but I don't have access to a robot until later this week for obvious reasons. Please don't tell me it should work or you think it will work Only if you know from knowledge of the WPILib or experience. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 16-03-2014, 19:07
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Remap Button Action

Actually now I am realizing that I want to be able to unmap a button action when switching between my two OI modes. Is there an API to do that or can I pass a null pointer to WhenPressed()?
Reply With Quote
  #3   Spotlight this post!  
Unread 17-03-2014, 08:51
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 108
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Remap Button Action

In navigating through the source, it does not look like it is possible (at least not easily) to unregister a button handler.

Could you work around this by refactoring your command to take into account the SOME_CONDITION? For example if the difference is only in your execute() method, could you change your command implementation to:

Code:
protected void execute() {
   if (SOME_CONDITION) {
      executeCondition();
   } else {
      executeNormal();
   }
}
Reply With Quote
  #4   Spotlight this post!  
Unread 18-03-2014, 08:25
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Remap Button Action

My intent is to be able to have a different set of controls (xbox controller mapping) for the field and for the pit at the flip of a switch. The code below is not tested yet but the idea is to create new Button objects and set their WhenPressed()/WhileHeld() methods each time I want to switch the interface. I have a command that will check the switch as a DigitalInput and reconfigure the interface when needed.

CheckOIConfig.java
Code:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

/**
 *
 * @author team63
 */
public class CheckOIConfig extends CommandBase {
    
    public CheckOIConfig() {
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        if(throwSwitch1.get() && oi.current_interface == oi.CONFIG_FIELD_INTERFACE)
        {
            oi.setPitInterface();
        }
        
        if(!throwSwitch1.get() && oi.current_interface == oi.CONFIG_PIT_INTERFACE)
        {
            oi.setFieldInterface();
        }
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return true;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}
OI.java:
Code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.GoToCatchPosition;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.GoToGrabPosition;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.GoToShootPosition;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.ShootBall;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.SpitBall;
import edu.wpi.first.wpilibj.templates.commands.ElbowExtend;
import edu.wpi.first.wpilibj.templates.commands.ElbowRetract;
import edu.wpi.first.wpilibj.templates.commands.FeedMotorManual;
import edu.wpi.first.wpilibj.templates.commands.ForkExtend;
import edu.wpi.first.wpilibj.templates.commands.ForkRetract;
import edu.wpi.first.wpilibj.templates.commands.HighDriveCommand;
import edu.wpi.first.wpilibj.templates.commands.HighGear;
import edu.wpi.first.wpilibj.templates.commands.LowGear;
import edu.wpi.first.wpilibj.templates.commands.ShooterDriveOverride;
import edu.wpi.first.wpilibj.templates.commands.ShooterDriveRelease;
import edu.wpi.first.wpilibj.templates.commands.WinchManual;
import edu.wpi.first.wpilibj.templates.commands.WinchPinExtend;
import edu.wpi.first.wpilibj.templates.commands.WinchPinRetract;
import edu.wpi.first.wpilibj.templates.commands.WristExtend;
import edu.wpi.first.wpilibj.templates.commands.WristRetract;

/**
 * This class is the glue that binds the controls on the physical operator
 * interface to the commands and command groups that allow control of the robot.
 */

public class OI {
    
    public final int CONFIG_FIELD_INTERFACE = 1;
    public final int CONFIG_PIT_INTERFACE = 2;
    
    public int current_interface = CONFIG_FIELD_INTERFACE;
    
    public Joystick stick1 = new Joystick(1);
    public Joystick stick2 = new Joystick(2);
    
    public Button stick1_BACK;
    public Button stick1_START;
    public Button stick1_LEFT_BUMPER;
    public Button stick1_RIGHT_BUMPER;
    public Button stick1_Y;
    public Button stick1_X;
    public Button stick1_B;
    public Button stick1_A;
        
    public Button stick2_BACK;
    public Button stick2_START;
    public Button stick2_LEFT_BUMPER;
    public Button stick2_RIGHT_BUMPER;
    public Button stick2_Y;
    public Button stick2_X;
    public Button stick2_B;
    public Button stick2_A;

    public OI()
    {
        this.setFieldInterface();
    }
    
    public final void setFieldInterface()
    {
        current_interface = CONFIG_FIELD_INTERFACE;
        
        stick1_BACK = new JoystickButton(stick1, RobotMap.XBOX_BACK);
        stick1_START = new JoystickButton(stick1, RobotMap.XBOX_START);
        stick1_LEFT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_LEFT_BUMPER);
        stick1_RIGHT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_RIGHT_BUMPER);        
        stick1_Y = new JoystickButton(stick1, RobotMap.XBOX_Y);
        stick1_X = new JoystickButton(stick1, RobotMap.XBOX_X);
        stick1_B = new JoystickButton(stick1, RobotMap.XBOX_B);
        stick1_A = new JoystickButton(stick1, RobotMap.XBOX_A);

        stick2_BACK = new JoystickButton(stick2, RobotMap.XBOX_BACK);
        stick2_START = new JoystickButton(stick2, RobotMap.XBOX_START);
        stick2_LEFT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_LEFT_BUMPER);
        stick2_RIGHT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_RIGHT_BUMPER);        
        stick2_Y = new JoystickButton(stick2, RobotMap.XBOX_Y);
        stick2_X = new JoystickButton(stick2, RobotMap.XBOX_X);
        stick2_B = new JoystickButton(stick2, RobotMap.XBOX_B);
        stick2_A = new JoystickButton(stick2, RobotMap.XBOX_A);
        
        stick1_Y.whenPressed(new GoToGrabPosition());
        stick1_X.whenPressed(new GoToShootPosition());
        stick1_LEFT_BUMPER.whenPressed(new GoToCatchPosition());
        stick1_RIGHT_BUMPER.whileHeld(new HighDriveCommand());      

        stick2_RIGHT_BUMPER.whileHeld(new ShooterDriveOverride());
        stick2_RIGHT_BUMPER.whenReleased(new ShooterDriveRelease());
        stick2_B.whenPressed(new ShootBall());
        stick2_A.whenPressed(new SpitBall());            
    }
    
    public final void setPitInterface()
    {
        current_interface = CONFIG_PIT_INTERFACE;
        
        stick1_BACK = new JoystickButton(stick1, RobotMap.XBOX_BACK);
        stick1_START = new JoystickButton(stick1, RobotMap.XBOX_START);
        stick1_LEFT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_LEFT_BUMPER);
        stick1_RIGHT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_RIGHT_BUMPER);        
        stick1_Y = new JoystickButton(stick1, RobotMap.XBOX_Y);
        stick1_X = new JoystickButton(stick1, RobotMap.XBOX_X);
        stick1_B = new JoystickButton(stick1, RobotMap.XBOX_B);
        stick1_A = new JoystickButton(stick1, RobotMap.XBOX_A);

        stick2_BACK = new JoystickButton(stick2, RobotMap.XBOX_BACK);
        stick2_START = new JoystickButton(stick2, RobotMap.XBOX_START);
        stick2_LEFT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_LEFT_BUMPER);
        stick2_RIGHT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_RIGHT_BUMPER);        
        stick2_Y = new JoystickButton(stick2, RobotMap.XBOX_Y);
        stick2_X = new JoystickButton(stick2, RobotMap.XBOX_X);
        stick2_B = new JoystickButton(stick2, RobotMap.XBOX_B);
        stick2_A = new JoystickButton(stick2, RobotMap.XBOX_A);
        
        stick1_LEFT_BUMPER.whenPressed(new LowGear());
        stick1_RIGHT_BUMPER.whenPressed(new HighGear());        
        stick1_X.whenPressed(new ForkRetract());
        stick1_B.whenPressed(new ForkExtend());
        stick1_Y.whenPressed(new ElbowExtend());
        stick1_A.whenPressed(new ElbowRetract());
        
        stick2_BACK.whenPressed(new WinchPinRetract());
        stick2_START.whenPressed(new WinchPinExtend());
        stick2_LEFT_BUMPER.whileHeld(new FeedMotorManual());
        stick2_RIGHT_BUMPER.whileHeld(new WinchManual());
        stick2_Y.whenPressed(new WristExtend());
        stick2_A.whenPressed(new WristRetract());
    }
}
Reply With Quote
  #5   Spotlight this post!  
Unread 18-03-2014, 08:30
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,728
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Remap Button Action

Quote:
Originally Posted by jwakeman View Post
My intent is to be able to have a different set of controls (xbox controller mapping) for the field and for the pit at the flip of a switch. The code below is not tested yet but the idea is to create new Button objects and set their WhenPressed()/WhileHeld() methods each time I want to switch the interface. I have a command that will check the switch as a DigitalInput and reconfigure the interface when needed.

CheckOIConfig.java
Code:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

/**
 *
 * @author team63
 */
public class CheckOIConfig extends CommandBase {
    
    public CheckOIConfig() {
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        if(throwSwitch1.get() && oi.current_interface == oi.CONFIG_FIELD_INTERFACE)
        {
            oi.setPitInterface();
        }
        
        if(!throwSwitch1.get() && oi.current_interface == oi.CONFIG_PIT_INTERFACE)
        {
            oi.setFieldInterface();
        }
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return true;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}
OI.java:
Code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.GoToCatchPosition;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.GoToGrabPosition;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.GoToShootPosition;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.ShootBall;
import edu.wpi.first.wpilibj.templates.command.CommandGroup.SpitBall;
import edu.wpi.first.wpilibj.templates.commands.ElbowExtend;
import edu.wpi.first.wpilibj.templates.commands.ElbowRetract;
import edu.wpi.first.wpilibj.templates.commands.FeedMotorManual;
import edu.wpi.first.wpilibj.templates.commands.ForkExtend;
import edu.wpi.first.wpilibj.templates.commands.ForkRetract;
import edu.wpi.first.wpilibj.templates.commands.HighDriveCommand;
import edu.wpi.first.wpilibj.templates.commands.HighGear;
import edu.wpi.first.wpilibj.templates.commands.LowGear;
import edu.wpi.first.wpilibj.templates.commands.ShooterDriveOverride;
import edu.wpi.first.wpilibj.templates.commands.ShooterDriveRelease;
import edu.wpi.first.wpilibj.templates.commands.WinchManual;
import edu.wpi.first.wpilibj.templates.commands.WinchPinExtend;
import edu.wpi.first.wpilibj.templates.commands.WinchPinRetract;
import edu.wpi.first.wpilibj.templates.commands.WristExtend;
import edu.wpi.first.wpilibj.templates.commands.WristRetract;

/**
 * This class is the glue that binds the controls on the physical operator
 * interface to the commands and command groups that allow control of the robot.
 */

public class OI {
    
    public final int CONFIG_FIELD_INTERFACE = 1;
    public final int CONFIG_PIT_INTERFACE = 2;
    
    public int current_interface = CONFIG_FIELD_INTERFACE;
    
    public Joystick stick1 = new Joystick(1);
    public Joystick stick2 = new Joystick(2);
    
    public Button stick1_BACK;
    public Button stick1_START;
    public Button stick1_LEFT_BUMPER;
    public Button stick1_RIGHT_BUMPER;
    public Button stick1_Y;
    public Button stick1_X;
    public Button stick1_B;
    public Button stick1_A;
        
    public Button stick2_BACK;
    public Button stick2_START;
    public Button stick2_LEFT_BUMPER;
    public Button stick2_RIGHT_BUMPER;
    public Button stick2_Y;
    public Button stick2_X;
    public Button stick2_B;
    public Button stick2_A;

    public OI()
    {
        this.setFieldInterface();
    }
    
    public final void setFieldInterface()
    {
        current_interface = CONFIG_FIELD_INTERFACE;
        
        stick1_BACK = new JoystickButton(stick1, RobotMap.XBOX_BACK);
        stick1_START = new JoystickButton(stick1, RobotMap.XBOX_START);
        stick1_LEFT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_LEFT_BUMPER);
        stick1_RIGHT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_RIGHT_BUMPER);        
        stick1_Y = new JoystickButton(stick1, RobotMap.XBOX_Y);
        stick1_X = new JoystickButton(stick1, RobotMap.XBOX_X);
        stick1_B = new JoystickButton(stick1, RobotMap.XBOX_B);
        stick1_A = new JoystickButton(stick1, RobotMap.XBOX_A);

        stick2_BACK = new JoystickButton(stick2, RobotMap.XBOX_BACK);
        stick2_START = new JoystickButton(stick2, RobotMap.XBOX_START);
        stick2_LEFT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_LEFT_BUMPER);
        stick2_RIGHT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_RIGHT_BUMPER);        
        stick2_Y = new JoystickButton(stick2, RobotMap.XBOX_Y);
        stick2_X = new JoystickButton(stick2, RobotMap.XBOX_X);
        stick2_B = new JoystickButton(stick2, RobotMap.XBOX_B);
        stick2_A = new JoystickButton(stick2, RobotMap.XBOX_A);
        
        stick1_Y.whenPressed(new GoToGrabPosition());
        stick1_X.whenPressed(new GoToShootPosition());
        stick1_LEFT_BUMPER.whenPressed(new GoToCatchPosition());
        stick1_RIGHT_BUMPER.whileHeld(new HighDriveCommand());      

        stick2_RIGHT_BUMPER.whileHeld(new ShooterDriveOverride());
        stick2_RIGHT_BUMPER.whenReleased(new ShooterDriveRelease());
        stick2_B.whenPressed(new ShootBall());
        stick2_A.whenPressed(new SpitBall());            
    }
    
    public final void setPitInterface()
    {
        current_interface = CONFIG_PIT_INTERFACE;
        
        stick1_BACK = new JoystickButton(stick1, RobotMap.XBOX_BACK);
        stick1_START = new JoystickButton(stick1, RobotMap.XBOX_START);
        stick1_LEFT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_LEFT_BUMPER);
        stick1_RIGHT_BUMPER = new JoystickButton(stick1, RobotMap.XBOX_RIGHT_BUMPER);        
        stick1_Y = new JoystickButton(stick1, RobotMap.XBOX_Y);
        stick1_X = new JoystickButton(stick1, RobotMap.XBOX_X);
        stick1_B = new JoystickButton(stick1, RobotMap.XBOX_B);
        stick1_A = new JoystickButton(stick1, RobotMap.XBOX_A);

        stick2_BACK = new JoystickButton(stick2, RobotMap.XBOX_BACK);
        stick2_START = new JoystickButton(stick2, RobotMap.XBOX_START);
        stick2_LEFT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_LEFT_BUMPER);
        stick2_RIGHT_BUMPER = new JoystickButton(stick2, RobotMap.XBOX_RIGHT_BUMPER);        
        stick2_Y = new JoystickButton(stick2, RobotMap.XBOX_Y);
        stick2_X = new JoystickButton(stick2, RobotMap.XBOX_X);
        stick2_B = new JoystickButton(stick2, RobotMap.XBOX_B);
        stick2_A = new JoystickButton(stick2, RobotMap.XBOX_A);
        
        stick1_LEFT_BUMPER.whenPressed(new LowGear());
        stick1_RIGHT_BUMPER.whenPressed(new HighGear());        
        stick1_X.whenPressed(new ForkRetract());
        stick1_B.whenPressed(new ForkExtend());
        stick1_Y.whenPressed(new ElbowExtend());
        stick1_A.whenPressed(new ElbowRetract());
        
        stick2_BACK.whenPressed(new WinchPinRetract());
        stick2_START.whenPressed(new WinchPinExtend());
        stick2_LEFT_BUMPER.whileHeld(new FeedMotorManual());
        stick2_RIGHT_BUMPER.whileHeld(new WinchManual());
        stick2_Y.whenPressed(new WristExtend());
        stick2_A.whenPressed(new WristRetract());
    }
}
The simplest way to do this for now would be to have it check the switch on start up and initialize the buttons one way or another. You wouldn't be able to switch it on the fly with the robot on, but with a restart you could switch back and forth.
Reply With Quote
  #6   Spotlight this post!  
Unread 18-03-2014, 12:12
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Remap Button Action

Quote:
Originally Posted by notmattlythgoe View Post
The simplest way to do this for now would be to have it check the switch on start up and initialize the buttons one way or another. You wouldn't be able to switch it on the fly with the robot on, but with a restart you could switch back and forth.
I was trying to avoid rebooting the robot to switch the controls. I was not 100% sure that I would be able to do it on the fly like this but wanted to give it a try. If the WPILib is polling (i.e. periodically dereferencing them to check some property) those Button objects then I can see how messing with them at runtime could cause it to crash. As you can probably tell I didn't take the time to dig into the WPILib implementation on this and my plan was to just test it out and see if it worked..if not then go to what you suggested and check the switch on startup.

Can you be more specific as to what your reasoning is for why it won't work?
Reply With Quote
  #7   Spotlight this post!  
Unread 18-03-2014, 12:16
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Remap Button Action

Have you considered putting your "pit" commands on smartdashboard and executing them from there?
Reply With Quote
  #8   Spotlight this post!  
Unread 18-03-2014, 14:11
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,728
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Remap Button Action

Nothing jumps out at me as something that would keep this from working. Let me know if it does work when you give it a try, I'd be interested in the results and any unforeseen issues if there are any.
Reply With Quote
  #9   Spotlight this post!  
Unread 18-03-2014, 14:56
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Remap Button Action

Quote:
Originally Posted by notmattlythgoe View Post
Nothing jumps out at me as something that would keep this from working. Let me know if it does work when you give it a try, I'd be interested in the results and any unforeseen issues if there are any.
Sorry I re-read your previous reply and see now that you were just pointing out the simplest way to do it..not saying that what I had would not work. I'll let you know if it works out!
Reply With Quote
  #10   Spotlight this post!  
Unread 18-03-2014, 14:58
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Remap Button Action

Quote:
Originally Posted by Joe Ross View Post
Have you considered putting your "pit" commands on smartdashboard and executing them from there?
Not a bad option...avoids the need to memorize which buttons do what on the xbox controller! What about the ones I am doing WhileHeld() with though? Is there some equivalent on the SmartDashboard?
Reply With Quote
  #11   Spotlight this post!  
Unread 18-03-2014, 14:59
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,728
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Remap Button Action

Quote:
Originally Posted by jwakeman View Post
Not a bad option...avoids the need to memorize which buttons do what on the xbox controller! What about the ones I am doing WhileHeld() with though? Is there some equivalent on the SmartDashboard?
If I remember correctly you can start them and stop them when needed. If the command doesn't stop on its own it will stop when you click stop.
Reply With Quote
  #12   Spotlight this post!  
Unread 23-03-2014, 11:55
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Remap Button Action

Quote:
Originally Posted by jwakeman View Post
I'll let you know if it works out!
Well I tried the dynamic re-mapping of button actions at run-time and it didn't really work out. I could see that some of the button mappings were changing based on the switch position but it wasn't behaving correctly and I had to quickly abandon the idea and go with the check the switch on start-up concept.

I may investigate this more later as i think it could be useful to be able to unmap/remap button actions.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi