Our robot it working and in good shape, but we had a demo and an elementary school and decided we should take the speed down a notch. We coded our robot in java and we have an if then statement that says if the joystick input is above .3 (1 being the highest) set the speed to .3 . We tested it and found no matter if we set the move speed to 1 or .1 the speed stays the same. Is there a way to slow our robot down?
That should work, so it’s probably something you mistyped. Can you share your code with us? It’ll be easier to see what’s wrong that way.
Another option, instead of adding an upper limit, is to multiply the joystick values by a value less than 1. For example, if all joystick values are multiplied by .5, then the maximum speed will also be .5 (.5 * 1.0 = .5). This also allows the full range of the joystick values to be used, which improves controllability.
I would recommend just changing the speed settings. Get normal joystick data and make the speed * .3. This way you can have variable speed, just much slower. Maybe you mistyped? *Edit: @ColbyG said it better than I did, disregard this *
Sadly I dont have the code on me right now but just to clarify, the if/then function wrote worked at first but stopped after we had to reconfigure our robot to fit one joystick instead of 2…I’ll check for typos next time I have access to my code.
We use the multiplayer system on our robot as well. for outreach events it works great. We have it set up so that there is a user editable field where we enter the speed multiplayer (0 - 1). This way we can adjust it based on the size of the space we are in, and who is driving. By using a multiplayer instead of upper limit you maintain the full range of motion of the joystick(s).
You could always try manipulating the joystick input value itself to scale the input and give you the full range of your joysticks (instead of 30% of it).
I’m not a robot programmer (though I do know some programming) so I don’t know the correct syntax, but you could, for instance, try something like this when initializing your joysticks:
Joystick1 = (JoyInput1 * 0.3)
MotorOutput = Joystick1
Where JoyInput1 is your raw joystick value, and MotorOutput is your speed controller setpoint.
Just a thought.
It sounds like what you did should have had an effect. Is your code posted somewhere we can review it (e.g. github)?
The first time I encountered this problem (at a demo), we just pulled the connectors for one motor on each side, and fixed it in software before the next demo.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.