![]() |
Robot drives forward with no joystick connected
I have noticed that when I'm not connecting the driver's joystick to the laptop the rocky just drives forward when enabled.
It's pretty dangerous and happens frequently because we use 2 laptops ac don't always move the joystick between them. What can be done? |
Re: Robot drives forward with no joystick connected
What is your drive setup? Are you directly feeding the joystick data into a drive VI like arcade or holonomic (mechanum)?
Does this happen all of the time, or just some of the time? We have had this in the past, if someone was displacing the joystick while plugging it in, like pulling it slightly backwards. This happens when someone is holding the joystick as another person plugs it in to the USB port. Windows takes the initial position when plugged in as the default zero, so when the stick is released to its natural zero point, the computer thinks it is being pushed off of zero. |
Quote:
The weird thing is that it happens only for driving and only forward (y axis). Happens every time the joystick is not plugged in. |
Re: Robot drives forward with no joystick connected
If you request a joystick value, and the joystick isn't plugged in, the VI returns empty arrays. If you then index those empty arrays, LV will return the default value for that array type -- numbers will be zero, Booleans false, etc.
We were sort seeing the same thing earlier in the season with the POVs. The array was empty, but they were indexed anyway. The index returns a zero, which meant up on the elevator. So, does any of this explain why this was happening? If not, can you post the code or a picture of the code that reads the joysticks and sends values to drive? Greg McKaskle |
Re: Robot drives forward with no joystick connected
Quote:
We use the POV to make the mecanum go straight in any direction. Is there a solution for this? |
Re: Robot drives forward with no joystick connected
1 Attachment(s)
We added code to check the array size of the POV before blindly indexing it.
The attached image returns a -1 instead of a zero. This still may not be what you want, but it shows how to detect an empty array and control the downstream value. You can also put your code into a case structure and only execute it if the array size is not zero. Greg McKaskle |
| All times are GMT -5. The time now is 10:26. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi