Go to Post Give a group of engineers the choice of three options, and they'll pick choice number seven. - 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 04-03-2010, 19:46
helenajoy helenajoy is offline
Registered User
FRC #2437
 
Join Date: Nov 2008
Location: Hawaii
Posts: 31
helenajoy is an unknown quantity at this point
Smile Teleop Issue - Motor Control Seems to Freeze

Our robot has a kicker controlled with pneumatics and is tanks drive. When the trigger is pulled, we have a sequence of solenoids (two double solenoids) that control the kicker. So, the trigger is linked to a case structure. When the trigger is pressed, there is a sequence within the case structure that happens. This works fine.

The problem is that when our second driver pulls the trigger and kicks, the first driver can no longer control the tank drive.

I am think that this is an issue with the case structure being in teleop. So, I included a tank drive sequence within that case structure.

But that didn't work. Our tank drive still cannot be controlled when the trigger sequence is happening...

Any ideas as to how to fix that?
Reply With Quote
  #2   Spotlight this post!  
Unread 04-03-2010, 20:26
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,752
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: Teleop Issue - Motor Control Seems to Freeze

It sounds like you have a lengthy sequence of code executing in the TeleOp. Since the TeleOp is busy, it cannot process new packets with joystick info.

There are two common approaches to this problem. One is to move the solenoid code into a parallel periodic loop. Then the TeleOp no longer does the work, but triggers it using a global or other notification and is then free to continue on processing joystick data. In the periodic loop, you can delay and take all the time you like to sequence the mechanism. The last thing it does is to reset the global and wait for the next trigger.

The other way of doing this is to merge this loop with the teleOp and build a state machine which ticks away at the solenoid waits with each call to teleOp, but never delays for more than 20ms. Actually, this is usually done simply by assuming that you will return a bit later and doing time comparisons to the last solenoid action and moving to the next step after enough time has elapsed, but by not using any delays.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 04-03-2010, 20:31
Wolfgang Wolfgang is offline
Registered User
AKA: Mehmed
FRC #1245 (Shazbots)
Team Role: Programmer
 
Join Date: Oct 2009
Rookie Year: 2010
Location: Denver
Posts: 47
Wolfgang is an unknown quantity at this point
Re: Teleop Issue - Motor Control Seems to Freeze

Generally, when it comes to TeleOp, and Autonomous as well, you want to include as few structures or loops as possible, because it slows the code down. If you can program the solenoids without a case structure, that would probably help a little bit.
Reply With Quote
  #4   Spotlight this post!  
Unread 04-03-2010, 20:39
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: Teleop Issue - Motor Control Seems to Freeze

Quote:
Originally Posted by Wolfgang View Post
Generally, when it comes to TeleOp, and Autonomous as well, you want to include as few structures or loops as possible, because it slows the code down. If you can program the solenoids without a case structure, that would probably help a little bit.
A Case structure does not have high overhead by itself. It is the code inside the case structure that is likely the problem.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #5   Spotlight this post!  
Unread 04-03-2010, 20:50
helenajoy helenajoy is offline
Registered User
FRC #2437
 
Join Date: Nov 2008
Location: Hawaii
Posts: 31
helenajoy is an unknown quantity at this point
Re: Teleop Issue - Motor Control Seems to Freeze

Quote:
Originally Posted by Greg McKaskle View Post
It sounds like you have a lengthy sequence of code executing in the TeleOp. Since the TeleOp is busy, it cannot process new packets with joystick info.

There are two common approaches to this problem. One is to move the solenoid code into a parallel periodic loop. Then the TeleOp no longer does the work, but triggers it using a global or other notification and is then free to continue on processing joystick data. In the periodic loop, you can delay and take all the time you like to sequence the mechanism. The last thing it does is to reset the global and wait for the next trigger.

The other way of doing this is to merge this loop with the teleOp and build a state machine which ticks away at the solenoid waits with each call to teleOp, but never delays for more than 20ms. Actually, this is usually done simply by assuming that you will return a bit later and doing time comparisons to the last solenoid action and moving to the next step after enough time has elapsed, but by not using any delays.

Greg McKaskle
Okay, so how would I go about doing these two methods? I'm a bit unfamiliar with these processes...
Reply With Quote
  #6   Spotlight this post!  
Unread 04-03-2010, 21:00
helenajoy helenajoy is offline
Registered User
FRC #2437
 
Join Date: Nov 2008
Location: Hawaii
Posts: 31
helenajoy is an unknown quantity at this point
Re: Teleop Issue - Motor Control Seems to Freeze

Also - will we be able to utilize the joystick trigger with these methods.

Which would be the quickest and most efficient method? (we are in the middle of a regional right now haha)
Reply With Quote
  #7   Spotlight this post!  
Unread 04-03-2010, 21:48
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: Teleop Issue - Motor Control Seems to Freeze

The quickest method to fix any issue you are not very familiar with during a regional is to proceed to Pit Admin or your Lead Robot Inspector and ask if they can find you some assistance.

Teams are just as friendly in real life as they are here on CD.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #8   Spotlight this post!  
Unread 05-03-2010, 08:16
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,752
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: Teleop Issue - Motor Control Seems to Freeze

Personally, I'd do the parallel periodic task loop. You will copy the code that does the solenoid and put it in the periodic loop. You still have teleOp code that checks the trigger, but now will just set a global. The periodic loop will check the global. Once the new code looks right, you can start disconnecting and deleting the stuff from Periodic.

