Go to Post The rule is the rule because it is the rule. - dtengineering [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #31   Spotlight this post!  
Unread 03-04-2016, 11:10 AM
414cnewq 414cnewq is offline
Registered User
FRC #3844 (Kentucky Wildbots)
Team Role: Alumni
 
Join Date: Jul 2014
Rookie Year: 2014
Location: KY
Posts: 86
414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of414cnewq has much to be proud of
Re: 2220's Play/Record Macro for Autonomous

Has anyone done this for C++?
  #32   Spotlight this post!  
Unread 03-04-2016, 11:14 AM
Oromus's Avatar
Oromus Oromus is offline
Lead Programmer, Community Liason
AKA: Ryan
FRC #1902 (Exploding Bacon)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Florida
Posts: 80
Oromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to behold
Re: 2220's Play/Record Macro for Autonomous

Quote:
Originally Posted by Jaci View Post
I don't think it's viable. If the play/record is recording actual motor output, that would depend on the voltage of the battery at time of recording. If it's recording desired output, PID wouldn't be viable as the actual output is updated every tick, meaning the PID has no effect. Unless you've got a master control loop running at ~100-150Hz, it wouldn't do much, and even then, you'd see a lot of jitter.
Oh, I didn't mean to imply we were using PID loops to replay our recordings this year. We've just opted for a mapping program and just straight programming it. Last year we did PID loops assisting with recording, and it worked well (but wound up not being used). We recorded the encoder position/gyro angle constantly, then reduced them to a smaller set of targets and commands. For example, if the encoder values increased steadily for 4 seconds then stopped, that got reduced to a single PID drive command telling the Robot to drive to the encoder position that was at the end of those 4 seconds. We got it working fully, but then realized it was less work on the robot (and more accurate) to have a few pre-programmed instructions instead of trying to mimic a human driver.

EDIT: The battery voltage problem was something we noticed in the first day, which is why we switched to PID. This is what I'm warning the creators of this macro about
__________________


2016 Roles: Manipulator, Strategy Co-Lead, Programmer
2016 Orlando Regional: Quarterfinalist (Captain w/ 1557, 5557 and 4352)
2016 Rocket City Regional: Quarterfinalist (w/ 283 and 34), Regional Chairman's Award Winner
2016 Championship: N/A (had fun and was inspired, that's what counts)
-------------
2015 Role: Programmer
2015 GSCR: Quarterfinalist (w/ 4189 and 4026), Regional Chairman's Award Winner
2015 Orlando Regional: Semifinalist (w/ 456 and 86), Imagery Award Winner
2015 Championship: Pit Safety Award Winner

Last edited by Oromus : 03-04-2016 at 11:17 AM.
  #33   Spotlight this post!  
Unread 03-04-2016, 11:20 AM
Jaci's Avatar
Jaci Jaci is offline
Registered User
AKA: Jaci R Brunning
FRC #5333 (Can't C# | OpenRIO)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Perth, Western Australia
Posts: 251
Jaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond repute
Re: 2220's Play/Record Macro for Autonomous

Quote:
Originally Posted by Oromus View Post
Oh, I didn't mean to imply we were using PID loops to replay our recordings this year. We've just opted for a mapping program and just straight programming it. Last year we did PID loops assisting with recording, and it worked well (but wound up not being used). We recorded the encoder position/gyro angle constantly, then reduced them to a smaller set of targets and commands. For example, if the encoder values increased steadily for 4 seconds then stopped, that got reduced to a single PID drive command telling the Robot to drive to the encoder position that was at the end of those 4 seconds. We got it working fully, but then realized it was less work on the robot (and more accurate) to have a few pre-programmed instructions instead of trying to mimic a human driver.

EDIT: The battery voltage problem was something we noticed in the first day, which is why we switched to PID. This is what I'm warning the creators of this macro about
Ahh, I was talking about the initial proposal for putting it into play/record . Afaik most play-record programs will just read at a given interval and pipe it out to file. It's effective, but has a lot of room for error. I like to think of it as the autonomous last-resort if you don't have vision or motion profiling. It's still better than sitting still

That's just my opinion though, I still think record/play is very effective, especially for games like 2015. For 2016 though, I can see the defenses causing issues.
__________________
Jacinta R

Curtin FRC (5333+5663) : Mentor
5333 : Former [Captain | Programmer | Driver], Now Mentor
OpenRIO : Owner

Website | Twitter | Github
jaci.brunning@gmail.com
  #34   Spotlight this post!  
Unread 03-06-2016, 09:06 AM
3072Cap 3072Cap is offline
Registered User
FRC #3072
 
Join Date: Feb 2016
Location: Wytheville, Va
Posts: 22
3072Cap is an unknown quantity at this point
Re: 2220's Play/Record Macro for Autonomous

Quote:
Originally Posted by AlexC View Post
I requested access, can I please get this?
  #35   Spotlight this post!  
Unread 03-07-2016, 06:35 PM
Hsifeulbhsifder Hsifeulbhsifder is offline
Programmer
AKA: Zaeem Mohamed
FRC #5428 (Breaking Bots)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Markham, ON, Canada
Posts: 41
Hsifeulbhsifder is on a distinguished road
Re: 2220's Play/Record Macro for Autonomous

We were able to accomplish this in C++ by representing the input in a struct:
Code:
typedef struct{
        float analog[NUM_ANALOG];
        bool digital[NUM_DIGITAL];
} Gamepad;

typedef struct{
        Gamepad gamepads[2];
} Input;
Then we wrote the input struct to a file:

Code:
Input input = {0};
int file = open(filename, O_RDWR, S_IWRITE | S_IREAD);

//start of control loop (eg. TeleopPeriodic)

//do stuff with the input for that loop (get input from driver station)
input = GetInputOrSomethingSimilar();

write(file, &input, sizeof(input));

//end loop

close(file);
Now essentially we flushed the data of the input struct to the file once per loop, so the state of the input is recorded in the order it appears. To playback, we just read the file once per loop, moving the read cursor of the file by the size of the input, and gave the data to the functions that required input instead of directly from the controller:

Code:
Input input = {0};
int file = open(filename, O_RDWR, S_IWRITE | S_IREAD);

//start of control loop (eg. AutonomousPeriodic)

read(file, &input, sizeof(input));

//Give the input to whatever controls it
ControlRobotOrSomethingSimilar(&input);

//end loop

close(file);
Thats how we did it, by storing the files on the roborio, and accessing them when we needed it. But wait! You may be wondering why we would record the input of some buttons if we haven't pressed the buttons? Well the answer is simple; If your loop time is constant (which it is if you are using iterative), then the recording of inactive buttons as well as active buttons preserves the time for which those buttons are inactive or active exactly as the driver had done so the first time.

This feature has helped our team for more than just autonomous. For example: since we store the recording in a buffer (and a file), we can use it as a circular buffer, allowing us to loop over driver input while we PID tune without having to touch the controller.
__________________
Hsifeulbhsifder
___________________
"Any given computer program is obsolete, any set of written rules is incomplete"
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 08:45 PM.

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