Go to Post I'm in it for the challenge, winning is just a side effect... - davidthefat [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 24-02-2015, 00:39
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
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?
__________________
2016-2017 - Programming Mentor
Curie Sub-Division Champions with 694, 379 & 1511
2015 - Team Captain & Head of Programming Crew
Carson Sub-Division Champions with 1325, 20 & 1711
First ever Israeli team on Einstein
2014 - Team Captain & Head of Programming Crew
2013 - Head of Programming Crew
2012 - Member of Programming Crew
Reply With Quote
  #2   Spotlight this post!  
Unread 24-02-2015, 02:39
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 185
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 24-02-2015, 04:48
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
Quote:
Originally Posted by Levansic View Post
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.
We just use the x and y axes for holonomic drive.
The weird thing is that it happens only for driving and only forward (y axis).
Happens every time the joystick is not plugged in.
__________________
2016-2017 - Programming Mentor
Curie Sub-Division Champions with 694, 379 & 1511
2015 - Team Captain & Head of Programming Crew
Carson Sub-Division Champions with 1325, 20 & 1711
First ever Israeli team on Einstein
2014 - Team Captain & Head of Programming Crew
2013 - Head of Programming Crew
2012 - Member of Programming Crew
Reply With Quote
  #4   Spotlight this post!  
Unread 24-02-2015, 07:00
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #5   Spotlight this post!  
Unread 24-02-2015, 07:34
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
Re: Robot drives forward with no joystick connected

Quote:
Originally Posted by Greg McKaskle View Post
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
That's it!
We use the POV to make the mecanum go straight in any direction.
Is there a solution for this?
Reply With Quote
  #6   Spotlight this post!  
Unread 24-02-2015, 07:46
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Attached Thumbnails
Click image for larger version

Name:	From Clipboard.PNG
Views:	18
Size:	9.7 KB
ID:	18472  
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