Go to Post Now stop reading CD, do your homework, eat your peas, brush your teeth, and go to bed. Any time you spend speculating as to what Dave's ravings might mean is completely wasted. - Richard Wallace [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 02-07-2013, 10:43 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Encoder data recording

Hello! I was watching a video on the TrossenRobotics YT channel about position feedback and data storage and it occurred to me that this would be an amazing thing to be able to do with our robot using encoders. Does anyone happen to know how you could capture data from the encoders and play back the movements of the robot in reverse? I'm not even sure where to begin with the logic. We (hopefully) have a pretty foolproof autonomous that mostly uses dead-reckoning, so this would is probably for a summer project / non-competition robot. I'm thinking we would record our data in three arrays; one for the elapsed time, one for the left encoder, and one for the right encoder. I have no idea how exactly we would do that. Another issue might be storing that data for long term (I'm not very familiar with polymorphic coding, so I don't think we would store the data within the code...). If anyone has any thoughts on this subject, feel free to share!

Last edited by ekapalka : 02-07-2013 at 10:46 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-07-2013, 11:42 PM
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,033
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Encoder data recording

Another way to go about it is just record the joystick movements, and replay those back. We did this in 2003, the first year that they had autonomous mode. It worked quite well for that year's game.... but probably wouldn't be as useful for this year's game.

You wouldn't store the data in the code, but you could write it out to a file, and then read it back in again. Search the forums, there's probably a post somewhere that tells you how to read/write files.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 02-08-2013, 01:58 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Encoder data recording

I've been looking, but I'm not sure how what I've found helps me. I would like to use a text file to make something like a lookup table. Here's what I have for logic so far:
Code:
/*hopefully all of this data can be collected 
and stored in a text file elsewhere during one 
of the autonomous modes (collect)*/

int arrayLength = 7; 

/*probbly 150-1500 depending on if the data 
samples are in tenths or hundredths of a second.  
Tenths here, and assuming that the autonomous 
period is only 15 seconds*/

float leftside [] = {1,0.9,0.7,0.9,1,0.3,0.9}; //etc...etc..
float rightside [] = {1,1,0.8,1,1,0.4,1};      //etc...etc...
for (int i = arrayLength; i > 0; i--)
{
	Leftmotor->Set(leftside[i])
	Rightmotor->Set(rightside[i])
	Wait(0.1); 

	/*Wait the same interval of time as the data 
        collected.  0.1 for tenths, 0.01 for hundredths, 
        etc...*/
}
/*Implimentation: Record encoder data during practice 
rounds in special dedicated autonomous to a text file.  
Then play back the data in another autonomous mode 
(case 2).  This may not all be syntactically correct*/
(I'm not entirely sure what the encoder sample rate/second is)

Last edited by ekapalka : 02-08-2013 at 02:01 PM.
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 09:56 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