Page 1 of 1

Project Problem

Posted: 14 Jul 2011, 12:55
by j3sst3r
Hi
I am using Mindstorms 2.0 and LabView to do a project but I am having a problem with the code I am using a case structure with string constant and the default is making the program at odd i.e if it is set to the drive case the sensor are ignored but if it is set to one of the sensors the rest for the program works but the sensor that is the default is ignored. I need some help with this as I have been working on it for two days now and no progress
Thanks for the help
Vacume bot 2.0.zip
(22.23 KiB) Downloaded 304 times

Re: Project Problem

Posted: 14 Jul 2011, 15:18
by hassenplug
I don't have LV10 handy. Can you post a picture of the program?

Steve

Re: Project Problem

Posted: 14 Jul 2011, 20:06
by j3sst3r
Hi Steve
Here you go
labview.zip
(1.7 MiB) Downloaded 533 times
Thanks for the help
I just know it is just gonna to be a simple problem

Re: Project Problem

Posted: 15 Jul 2011, 19:22
by hassenplug
Let me start by saying that I'm not trying to insult your programming. Just suggest ways you can improve it.

Ok, I can tell you a whole bunch of things that are wrong with your program, which combine to create an interesting effect. First, a fundamental "bad technique" used: It's not a good idea to use strings in your case statement. It's easy to make a spelling error that would cause invalid cases. Numbers work better (they're hard to misspell).

Problem 1: in the "check for sensors" case, there appears to be spaces after "Touch 1" (see technique above) That means when touch 1 is pressed, it will skip the touch 1 case, and go to the default case of touch 2

Problem 2: "Touch 2" checks port 1, not port 2. Also, not sure if it's a problem, but there is no port specified for the US sensor. It may already default to 4.

Problem 3: you're using different values for the US sensor range check. In one place, you use 10cm, and another you use 5cm. *note, the US sensor readings are not very accurate below 4", or about 10cm

Comment 1: the Initialize case is pretty much the same as the "drive" case. Personally, I'd just skip to the drive case, so you have one less case.

Comment 2: The "Check For Sensors" case checks all the sensors, then goes through cases that check each sensor. I don't think you need both types of checks.

Comment 3: Not sure if this was intended, but in one place your testing for sensor "bump" while in another place, your testing for "pushed".

Hope that helps.
Steve