|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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? |
|
#3
|
|||
|
|||
|
Re: Robot drives forward with no joystick connected
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|