|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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. |
|
#2
|
||||
|
||||
|
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. ![]() |
|
#3
|
||||
|
||||
|
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*/
Last edited by ekapalka : 02-08-2013 at 02:01 PM. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|