View Full Version : problems with using switches for autonomous
ssica_jj
07-02-2010, 19:40
For our team autonomous, we decided to use switches for autonomous. We connected the Cypress board and the breadboard to wire up the switches. The value from the switches are being displayed on the driver station(classmate) but somehow, the program is not reading the value. The only value that it reads is 0. Even when we flip the switches, the value on the laptop does not change. (However, the value on the driver station is changing without any problems.)
Could anyone please help us on this problem?:confused:
Thank you!:D
EDIT*
The values from the switches are being read by the Classmate Driver Station, but not on the programming laptop (separate from the Classmate). It shows change on the Classmate Driver Station, but not on the programming laptop.
Alan Anderson
07-02-2010, 21:22
The value is being displayed, but it isn't being read? It's changing, but it isn't changing? I don't understand what you're saying.
MrForbes
07-02-2010, 21:24
Why not put the switches on the robot, connected to the digital IO on the digital sidecar?
ssica_jj
07-02-2010, 21:27
the values(boolean) is being displayed on the driver station, under the I/O tab, but not in the program on LabVIEW when you run it. It changes between 1 and 0 on the display on the driver station but not in the program.
I don't know how you would go about putting the switches on the robot. We have always put the switches with the driver station. We would like to keep it this way, however, we are willing to try another way if it is not possible to program the switches with the driver station.
Alan Anderson
07-02-2010, 22:13
How are you determining that the value is not being read in LabVIEW? If you show us your code, we might see something that's not doing what you think it is.
ssica_jj
07-02-2010, 22:32
We ran the RobotMain.vi in the project containing the code. We connect the laptop to the router which is connected to the driver station.
Attached is a screen shot of our code.
Might it will only work during disabled mode and once it moves into autonomous mode the correct reading are overridden with incorrect ones? That might make sense since, you only have to read once and they might want to insure no active data is going to the bot in autonomous mode...
ssica_jj
07-02-2010, 22:51
Even though it is in the Disabled.vi, it should be reading it, however it doesn't read whether it is enabled or disabled.
Just to clarify.....
We connected several switches to the Cypress IO board and confirmed that the Classmate is reading the inputs correctly. However, when we tried to program on LabVIEW using Driver Station Get Digital Input.vi, we didn't get any feedback from the Classmate.(we can still see switches working on the Classmate though :confused: )
ligerbots
07-02-2010, 23:00
would it be possible to just program your own dashboard and have that be your switch?
would it be possible to just program your own dashboard and have that be your switch?
It is possible but that would be troublesome. Using customized dashboard means we would have to click on each buttons(using mouse pad, of course) during the matches, which we are not willing to do so.
Vikesrock
07-02-2010, 23:37
Are you sure that you are using the correct array indices?
The labeling of the Digital Inputs on the Driver's Station starts with 1, but the array indices likely start at 0 (I haven't checked this).
Alan Anderson
07-02-2010, 23:53
Attached is a screen shot of our code.
You still haven't said how you are determining that the value isn't being read. Are you probing any of the wires to find out whether the data from the Driver Station digital inputs is making it out of the Get Dig In?
I don't know why you're storing a string of text "1" and "0" characters in something called "Program Num", I am having a hard time understanding why you are doing a Concatenate instead of using the Append T/F String vi to do the appending it is designed for, and I have no idea why you put a Get Dig In there three times. Can you describe what that code is supposed to be doing?
ssica_jj
08-02-2010, 23:04
You still haven't said how you are determining that the value isn't being read. Are you probing any of the wires to find out whether the data from the Driver Station digital inputs is making it out of the Get Dig In?
When we ran the code, to check the values, we turned on the 'highlight execution' and saw that the only value being read is 0.
I dont know why you're storing a string of text "1" and "0" characters in something called "Program Num", I am having a hard time understanding why you are doing a Concatenate instead of using the Append T/F String vi to do the appending it is designed for, and I have no idea why you put a Get Dig In there three times. Can you describe what that code is supposed to be doing?
There are 3 Get Dig In because we are using 3 switches. We are converting the value into string then concatenating them in order to create different combination for the case selector in autonomous. That way, we can have multiple autonomous modes and switch between them between matches without re-downloading the code each time. We are using the Append T/F String.vi to convert the digital input value into string.
Alan Anderson
09-02-2010, 07:45
When we ran the code, to check the values, we turned on the 'highlight execution' and saw that the only value being read is 0.
Try putting an indicator or a probe on the output of Get Dig In and running the code at speed.
There are 3 Get Dig In because we are using 3 switches.
Get Dig In returns all eight switches at the same time. You only need to use it once, and you can get multiple elements from its output with a single Index Array. See the attached code fragment. ...which apparently didn't get attached properly, and which I do not have a copy of at the moment. I'll try to correct that later today.
We are using the Append T/F String.vi to convert the digital input value into string.
I understand that, but you're ignoring the "Append" part of it. You can build the string as you go instead of keeping the characters separate and combining them in a separate step.
Joe Ross
09-02-2010, 10:05
Are you using compatibility i/o or extended i/o?
Alan, you forgot the code fragment.
Alan Anderson
09-02-2010, 16:56
Alan, you forgot the code fragment.
I thought it was there when I wrote the post this morning. Here it is (again).
ssica_jj
09-02-2010, 23:12
I thought it was there when I wrote the post this morning. Here it is (again).
We tried what you suggested. It works! Thank you for your help! We really appreciate it. :D
We are having similar problems with getting the PSoC inputs to be seen on the Dashboard. We have placed Get Dig In on the Dashboard.vi but don't see any states change. The states do change on the Driver Station. Does anyone have any suggestions on what we should do?
Thanks!
Komal
Alan Anderson
14-02-2010, 18:41
The Get Digital In vi only works on the robot. If you want to show its output on the Dashboard, the robot program will have to send it in the Dashboard data and the Dashboard program will have to retrieve it from there.
randalcr
12-03-2010, 11:31
We ran the RobotMain.vi in the project containing the code. We connect the laptop to the router which is connected to the driver station.
Attached is a screen shot of our code.
we have our auton. working in the same way you guys do except on ours we have the boolean output of the "get Dig. in" block going to a block that gets the ID of the switch and goes directly into a case structure. inside the case we have different "pages" that have different auton. programs. the DIG. In is what controls the program.
garrettg
13-03-2010, 21:39
What our team did was use 2 PWMs attached to a 3-way switch mounted on the robot, and made 2 case structures, one inside the other for autonomous. We wired digital IOs into the case strucures, and that's how we get our autonomous selection.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.