Go to Post Now, almost a day later, no one has begun interpreting, dissecting, attaching synonyms, re-interpreting or otherwise mangling Dave's wise words in an effort to find the hidden key to the game. I smell a conspiracy! - petek [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-02-2015, 22:26
apm4242 apm4242 is online now
Registered User
FRC #4242
 
Join Date: Jan 2013
Location: United States
Posts: 88
apm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant future
Help Coding a "Creep Mode"

Hi,

I'm trying to figure out how to attenuate the drive motor speed at the push of a button. For example, if normal operation allows for a value of 0 to 1, we'd like to be able to push a button and have the new value be 0 to 0.5.

I've been searching around for how to do this and I can't seem to find anything definitive. I used Team 358's examples but I'm not sure that I got it right. I've been using the LabVIEW simulator to test out the code. The robot moves but does not slow when I activate the joystick push button on the xbox controller (button 9). I've attached what I have so far.

Any ideas?

Thanks!
Attached Thumbnails
Click image for larger version

Name:	Teleop_creep_mode.jpg
Views:	107
Size:	91.5 KB
ID:	18222  
Reply With Quote
  #2   Spotlight this post!  
Unread 08-02-2015, 22:48
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: Help Coding a "Creep Mode"

Does "Button 9" mean the ninth button counting from 1, or counting from zero? Don't forget that the first button is at array index 0, so the ninth button is actually at index 8. You can set a probe on the Buttons array to verify which one you need to be reading.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-02-2015, 07:42
apm4242 apm4242 is online now
Registered User
FRC #4242
 
Join Date: Jan 2013
Location: United States
Posts: 88
apm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant future
Re: Help Coding a "Creep Mode"

Quote:
Originally Posted by Alan Anderson View Post
Does "Button 9" mean the ninth button counting from 1, or counting from zero? Don't forget that the first button is at array index 0, so the ninth button is actually at index 8. You can set a probe on the Buttons array to verify which one you need to be reading.
Thanks for the quick reply! I used the mapping that's been floating around CD: http://www.chiefdelphi.com/forums/sh...73&postcount=2

However, now I found a map saying the left joystick is button 8, not 9... Odd that it's from the same source.



The 9th light comes on in the dashboard when I press it but I'll go back to the simulator and try button 8. Is there anything wrong with the code?

Last edited by apm4242 : 09-02-2015 at 07:46. Reason: New stuff has come to light, man
Reply With Quote
  #4   Spotlight this post!  
Unread 09-02-2015, 08:26
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: Help Coding a "Creep Mode"

Quote:
Originally Posted by apm4242 View Post
However, now I found a map saying the left joystick is button 8, not 9... Odd that it's from the same source.
During the Beta Test, there was a strong preference among the Java and C++ teams for the button numbers in the code to match the labels on the joysticks/gamepads. The LabVIEW functions stayed with the zero-based arrays. It's a little confusing if you're moving between programming environments.

You do want the ninth button. But its value is in array index 8, because the first button is in index 0.
Reply With Quote
  #5   Spotlight this post!  
Unread 09-02-2015, 10:08
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: Help Coding a "Creep Mode"

Quote:
Originally Posted by apm4242 View Post
Thanks for the quick reply! I used the mapping that's been floating around CD: http://www.chiefdelphi.com/forums/sh...73&postcount=2
That post is from 2013 and applied to the cRIO and pre-2015 code. The xbox mapping has changed with the 2015 control system.

Aside from that your code looks fine once you change the index from a 9 to an 8.
Just make sure, depending on your drive train, that the rotate is still getting enough power to act against any wheel scrub at low power.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 09-02-2015 at 10:49.
Reply With Quote
  #6   Spotlight this post!  
Unread 09-02-2015, 11:21
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: Help Coding a "Creep Mode"

Quote:
Originally Posted by apm4242 View Post
I'm trying to figure out how to attenuate the drive motor speed at the push of a button. For example, if normal operation allows for a value of 0 to 1, we'd like to be able to push a button and have the new value be 0 to 0.5
Instead of limiting the voltage that can be supplied, a different option would be to contour the joystick's output to reduce the gain at low joystick commands but still allow full joystick output at high joystick commands.

This can be done with a smooth mapping function, or a piecewise-linear function, or a lookup table.

Here are some links to more info:

http://www.chiefdelphi.com/media/papers/2421

http://www.chiefdelphi.com/forums/sh...1&postcount=15

http://www.chiefdelphi.com/forums/sh...3&postcount=13

http://www.chiefdelphi.com/forums/sh...5&postcount=13

http://www.chiefdelphi.com/forums/sh...21&postcount=4


Reply With Quote
  #7   Spotlight this post!  
Unread 09-02-2015, 17:48
orangeandblack5 orangeandblack5 is offline
Hates LabView - Uses It Anyway
AKA: Ian Stewart
FRC #5498 (Wired Devils)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Grosse Ile, MI
Posts: 15
orangeandblack5 will become famous soon enough
Re: Help Coding a "Creep Mode"

What I would do is make a true/false case structure so that when the "button pressed?" reads false it does nothing but when it reads true it divides the value by 2.

Voilą!

(Although if it IS a controller problem the above posts should help fix that )

Last edited by orangeandblack5 : 09-02-2015 at 21:04.
Reply With Quote
  #8   Spotlight this post!  
Unread 09-02-2015, 21:22
apm4242 apm4242 is online now
Registered User
FRC #4242
 
Join Date: Jan 2013
Location: United States
Posts: 88
apm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant futureapm4242 has a brilliant future
Re: Help Coding a "Creep Mode"

Thanks everyone! I changed the array index from 9 to 8 and it works.
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 21:29.

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