Go to Post Well, there goes our bare aluminum corner tracking full field navigation system... - Whippet [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 07-08-2016, 11:24 AM
yedidya03 yedidya03 is offline
Registered User
FRC #3211
 
Join Date: Apr 2016
Location: Yeruham, Israel
Posts: 3
yedidya03 is an unknown quantity at this point
Command ataching issue

Hello,
While programming our robot I struggled with three problems I coud'nt solve that are all related to ataching commands to buttens/triggers and I wondered if it is all one problem.

In all three problems it did maneged to buid right but in the driver station I saw no robot code.

The first problem occurred when I tryed to define a command group and atach it to a button action.
The second problem was when I tryed to atach two commands to the same button (one to whileHeld and one to whenRelease).
The third problem was when I tryed to define a new Trigger to the throttel of the joystick and atach to it a command whenActive.

if someone knows what am I doing wrong it would be very helpfull.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-08-2016, 01:23 PM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 298
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Command ataching issue

If you could post a link to your code so we could read it, that would be helpful.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #3   Spotlight this post!  
Unread 07-09-2016, 04:09 PM
yedidya03 yedidya03 is offline
Registered User
FRC #3211
 
Join Date: Apr 2016
Location: Yeruham, Israel
Posts: 3
yedidya03 is an unknown quantity at this point
Re: Command ataching issue

the first problem was when I added a command group to a button action.

the command group was :
Code:
public class DropAndCollect extends CommandGroup{

	public DropAndCollect() {
		// TODO Auto-generated constructor stub
		addSequential(new DropAndCollect());
		addSequential(new Collect());
	}
	
}
the OI was :
Code:
public class OI {
	public Joystick stick = new Joystick(0);
	public Button[] btns = new Button[11];{
		for (int i = 0; i < 11; i ++){
			btns[i] = new JoystickButton(stick, i + 1);
		}
	}
	
    public OI(){
    	btns[0].whileHeld(new DropAndCollect());
    }
}
the second problem was when trying to have 2 commands at different actions of a button (in this case I also had no communication)

OI code :
Code:
public class OI {
	public Joystick stick = new Joystick(0);
	public Button[] btns = new Button[11];{
		for (int i = 0; i < 11; i ++){
			btns[i] = new JoystickButton(stick, i + 1);
		}
	}
	
    public OI(){
    	btns[0].whenPressed(new DropCollector());
    	btns[0].whileHeld(new Collect());
    }
}
the third problem was when I tried to define a trigger and run a command with it.

trigger code:
Code:
public class ThrottleTrigger extends Trigger{

	@Override
	public boolean get() {
		// TODO Auto-generated method stub
		return Robot.oi.stick.getThrottle() > 0;
	}

}
OI code:
Code:
public class OI {
	public Joystick stick = new Joystick(0);
	public Button[] btns = new Button[11];{
		for (int i = 0; i < 11; i ++){
			btns[i] = new JoystickButton(stick, i + 1);
		}
	}
	public ThrottleTrigger throttleTrigger = new ThrottleTrigger();
	
    public OI(){
    	throttleTrigger.whenActive(new RaiseCollectorArm());
    }
}
if someone knows why is that happening it will be very helpful.
Reply With Quote
  #4   Spotlight this post!  
Unread 07-09-2016, 11:32 PM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 298
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Command ataching issue

At a glance I can't see anything wrong with your code, but here are some suggestions

- If you lost communications, check your connection to the robot. Communications aren't typically dependant on the presence of robot code (although robot code that crashes very quickly combined with auto-restart causes some problems in roboRIO responsiveness from experience)

- If your robot code is crashing very quickly for some reason, the driverstation usually doesn't have a chance to grab the log. Instead, open up an SSH session (with PuTTY on Windows and ssh on Linux, or whatever client you prefer) to "roborio-3211-frc.local" (default username is admin; password is blank [so hit enter directly on the prompt]) and use
Code:
tail -f /home/lvuser/FRC_UserProgram.log
This might allow you to catch some stack trace you're not seeing

- Try using the debugger. It will probably trigger a breakpoint on any error, so this might also allow you to see if anything's causing a crash
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #5   Spotlight this post!  
Unread 07-11-2016, 02:00 PM
Waz Waz is offline
Strategy and programming mentor
AKA: Steve
FRC #2357 (System Meltdown)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Raymore, MO
Posts: 12
Waz is an unknown quantity at this point
Re: Command ataching issue

Quote:
Originally Posted by yedidya03 View Post
...
the command group was :
Code:
public class DropAndCollect extends CommandGroup{

	public DropAndCollect() {
		// TODO Auto-generated constructor stub
		addSequential(new DropAndCollect());
		addSequential(new Collect());
	}
	
}
...
The first addSequential is using the wrong class. As you have it, it will result in an infinite loop creating many nested DropAndCollect instances.

Hope this helps,
Steve
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 08:20 AM.

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