Go to Post Not all FIRST people are nuts. Some are threaded holes, rivets, velcro, or zip-ties. Anything but duct-tape. - Richard Wallace [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 20-02-2015, 14:19
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: functions for auto

Quote:
Originally Posted by Arhowk View Post
FYI you can build them to search for syntax errors... like this

Code:
	private static void wait(Robot r, double waittime) {
		while (true) {
			if (!.risAutonomous() || !r.isEnabled()) return;
			r.Timer.delay(waittime); //r or just timer?
			return;
		}
		private static void reset(Robot r) {
missing a } and i assume you mean ""!r.is..." not "!.ris..." (also, its just Timer.delay)

passing in Robot for everything is ugh-ly. just make Robot a singleton... or use a static initializer

Code:
			while (true) {
				double distance = r.encoder.get();
				double angle = r.gyro.getAngle();
				if (!r.isAutonomous() || !r.isEnabled()) return;
				r.robot.drive(-0.25, angle * r.Kp);
				//r.robot.drive(-0.40, 0);
				if (distance < -d) {
					reset(r);
					return;
				}
			}
the closed loop structure of this will hurt the robot, periodic ms timers are necessary

Code:
r.robot.drive(-.40, -1)
not Java-standard formatting

Code:
				Boolean maxarmlimit = r.limit4.get();
capital boolean (also that name scheme is bad, both on the variable and the limit)

Code:
					r.armmotor.set(Defines.ARM_SPEED);
					r.leftarmwheel.set(Relay.Value.kForward);
					r.rightarmwheel.set(Relay.Value.kReverse);
non-standard formatting (camelcase, descriptive names)

Code:
				if (angle > deg) {
comparing a double and an int

Code:
				r.robot.drive(-.40, -1);
constant loop? atleast a P loop, preferably PID

your "turn" and "turn2" functions are quite ineffective, basic angle averaging schemes should be used

other than that I'm losing my focus, but there are alot more issues
Alright thanks I am going to make those changes.
Reply With Quote
 


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 11:16.

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