Go to Post You really don't want to mess with an engineer. - ChrisH [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 10-03-2013, 23:00
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
There are things I don't know...

Howdy

I tried to move drive motor control from TeleOp to PeriodicTasks, by sampling joystick data in TeleOp, pushing it to globals, then reading the globals in the periodic loops. Terrible results, laggy response, Y-axis data got around to working, X-axis virtually ignored.

With probes in place, I can see the data getting to the Arcade Drive instance, but the outputs were junk, moreson on the X-axis than the Y. I really thought a ~20mS loop shoveling data asynchronously to a 10mS loop would be no problem.

TeleOp and Autnomous VI fragments attached. Any thoughts?

TIA,
Tim
Attached Thumbnails
Click image for larger version

Name:	teleop1.png
Views:	71
Size:	32.8 KB
ID:	14308  Click image for larger version

Name:	Periodic1.png
Views:	60
Size:	43.3 KB
ID:	14309  
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
  #2   Spotlight this post!  
Unread 10-03-2013, 23:17
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,833
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: There are things I don't know...

Why don't you just read the joysticks directly in Periodic Tasks like you are already doing for button 1?
The Globals seem to add a completely unnecessary step.

I'd pull the Joystick Refnum outside the While loop. No reason to keep doing that over and over.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 10-03-2013 at 23:24.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-03-2013, 07:52
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: There are things I don't know...

I agree with Mark that going through the globals is not necessary and not necessarily the safest way to write it, but what you have shown should also work fine.

Can you be more specific about what the variable values were? Were they junk as in they were lagging or in that they were garbled? One thing that may be handy would be to plot them on a chart on the front panel in each location. That will change the timing a bit, but will help determine what the relationship is.

My suspicion is that something else is writing to the globals in another location. Right-click and Find will help locate them.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 13-03-2013, 00:58
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: There are things I don't know...

Thanks for the help. I have learned a few things

a) comm data from the DS is latched. This pushes more code out of TeleOp and nto PeriodicTasks, which seems like a good thing

b) The robot project remembers too much - on the Dashboard in Test mode, I saw old and new motors after I had changed the names. Blasted the build directory, old refs went away.

c) I see good axis data (after eliminating the globals) going into WPI Arcade Drive, but the wrong stuff out. I am beginning to suspect that Arcade Drive and Tank Drive cannot coexist on the same hardware connections at the same time. Tomorrows testing will probably reveal that ya cannot switch between Arcade and Tank on the fly.
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
  #5   Spotlight this post!  
Unread 13-03-2013, 01:46
Owen Makin Owen Makin is offline
Registered User
FRC #1972
 
Join Date: Jan 2013
Location: CUHS El Centro
Posts: 50
Owen Makin is an unknown quantity at this point
Re: There are things I don't know...

I can't tell what you are trying to do? Autonomous? regular tele-op?
Reply With Quote
  #6   Spotlight this post!  
Unread 13-03-2013, 07:08
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: There are things I don't know...

I marked my comments with **.

a) comm data from the DS is latched. This pushes more code out of TeleOp and nto PeriodicTasks, which seems like a good thing

** During autonomous, joystick and cypress values are latched to retain the last value of the disabled period. Additionally, it is possible to read joystick and other data multiple times from anywhere in the program you want. To me, this doesn't push code out of teleOp, but it does allow you to place it in Periodic.

b) The robot project remembers too much - on the Dashboard in Test mode, I saw old and new motors after I had changed the names. Blasted the build directory, old refs went away.

** SmartDashboard doesn't have a way to delete variables, so if you were to leave it running and change the robot code to have new SD variables, it would show old and new until you restarted the dashboard. But there shouldn't be any need to rebuild or blast.

c) I see good axis data (after eliminating the globals) going into WPI Arcade Drive, but the wrong stuff out. I am beginning to suspect that Arcade Drive and Tank Drive cannot coexist on the same hardware connections at the same time. Tomorrows testing will probably reveal that ya cannot switch between Arcade and Tank on the fly.

** I still don't understand what was wrong in the first place. Globals are thread safe and are perfectly fine for asynchronous transfer of data provided you don't cause your own race condition by having multiple writers that aren't coordinated. Arcade and Tank simply perform different math on the axis before updating the motors. Plenty teams use tank for TeleOp and Arcade for Autonomous. You should be able to open a 2 or 4 motor DriveSet and use either arcade or tank on it at will. They have no effect except to update the drive motors.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 14-03-2013, 00:03
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: There are things I don't know...

Quote:
Originally Posted by Owen Makin View Post
I can't tell what you are trying to do? Autonomous? regular tele-op?
I appreciate the attention to the problem.

I was trying to set up the drive motor nanny in Periodic to be agnostic to the source of its inputs. Thus, globals set in Autonomous or Teleop, read in Periodic. There seems to be something weird about how I get to this point that messes things up.
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
  #8   Spotlight this post!  
Unread 14-03-2013, 00:18
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: There are things I don't know...

Thanks Greg! Help from deep inside is appreciated (I finally looked you up
I'm at ***
Quote:
Originally Posted by Greg McKaskle View Post
I marked my comments with **.

a) comm data from the DS is latched. This pushes more code out of TeleOp and nto PeriodicTasks, which seems like a good thing

** During autonomous, joystick and cypress values are latched to retain the last value of the disabled period. Additionally, it is possible to read joystick and other data multiple times from anywhere in the program you want. To me, this doesn't push code out of teleOp, but it does allow you to place it in Periodic.

*** With my thought processes, it moves stuff around. I though I had to trap the data when a teleop packet arrived. What I meant by latched was the last arriving data is available until the next update from wherever.

b) The robot project remembers too much - on the Dashboard in Test mode, I saw old and new motors after I had changed the names. Blasted the build directory, old refs went away.

** SmartDashboard doesn't have a way to delete variables, so if you were to leave it running and change the robot code to have new SD variables, it would show old and new until you restarted the dashboard. But there shouldn't be any need to rebuild or blast.

*** It wasn't the DashBoard build that I blew away, but the robot project. I will run some experiments in two weeks to see if I can reproduce.

c) I see good axis data (after eliminating the globals) going into WPI Arcade Drive, but the wrong stuff out. I am beginning to suspect that Arcade Drive and Tank Drive cannot coexist on the same hardware connections at the same time. Tomorrows testing will probably reveal that ya cannot switch between Arcade and Tank on the fly.

** I still don't understand what was wrong in the first place. Globals are thread safe and are perfectly fine for asynchronous transfer of data provided you don't cause your own race condition by having multiple writers that aren't coordinated. Arcade and Tank simply perform different math on the axis before updating the motors. Plenty teams use tank for TeleOp and Arcade for Autonomous. You should be able to open a 2 or 4 motor DriveSet and use either arcade or tank on it at will. They have no effect except to update the drive motors.

Greg McKaskle
*** I am working slowly through transforming a "base arcade" project into where I ended up in trouble, testing far more often than I could before (the proto-robot is spending spring break in my living room). Today the input reads and motor control with style switching moved from Teleop to Periodic, and so far are behaving. Slightly different from the bad path (far fewer globals), but hopefully arriving at something we can use effectively next week.
__________________
Software Mentor
3853 Pridetronics[

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 22:48.

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