Go to Post [in response to http://www.welovefirst.com/] I feel like I've just been FIRST Rick Rolled. - kramarczyk [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 30-03-2011, 19:19
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Increase a value using a joystick

I want to increase a value over time when using the joystick. The value would start out at zero and you would press the joystick forward, the longer you press it forward the larger the value gets and when you hold the joystick down the value gets smaller over time.
Reply With Quote
  #2   Spotlight this post!  
Unread 30-03-2011, 19:24
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Increase a value using a joystick

I'd have a feedback node/shift register storing the current value, and each iteration the value of the joystick adds to it. It'd probably be a good idea to make a separate loop in periodic tasks so that you get a constant rate.

What are you using this for?
Reply With Quote
  #3   Spotlight this post!  
Unread 30-03-2011, 19:27
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Increase a value using a joystick

I think you are looking for a "shift register". It is a node that remembers the last thing that you wrote to it.

This can be found on the Programming -> Structures palette. It looks like an arrow in a rectangle. It can point in either direction (right click to change). New data goes into the tail of the arrow, old data comes out the tip of it.
Reply With Quote
  #4   Spotlight this post!  
Unread 30-03-2011, 19:37
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Increase a value using a joystick

In simplest terms, I'm trying to move a point on a graph using the joystick. I can get it to increase and decrease, i just need to make it so that it is not so rapid. Would i just put a wait timer in there or would that slow down the code?
Reply With Quote
  #5   Spotlight this post!  
Unread 30-03-2011, 19:41
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,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: Increase a value using a joystick

A wait timer would slow down Teleop, but would work fine in Periodic Tasks.
Anything you can do in Teleop, you can also do in Periodic Tasks if you need explicit delays.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #6   Spotlight this post!  
Unread 30-03-2011, 19:50
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Increase a value using a joystick

This isn't part of the robot project. This is just a simulator
Reply With Quote
  #7   Spotlight this post!  
Unread 30-03-2011, 19:54
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Increase a value using a joystick

Would i just have the values writing in a separate while loop with a wait timer in it?
Reply With Quote
  #8   Spotlight this post!  
Unread 30-03-2011, 19:55
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Increase a value using a joystick

Lets say you hold the joystick full forward "forever". What do you want the output to be? Should it keep going up, or settle to match the joystick's position?
Reply With Quote
  #9   Spotlight this post!  
Unread 30-03-2011, 19:56
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Increase a value using a joystick

keep going up
Reply With Quote
  #10   Spotlight this post!  
Unread 30-03-2011, 20:33
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,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: Increase a value using a joystick

A separate, independent while loop that constantly checks the joystick at the rate you decide upon would work.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #11   Spotlight this post!  
Unread 30-03-2011, 23:46
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Increase a value using a joystick

Or if you want to be fancy, you could have it update the value every so often, while still running the loop.

Better still, have it update the value every iteration, but have something that reads the speed of the loop and divides the value of the joystick by a number proportional to that.

Or just add the timer...

You should have the program generate a maze, plot it on an XY graph, and then use the joystick to navigate the maze. That would be epic.
Reply With Quote
  #12   Spotlight this post!  
Unread 30-03-2011, 23:57
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Increase a value using a joystick

I like your ideas WizenedEE! but I'm just trying to simulate a robot drive (which is a lot easier than I originally thought!). That maze project sounds like some good practice
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 20:44.

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