Go to Post it takes a village to raise a robot. - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 08-05-2013, 16:30
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Record Robot Actions

Quote:
Originally Posted by thetimemachine View Post
So I grasp the concept of recording but how would someone save those and play it back?

[Any example code? ....in LabVIEW]
Unfortunately, we did ours in Java using the command based code design. So what we did was started a command using the drive subsystem and each run through of the command we appended the values to the end of a file. Then to play it back we started a new command that read the top line off of that file and sent the values to the subsystem. Using that structure all of the timing was handled for us. We are doing a complete code rewrite currently to clean up the implementation, I can get you samples of our code at some point if you'd like.

Last edited by notmattlythgoe : 08-05-2013 at 16:33.
Reply With Quote
  #2   Spotlight this post!  
Unread 08-05-2013, 16:33
sarah_storer's Avatar
sarah_storer sarah_storer is offline
Georgia Tech RoboJackets Outreach
AKA: Sarah Storer
FRC #5332 (Toaster Tech)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Atlanta, GA
Posts: 147
sarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to behold
Re: Record Robot Actions

Quote:
Originally Posted by notmattlythgoe View Post
Unfortunately, we did ours in Java using the command based code design. So what we did was started a command using the drive subsystem and each run through of the command we appended the values to the end of a file. Then to play it back we started a new command that read the top line off of that file and sent the values to the subsystem. Using that structure all of the timing was handled for us.
Personally text based code makes WAY more sense to me...I don't know a ton about LabVIEW but its what our robot is coded in:/....
__________________

TEAM 3753 BULAH BOTS ALUMNI
2012-2015: Code, pneumatics, and electrical for BULAH BOTS Team 3753
2013: Bayou Regional 1st seed alliance captain and regional winners (With 118 and 4589)
2014, 2015: Bayou Regional semi-finalist
2016-?: Mentor for TOASTER TECH Team 5332
2016: Columbus District 3rd seed alliance captain, semi-finalist; Kennesaw District 3rd seed alliance 1st pick, semi-finalist; Peachtree District State Championship 4th seed alliance captain, quarter-finalist, Industrial Design Award, World Championship qualification
Reply With Quote
  #3   Spotlight this post!  
Unread 08-05-2013, 16:36
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Record Robot Actions

Quote:
Originally Posted by thetimemachine View Post
Personally text based code makes WAY more sense to me...I don't know a ton about LabVIEW but its what our robot is coded in:/....
Is there a specific reason that you guys used Labview? We switched to Java last year and have absolutely loved the Command Based system. We had used Labview before that, main reason for switching was the use in school and both the other mentor and I were better versed in it.

You can see the recording used in this video to hang on the lower bar. Our driver lines up under the bar and pushes a button and the robot drives backwards and drives forward. This was recorded on the practice field at the competition when we realized that our hanging mechanism was very sensitive to the speed that you hit the bar at. After the recording was done it was an extremely reliable mechanism.

http://www.youtube.com/watch?feature...NufVQ#t=12 1s

Last edited by notmattlythgoe : 08-05-2013 at 16:45.
Reply With Quote
  #4   Spotlight this post!  
Unread 08-05-2013, 16:44
sarah_storer's Avatar
sarah_storer sarah_storer is offline
Georgia Tech RoboJackets Outreach
AKA: Sarah Storer
FRC #5332 (Toaster Tech)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Atlanta, GA
Posts: 147
sarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to behold
Re: Record Robot Actions

Quote:
Originally Posted by notmattlythgoe View Post
Is there a specific reason that you guys used Labview? We switched to Java last year and have absolutely loved the Command Based system. We had used Labview before that, main reason for switching was the use in school and both the other mentor and I were better versed in it.
Because there is theoretically more support for LabVIEW and because its supposed to be "easier" because its visual.....I fail to see the easy part:/ But I don't think we can switch to anything else because I know more [even though its just a little] LabVIEW than Java or C++ or something like that...
__________________

TEAM 3753 BULAH BOTS ALUMNI
2012-2015: Code, pneumatics, and electrical for BULAH BOTS Team 3753
2013: Bayou Regional 1st seed alliance captain and regional winners (With 118 and 4589)
2014, 2015: Bayou Regional semi-finalist
2016-?: Mentor for TOASTER TECH Team 5332
2016: Columbus District 3rd seed alliance captain, semi-finalist; Kennesaw District 3rd seed alliance 1st pick, semi-finalist; Peachtree District State Championship 4th seed alliance captain, quarter-finalist, Industrial Design Award, World Championship qualification
Reply With Quote
  #5   Spotlight this post!  
Unread 08-05-2013, 16:47
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Record Robot Actions

