Go to Post The toughest part about that Chairman's Award was the fact that someone was cutting onions in the stands near 558/on the field while it was being read out. At least that was the excuse I'm going to use ;) - esquared [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-02-2014, 23:33
xf!r3's Avatar
xf!r3 xf!r3 is offline
Registered User
FRC #0100
 
Join Date: Dec 2011
Location: Redwood city, CA
Posts: 1
xf!r3 is an unknown quantity at this point
Saving values on cRIO

My team's robot has an arm with a potentiometer on it and I am trying to write a method that will save the current value of the pot and save it into the code so we can still have it when we restart the robot and not have to edit our code. Since I'm not exactly sure how to go about it I would like to know what is the most efficient way to do this. The language we are using is Java.
  #2   Spotlight this post!  
Unread 17-02-2014, 01:04
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 443
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Saving values on cRIO

You may find team 254s implementation of a constants.txt file useful:
https://github.com/Team254/FRC-2013/...tantsBase.java
https://github.com/Team254/FRC-2013/...Constants.java

It doesn't write out to a file. It looks for a text file on the crio at startup and allows you to override default values of variables in your program.

I'm assuming you want the ability to calibrate your arm angle without having to recompile code. This could be achieved by uploading new versions of a constants.txt file over FTP to your robot using the above implementation.

You could alternatively extend this implementation to allow the constants.txt file to be written to by the robot. Take a look at java.io.DataOutputStream
__________________
http://team2168.org
  #3   Spotlight this post!  
Unread 17-02-2014, 01:42
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,600
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: Saving values on cRIO

We use the Preferences class built into WPILib.
  #4   Spotlight this post!  
Unread 17-02-2014, 07:06
CooneyTech CooneyTech is offline
Registered User
FRC #0269
 
Join Date: Jan 2013
Location: Oconomowoc
Posts: 32
CooneyTech is an unknown quantity at this point
Re: Saving values on cRIO

Potentiometer or encoder? A potentiometer will always keep its position even without power whereas an encoder loses its position after power is lost. If it is a potentiometer you shouldn't need to save the value.
  #5   Spotlight this post!  
Unread 17-02-2014, 10:14
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 443
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Saving values on cRIO

Quote:
Originally Posted by CooneyTech View Post
If it is a potentiometer you shouldn't need to save the value.
Except for when you need to do maintenance on your mechanism, or replace a broken potentiometer. Any time you decouple the pot from the mechanism you'll likely need to recalibrate your zero.
__________________
http://team2168.org
Closed Thread


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 02:45.

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