|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Same code, but one works, one doesnt.
Hi this is team 1514 and we just had one question. We were driving our robot on the practice field today and it worked perfectly fine in autonomus. The switches 1, 2, 3, 4 ,5. They all have the similar code but when it reaches the y it does different things. But number 1,2,3 do NOT work at all. But number 4, and 5 do work for some reason. Why might that be? i have attached a comparison of number 3 to number 5 in the file below: What is the difference between the code? Our bot can go straight and score but it would be nice to have the robot score left and right also.it would be great if it can be fixed by tomorrow before the game
![]() Team 1514 Last edited by whcirobotics : 31-03-2011 at 22:17. |
|
#2
|
|||||
|
|||||
|
Re: Same code, but one works, one doesnt.
Saying they "do NOT work at all" doesn't help us know what to look for. Tell us what you expect them to do, and what they actually do.
I can't comfortably follow the code from the fragmented pictures you provided anyway. Can you post the actual vi instead? |
|
#3
|
||||
|
||||
|
Re: Same code, but one works, one doesnt.
I mean that when the switch is set to 3, which is suppose go straight and then turn left to get out of the way, does nothing at all. The piston does not come up and the robot does not move. The vi was too big so i have removed the switches 1, and 2.
|
|
#4
|
||||
|
||||
|
Re: Same code, but one works, one doesnt.
On the very far left side, you put the three switches into an array, and then did a boolean array to number conversion. That's probably what you want.. however, the output of a 3 input boolean array to number is going to be from 0-7, not 3-5; it's the binary number of the booleans. For five, the number would be from 0 to 2^5 -1 (31).
What you probably want to do is have the case structure run the switch 1 on 1, the switch 2 on 2, the switch 3 on 4, switch 4 on 8 and switch 5 on 16, and then have a "default" case where it does nothing or gives an error - that would mean that either >two or zero switches are pressed. Also, it's kind of bad form to have so many case structures running off the same input and doing different things that work together, but you probably don't want to mess with that ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|