Quote:
Originally Posted by thetimemachine View Post
Because there is theoretically more support for LabVIEW and because its supposed to be "easier" because its visual.....I fail to see the easy part:/ But I don't think we can switch to anything else because I know more [even though its just a little] LabVIEW than Java or C++ or something like that...
Now would be the time to switch if you wanted to try a text based language. A great off season project if you wanted to learn one of the other languages is to reprogram the robot in another language. If you would like, once we finish the code rewrite I can send you all of our robot code so you can see what the code for a robot would look like.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-05-2013, 22:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Record Robot Actions

The first attached image shows one way to record all data from one joystick every 20ms until the Done button is pressed. It then optionally saves it to a file. This code would fit well into periodic tasks.

The second image shows how to read all of the data from file and play it back at the same rate.

You probably don't need all six axes of the joystick, and you may want to record more than one. If that is the case, modify the data that goes into the cluster.

If you want to record the motor values and solenoid/relay values instead, that is an easy alternative and can be output from the Drive Robot function, accumulated, and logged.

If you decide to store sensor values and add control loops to the playback, that is indeed harder, and I'd recommend instead that you put that code into Drive Robot and store the set points.

If you are worried about memory usage, you most likely don't need more than 50 elements per second for no more than 15 seconds, or 750 elements in the array. The full joystick data is 50 bytes per element. Even if you store lots more values, for 1KByte per record, you still haven't used a megabyte, so you shouldn't have any memory issues. If you want to optimize for memory, you can move the file I/O inside the loop to avoid the largish array, scale the values from doubles to smaller values, use timestamps to compress the data, or do all sorts of other fun things.

As for switching to a different language, or practicing the language your team used this year, the off season is a great time to do it. I don't know of anything in command based programming that would make this any easier. Personally, I'd encourage you to become familiar with several of the languages as they each have unique features and values.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	38
Size:	122.4 KB
ID:	14798  Click image for larger version

Name:	Clipboard 2.png
Views:	36
Size:	50.0 KB
ID:	14799  
Reply With Quote
  #7   Spotlight this post!  
Unread 09-05-2013, 08:14
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Record Robot Actions

Quote:
Originally Posted by Greg McKaskle View Post
The first attached image shows one way to record all data from one joystick every 20ms until the Done button is pressed. It then optionally saves it to a file. This code would fit well into periodic tasks.

The second image shows how to read all of the data from file and play it back at the same rate.

You probably don't need all six axes of the joystick, and you may want to record more than one. If that is the case, modify the data that goes into the cluster.

If you want to record the motor values and solenoid/relay values instead, that is an easy alternative and can be output from the Drive Robot function, accumulated, and logged.

If you decide to store sensor values and add control loops to the playback, that is indeed harder, and I'd recommend instead that you put that code into Drive Robot and store the set points.

If you are worried about memory usage, you most likely don't need more than 50 elements per second for no more than 15 seconds, or 750 elements in the array. The full joystick data is 50 bytes per element. Even if you store lots more values, for 1KByte per record, you still haven't used a megabyte, so you shouldn't have any memory issues. If you want to optimize for memory, you can move the file I/O inside the loop to avoid the largish array, scale the values from doubles to smaller values, use timestamps to compress the data, or do all sorts of other fun things.

As for switching to a different language, or practicing the language your team used this year, the off season is a great time to do it. I don't know of anything in command based programming that would make this any easier. Personally, I'd encourage you to become familiar with several of the languages as they each have unique features and values.

Greg McKaskle
I agree completely Greg. No one language is better than another, and it is a great tool to have knowledge of several different languages.
Reply With Quote
  #8   Spotlight this post!  
Unread 09-05-2013, 10:30
sarah_storer's Avatar
sarah_storer sarah_storer is offline
Georgia Tech RoboJackets Outreach
AKA: Sarah Storer
FRC #5332 (Toaster Tech)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Atlanta, GA
Posts: 147
sarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to beholdsarah_storer is a splendid one to behold
Re: Record Robot Actions

Thank you so much for the pictures that should help a lot!

I will probably look into C++ in the off season..but this and vision processing in LabVIEW will come first... [Our team is also working on making an encyclopedia for everything in FRC so that'll take some time too...]

I'll bring this up to our coach and we'll try it out
__________________

TEAM 3753 BULAH BOTS ALUMNI
2012-2015: Code, pneumatics, and electrical for BULAH BOTS Team 3753
2013: Bayou Regional 1st seed alliance captain and regional winners (With 118 and 4589)
2014, 2015: Bayou Regional semi-finalist
2016-?: Mentor for TOASTER TECH Team 5332
2016: Columbus District 3rd seed alliance captain, semi-finalist; Kennesaw District 3rd seed alliance 1st pick, semi-finalist; Peachtree District State Championship 4th seed alliance captain, quarter-finalist, Industrial Design Award, World Championship qualification
Reply With Quote
  #9   Spotlight this post!  
Unread 09-05-2013, 20:27
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Record Robot Actions

Be sure to fix my misspelling in the path.

Greg McKaskle
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:52.

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