Go to Post 27 ft/s? They must really "Rush" around the field - Michael Corsetto [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 22-01-2013, 17:39
ZombieHippie ZombieHippie is offline
Registered User
FRC #1777
 
Join Date: Jan 2013
Location: Lenexa, Kansas
Posts: 2
ZombieHippie is an unknown quantity at this point
Do I need to jaguar.set() every iteration for my motors to stay on?

Is it necessary to set(); a Jaguar's speed every time upon execute() in my command?
Example:
can I change this:
Code:
        protected void initialize() {

		setTimeout(timeout);

		hasFinished = false;

		arm.setSpeed(this.speed);

	}
	protected void execute() {

		arm.setSpeed(this.speed);

		if (arm.getSensorRetracted())

			hasFinished = true;

	}
TO this:


Code:
       protected void initialize() {

		setTimeout(timeout);

		hasFinished = false;

		arm.setSpeed(this.speed);

	}


	protected void execute() {

                //The difference

		if (arm.getSensorRetracted())

			hasFinished = true;

	}
Thanks!

Last edited by ZombieHippie : 22-01-2013 at 20:15.
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2013, 16:08
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Do I need to jaguar.set() every iteration for my motors to stay on?

Quote:
Originally Posted by ZombieHippie View Post
Is it necessary to set(); a Jaguar's speed every time upon execute() in my command?
Example:
can I change this:
Code:
        protected void initialize() {

		setTimeout(timeout);

		hasFinished = false;

		arm.setSpeed(this.speed);

	}
	protected void execute() {

		arm.setSpeed(this.speed);

		if (arm.getSensorRetracted())

			hasFinished = true;

	}
TO this:


Code:
       protected void initialize() {

		setTimeout(timeout);

		hasFinished = false;

		arm.setSpeed(this.speed);

	}


	protected void execute() {

                //The difference

		if (arm.getSensorRetracted())

			hasFinished = true;

	}
Thanks!
as long as arm is a required subsystem.

also, if your using java, dont set hasFinished but rather just do

protected void isFinished(){
return arm.getSensorRetracted();
}
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2013, 17:49
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,073
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Command execute(){jaguar.set(speed);} necessary?

The safety mechanisms built into WPILib and the cRIO mean you have to update the rate of a Jaguar every (I forget the exact number) microseconds or the digital module won't update the rate for safety reasons.

As long as you update it faster than once every (I forget the number) microseconds, you should be fine.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2013, 18:58
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Command execute(){jaguar.set(speed);} necessary?

The motor safety stuff is enabled by default on the RobotDrive class and disabled by default everywhere else. You can just set the motor speed in the initialize() method and check if it's finished in the isFinished() method. Often the execute method can be empty.

For safety you can enable the motor safety on the actuator in question or use a timeout to make sure it turns off.

If you are relying on a sensor to stop the motor, you can add a timeout to the command and make sure it ends even if the sensor is never tripped. Just set the timeout to something longer than you'd expect the operation to take. Then in the end() method stop the motor and call the end() method from the interrupted() method. That way the robot won't destroy itself if a sensor fails.

Look at the gearsbot example or the WPILib Cookbook to see how the timeout stuff works.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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 10:09.

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