Greg McKaskle
Reply With Quote
  #9   Spotlight this post!  
Unread 05-03-2010, 09:01
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Teleop Issue - Motor Control Seems to Freeze

We implement things like this using a state machine.
Reply With Quote
  #10   Spotlight this post!  
Unread 05-03-2010, 09:49
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Teleop Issue - Motor Control Seems to Freeze

Quote:
Originally Posted by Greg McKaskle View Post
Personally, I'd do the parallel periodic task loop. You will copy the code that does the solenoid and put it in the periodic loop. You still have teleOp code that checks the trigger, but now will just set a global. The periodic loop will check the global. Once the new code looks right, you can start disconnecting and deleting the stuff from Periodic.

Greg McKaskle
With those "functional global" refnum VIs, it means you don't have to use a global variable at all; you can acquire the joystick data in periodic tasks just as easily as you can in Teleop.
So yes, take all the code in Teleop that actuates this kicker, and move it to Periodic tasks, with a 20ms wait in the empty case of the case structure.
(The driver station only sends data every 20ms, so there's no need to check any faster than that)
__________________
-- Marshal Horn
Reply With Quote
  #11   Spotlight this post!  
Unread 05-03-2010, 13:05
helenajoy helenajoy is offline
Registered User
FRC #2437
 
Join Date: Nov 2008
Location: Hawaii
Posts: 31
helenajoy is an unknown quantity at this point
Smile Re: Teleop Issue - Motor Control Seems to Freeze

In Teleop, I will keep the joystick code in but instead of the Button One (true/false value) into the state machine that currently holds my solenoid kicker code, I would wire it into a global variable and place the solenoid kicker code into Periodic Tasks? What would go within the global variable?

Or do I place the entire joystick code into Periodic Tasks - meaning I call the joystick in Periodic Tasks and link it to the solenoid kicker code within Periodic Tasks as well. And having nothing in Teleop?

Also, when I place the kicker code in Periodic Tasks, I place it in a state machine, right?
Reply With Quote
  #12   Spotlight this post!  
Unread 05-03-2010, 14:09
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Teleop Issue - Motor Control Seems to Freeze

Place the entire joystick code in periodic tasks.
There's only two main differences between Teleop and a loop in Periodic tasks:
  1. Teleop should be able to execute in less than 20ms, whereas a loop in Periodic Tasks can take as long as you like.
  2. The loop in Periodic tasks will execute regardless of what mode the Robot is in. (teleop, autonomous, disabled, etc.) With autonomous, this isn't a problem, because the robot does not receive updated joystick data during autonomous. (With Disabled it does, but all the outputs will be disabled. Depending on whether you use a time-based or sensor-based sequence, this might simply make the robot wait until it is re-enabled before kicking.)
__________________
-- Marshal Horn
Reply With Quote
  #13   Spotlight this post!  
Unread 06-03-2010, 12:40
helenajoy helenajoy is offline
Registered User
FRC #2437
 
Join Date: Nov 2008
Location: Hawaii
Posts: 31
helenajoy is an unknown quantity at this point
Smile Re: Teleop Issue - Motor Control Seems to Freeze

I placed the joystick and kicker code in Periodic Tasks. The kicker is extremely dependent on the watchdog delay and feed - we tested it and it seems like the timing is off (even though the kicker code is exactly the same). I am wondering if placing the code in Periodic Tasks messed with the delay and feed function? If so, how could I fix that?
Reply With Quote
  #14   Spotlight this post!  
Unread 07-03-2010, 11:27
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Teleop Issue - Motor Control Seems to Freeze

Use a "wait" function (found in the functions pallette under Programming > Timing)
Its icon is a watch symbol.
You will have to specify your waits in milliseconds (1/1000 of a second).

Alternately, I suppose you could get the Watchdog reference in Periodic Tasks and still use the "delay and feed" function. However, I believe there is only one user watchdog, so make sure to use the same reference (as opposed to opening a new one).
__________________
-- Marshal Horn
Reply With Quote
  #15   Spotlight this post!  
Unread 07-03-2010, 11:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Teleop Issue - Motor Control Seems to Freeze

Quote:
Originally Posted by helenajoy View Post
I placed the joystick and kicker code in Periodic Tasks. The kicker is extremely dependent on the watchdog delay and feed - we tested it and it seems like the timing is off (even though the kicker code is exactly the same). I am wondering if placing the code in Periodic Tasks messed with the delay and feed function? If so, how could I fix that?
You placed the joystick and kicker code in separate tasks (correct?). What iteration period (ms) did you assign to each of these tasks?

Please explain what you mean by "extremely dependent".


~
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Labview Servo Control Issue EricWilliams Programming 5 22-01-2010 14:24
Jaguars Slow Yellow Blink - Possible Control System Issue MikeDubreuil FRC Control System 3 26-01-2009 23:04
Driver Station Watch Dog / Motor Won't Spin Issue RMiller FRC Control System 5 20-01-2009 09:58
Small Banebots Motor Issue - Lessened torque and smoke sanddrag Motors 10 12-02-2007 21:41
CIM motor issue dmellich Motors 4 11-02-2005 11:10


All times are GMT -5. The time now is 22:04.

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