Go to Post Mentors learn from, are inspired by, and emulate each other. A team with a great lead mentor leads to a productive, inspired, and ultimately successful group of mentors. - Jared Russell [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-03-2016, 19:00
s5511's Avatar
s5511 s5511 is offline
Registered User
FRC #5511
 
Join Date: Jan 2016
Location: Cary, NC
Posts: 58
s5511 is an unknown quantity at this point
Teleop Automated Sequences

Our team uses Labview for robot code, and we want to have a button that the driver can press during teleoperated that starts an automated sequence. For example, our driver would press a button during teleop and the robot would automatically accelerate the shooter, actuate pistons, and shoot the ball.

How would we accomplish this functionality with our Labview robot code?

Thanks!
  #2   Spotlight this post!  
Unread 21-03-2016, 19:53
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,856
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Teleop Automated Sequences

Easiest to put in Periodic Tasks where the delay won't break teleop and it would look something like this:
Attached Thumbnails
Click image for larger version

Name:	TimedSequenceExample.png
Views:	220
Size:	60.0 KB
ID:	20409  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 22-03-2016, 22:05
Muzzle127 Muzzle127 is offline
Registered User
FRC #4368
 
Join Date: Mar 2016
Location: Kalamazoo
Posts: 5
Muzzle127 is an unknown quantity at this point
Re: Teleop Automated Sequences

Hi, we tried your example in frc 2016 and the sequence does not seem to have the correct timing. Any thoughts?
  #4   Spotlight this post!  
Unread 22-03-2016, 22:10
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Teleop Automated Sequences

If it's only timing that seems off, you can easily adjust it by modifying the constants going to the Wait functions.
  #5   Spotlight this post!  
Unread 22-03-2016, 22:20
Muzzle127 Muzzle127 is offline
Registered User
FRC #4368
 
Join Date: Mar 2016
Location: Kalamazoo
Posts: 5
Muzzle127 is an unknown quantity at this point
Re: Teleop Automated Sequences

We turned time up wait time sequence to turn motors on to 5000msec and the response is around 1ooo msec. It executes the sequence, but not at the right times programmed. We could just keep increasing the time, but that doesn't seem correct. The while loop execution is 20msec. Is periodic task timing controlled by another variable that would overwrite the wait time function?

Last edited by Muzzle127 : 22-03-2016 at 22:25.
  #6   Spotlight this post!  
Unread 22-03-2016, 22:33
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Teleop Automated Sequences

The 20 millisecond wait in the outer While block doesn't affect the timing inside the flat sequence. It only matters when the condition to start the sequence hasn't yet happened, and all it does is ensure that the code doesn't use all the CPU time while it's waiting for the right input.

If you post your Autonomous code and tell us what you want it to do, we can look at it and tell you what you need to change to make it do that.
  #7   Spotlight this post!  
Unread 22-03-2016, 22:52
Muzzle127 Muzzle127 is offline
Registered User
FRC #4368
 
Join Date: Mar 2016
Location: Kalamazoo
Posts: 5
Muzzle127 is an unknown quantity at this point
Re: Teleop Automated Sequences

It is the example code posted above, put into periodic tasks, with the times and references changed. Again, the code executes as if wait times are off by a factor of 10
  #8   Spotlight this post!  
Unread 23-03-2016, 07:06
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Teleop Automated Sequences

Quote:
Originally Posted by Muzzle127 View Post
It is the example code posted above, put into periodic tasks, with the times and references changed. Again, the code executes as if wait times are off by a factor of 10
"...with the times and references changed..."

Changed to what? Did Mark's example code actually match the servo and motor that you have on your robot? What timing do you want it to have, and what timing are you experiencing?

I can't help you if you only give me pre-interpreted and inconsistent information. For example, earlier you said 5000ms was giving you 1000, and now you call the discrepancy a factor of 10. You also referred to "motors" before, but Mark's code only has one motor. Please show the relevant part of your program, explain in detail what you're expecting it to do, and describe what you're seeing it do instead.

Last edited by Alan Anderson : 23-03-2016 at 07:08.
  #9   Spotlight this post!  
Unread 23-03-2016, 08:06
Muzzle127 Muzzle127 is offline
Registered User
FRC #4368
 
Join Date: Mar 2016
Location: Kalamazoo
Posts: 5
Muzzle127 is an unknown quantity at this point
Re: Teleop Automated Sequences

Hi Alan, I've updated a screen shot of our periodic task code. So regarding time changes, physically on robot code executes much faster than the times stated. You see anything that would cause this?

Thanks
Attached Thumbnails
Click image for larger version

Name:	Periodic_Tasks_update_with_autoshootd.png
Views:	69
Size:	25.5 KB
ID:	20426  
  #10   Spotlight this post!  
Unread 23-03-2016, 08:48
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Teleop Automated Sequences

Quote:
Originally Posted by Muzzle127 View Post
We turned time up wait time sequence to turn motors on to 5000msec and the response is around 1ooo msec. It executes the sequence, but not at the right times programmed. We could just keep increasing the time, but that doesn't seem correct. The while loop execution is 20msec. Is periodic task timing controlled by another variable that would overwrite the wait time function?
You run the motor at 75% power for 100 milliseconds, then turn it off for 1500 milliseconds, then run it at 100% power for 1000 milliseconds.

The 100 ms will make the motor twitch and you might not even see that depending on what it's attached to.

I'm guessing the 1500ms off period is your delayed response time you're seeing. The code is working exactly as you wrote it to work.

Maybe it'll help if you describe what you think it should do because all I can do is look at your code and guess.

You're also missing motor refnum inputs in sequences 3 and 4 for Shooter 2.

Your maximum response time is 100ms or less.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 23-03-2016 at 08:53.
  #11   Spotlight this post!  
Unread 23-03-2016, 08:51
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Teleop Automated Sequences

Thank you for the screen shot. It's actually quite different from the example Mark gave. There's no way I could have understood what you were trying to do based on your previous descriptions.

Now for the second part of what I asked: what exactly are you wanting it to do, and with what timing? Give me a detailed script of which motor is supposed to run, at what power and direction, at each moment of the sequence.


Here's what I see the code doing:
  • Wait for a button to be pressed on the joystick (it might take up to 100 milliseconds for the code to notice the button).
  • Run the Kicker motor in reverse at 75% power for 100 ms.
  • Stop the Kicker motor and run both Shooter motors in reverse at full power for 1500 ms.
  • Leave the Shooter motors running and run the Kicker motor forward at full speed for 1000 ms.
  • Stop the Shooter 1 motor and leave the Kicker and Shooter 2 motors running for 100 ms.
  • Wait 1000 ms while the Kicker and Shooter 2 motors continue running.
  • Leave the Kicker and Shooter 2 motors running with Shooter 1 stopped while waiting for the joystick button to be pressed again.

Here's what I see that doesn't look quite right:
  • You have merged Mark's example with the existing 100ms loop in Periodic Tasks. That's probably okay, but it was intended to be its own loop.
  • You're continually calling the RefNum Get functions throughout the sequence. It'll work, but it's a lot cleaner (and less wasteful of CPU cycles) to do it with a single RefNum Get for each motor and tunnel the RefNum between sequence frames the way the example shows.
  • You are wiring the Error values as if to force sequential operation. I don't see anywhere that changes the code's behavior, although the Flat Sequence itself is meant to do sequencing (that's why it has the name it does).
  • Shooter 2 is only controlled once, to turn it on.
  • You are not turning off all the motors when the sequence finishes.

I don't see anything that matches your earlier mention of 5000 milliseconds.
  #12   Spotlight this post!  
Unread 23-03-2016, 09:13
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Teleop Automated Sequences

Here's what Alan is talking about. I also tried to interpret what you're doing by guessing, so this probably isn't correct.

Check out the logic on the last sequence frame... it doesn't do anything unless you want to wait a second between restarting the shooter sequence.

Another added benefit of putting your RefNum Gets before the while loop is you only have one of each, which reduces the likelihood that you misspell the name and have something bad happen (if you have a interference mechanical design, such as what our robot has). This way, the whole mechanism works or doesn't work.
Attached Thumbnails
Click image for larger version

Name:	4368 Shooter Code Screenshot.png
Views:	40
Size:	27.0 KB
ID:	20427  
Attached Files
File Type: vi 4368 Shooter Code.vi (26.5 KB, 4 views)
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 23-03-2016 at 09:15.
  #13   Spotlight this post!  
Unread 23-03-2016, 12:05
Muzzle127 Muzzle127 is offline
Registered User
FRC #4368
 
Join Date: Mar 2016
Location: Kalamazoo
Posts: 5
Muzzle127 is an unknown quantity at this point
Re: Teleop Automated Sequences

Thanks guys, we will try out suggested changes on Thursday night and see if we can get it working.
  #14   Spotlight this post!  
Unread 23-03-2016, 12:58
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Teleop Automated Sequences

Quote:
Originally Posted by Muzzle127 View Post
Thanks guys, we will try out suggested changes on Thursday night and see if we can get it working.
To note, what I posted isn't a suggested change. I don't know what you want the code to do. I only based it off of what was definitely wrong in the code you posted earlier.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
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 00:08.

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