Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Encoder data recording (http://www.chiefdelphi.com/forums/showthread.php?t=113007)

ekapalka 07-02-2013 22:43

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!

virtuald 07-02-2013 23:42

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. :)

ekapalka 08-02-2013 13:58

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)


All times are GMT -5. The time now is 12:56.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi