|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
|
#2
|
|||||
|
|||||
|
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.
|
|
#3
|
|||
|
|||
|
Re: Help Coding a "Creep Mode"
Quote:
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 |
|
#4
|
|||||
|
|||||
|
Re: Help Coding a "Creep Mode"
Quote:
You do want the ninth button. But its value is in array index 8, because the first button is in index 0. |
|
#5
|
|||||
|
|||||
|
Re: Help Coding a "Creep Mode"
Quote:
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. Last edited by Mark McLeod : 09-02-2015 at 10:49. |
|
#6
|
||||
|
||||
|
Re: Help Coding a "Creep Mode"
Quote:
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 |
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
Re: Help Coding a "Creep Mode"
Thanks everyone! I changed the array index from 9 to 8 and it works.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|