Help Wanted

mindstorms physics project – leet hacker

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
in an earlier thread, i said i was doing a lego mindstorms physics project. now i have the code working, and the ball-dropper working. the ball hits the arm which presses the touch sensor and stops the timer. i do have to squeeze the two walls the arm goes between though.

the only problem is that the time it gives back is not consistent. like first it gives the time as 200 (milliseconds i think), and then the next time it gives it as 85, even though it was dropped from the same height as the first.

here are pix that i made with mlcad (a very crude representation):

here is the program i used:

#define __NOTETIME 10
#define __WAITTIME 12

task main(){
SetSensor(SENSOR_1,SENSOR_TOUCH); //this will be your start and stop button for timing

CreateDatalog(50); //tell the RCX that you want space for 50 numbers for it to keep track of

while(true){ //repeat forever
until(SENSOR_1==1); //wait for signal to begin timing - button pressed?
Wait(100);
OnFwd(OUT_A);
Wait(50);
ClearTimer(0); //clear timer for usage
Off(OUT_A);
until(SENSOR_1==1); //wait for signal to stop timing - button pressed?
AddToDatalog(Timer(0)); //add the time to the datalog
}
}

i can't figure out if the problem is me, the apparatus, or the program. if you think you know what the problem is, please tell me. if i can't get a solution (from you or me), i think maybe i'll just scrap the project.

------------------
1 4|\/| 73|-| |_||332-1337 |-|@><0|2 4 (|-||21$7.

"By the way, what does BTW stand for?" - IRC message

Über-Geek

JeTSpice
Member

Posts: 433
From: La Crosse, Wisconsin, USA
Registered: 06-10-2006
Does it consistantly give a time of 200 and then 85? Like every single time you reboot/start up the system, the first result is always 200 and the second is always 85?

If you drop the ball many times, are a majority of those times closer to 200 or closer to 85 or neither? Or do they consistently drop off, like 200, 85, 70, 64, 62, etc.

i.e., more data

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
quote:
Originally posted by JeTSpice:
Does it consistantly give a time of 200 and then 85? Like every single time you reboot/start up the system, the first result is always 200 and the second is always 85?

If you drop the ball many times, are a majority of those times closer to 200 or closer to 85 or neither? Or do they consistently drop off, like 200, 85, 70, 64, 62, etc.

i.e., more data


it sort of averages around like 130 or something like that, but it does drop constantly, like 275, 200, 115, 110, 85, 65 (that's similar to some earlier results i got).

------------------
1 4|\/| 73|-| |_||332-1337 |-|@><0|2 4 (|-||21$7.

"By the way, what does BTW stand for?" - IRC message

Über-Geek

supercoder

Member

Posts: 37
From:
Registered: 08-20-2007
u could add wait(50) after AddToDatalog to debounce sensor, may be helps

------------------
>>>--supercoder--<<<

JeTSpice
Member

Posts: 433
From: La Crosse, Wisconsin, USA
Registered: 06-10-2006
Hmm, it sounds like there is an issue with a capaciter in the electronics. It's been while since my electronics' days but a capacitor has a recharge time. Think of a camera where the flash has to build up before it's ready. It sounds like something like that. (This is a physical construction, not a virtual one, right?)

A round about way of agreeing with Supercoder. Is there another type of sensor available in mindstorm?

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
quote:
Originally posted by JeTSpice:
Hmm, it sounds like there is an issue with a capaciter in the electronics. It's been while since my electronics' days but a capacitor has a recharge time. Think of a camera where the flash has to build up before it's ready.
It sounds like something like that.


so are you saying that maybe i should wait a while between ball-drops?
quote:
(This is a physical construction, not a virtual one, right?)

yes, it's a physical construction
quote:
A round about way of agreeing with Supercoder. Is there another type of sensor available in mindstorm?

if you mean a physical sensor, the only one that could do anything would be a rotation sensor (also there's a temperature sensor). if you mean a virtual sensor, there's just a counter (like every time you do something it adds 1 to the counter).

------------------
1 4|\/| 73|-| |_||332-1337 |-|@><0|2 4 (|-||21$7.

"By the way, what does BTW stand for?" - IRC message

Über-Geek

ArchAngel

Member

Posts: 3450
From: SV, CA, USA
Registered: 01-29-2002
When dealing with sensors, especially low-grade sensors, there is a lot of noise in the signal.
That was one of the biggest difficulties at my internships. It's frustrating for a computer science guy to deal with all the uncertainty of real life.

What would be nice is to see a sample of your readings, along with some statistical data, like mean and standard deviation.
also, are you sure the numbers aren't varying by your human error? like dropping the ball at different heights, dropping and setting the timer at different times?
Try setting up a test system where the touch sensor is hit at consistent intervals and analyze the data.

But, one question you doneed to ask yourself: how accurate do you need the numbers to be?

------------------
Q.E.D.

JeTSpice
Member

Posts: 433
From: La Crosse, Wisconsin, USA
Registered: 06-10-2006
Wow--great models, 1337!


Yes, a sample of readings can help.

I second that -- how accurate do you need it to be?

Since the system is physical, and made out of plastic, it can also vary the results. Temperature will shrink/expand the blocks, causing small deviations in the results. Slight differences in the arm's hinge will cause it to fall at different rates, depending on it's weight and angle just before it falls.

These are just possibilities and looking at your readings can help before you make any changes.

[This message has been edited by JeTSpice (edited October 12, 2007).]

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
quote:
Originally posted by ArchAngel:
also, are you sure the numbers aren't varying by your human error? like dropping the ball at different heights, dropping and setting the timer at different times?


it has a tower with a claw on top (i'm assuming you mean by dropping at different heights that i'm doing it by hand); as soon as the claw moves, the timer starts. the ball falls and hits the arm which stops the sensor. i could be squeezing at different amounts of pressure, or the arm is at different heights, but that shouldn't make a 100-millisecond difference.
quote:
Try setting up a test system where the touch sensor is hit at consistent intervals and analyze the data.

hehe, i wonder why i didn't think of that? i'll try that.
quote:
But, one question you doneed to ask yourself: how accurate do you need the numbers to be?

this is experiment is mainly to find out the average speed of the falling ball and the average acceleration. so, they need to be very accurate.

i will post the data soon.

------------------
1 4|\/| 73|-| |_||332-1337 |-|@><0|2 4 (|-||21$7.

"By the way, what does BTW stand for?" - IRC message

Über-Geek