Page 2 of 3

Re: My car

Posted: 18 Oct 2010, 17:48
by mattallen37
fuzzball27 wrote:...Is that with the advanced programming expansion pack?...
What do you mean? Just expand the block, and there is a place to connect a RAW value wire.

Re: My car

Posted: 18 Oct 2010, 19:15
by stryker001
You could have the levers as pedals with touch sensors which would speed the robot up gradually.
(Have the robot add power as the length of time that the touch sensor is held increases. Equation: s = seconds p = power; 10s=p
Example: The touch sensor is held down for 10 seconds. 10x10=100. Over a period of ten seconds the robot will be at 100 power)

-Ryan
That is a great idea, but it's not quite what I'm trying to accomplish. I need a very quick response (as close to instant as in possible), for example when I am holding the thumbsticks all the way back, it’s driving backwards, but then I flip them all the way forward and make it pop a wheelie. :) Then, when I release the thumbsticks (which were in the “100% forwards” position), I want them to automatically center themselves (back to the 'neutral' position).

I really do like your idea, it's just not the best for this kind of situation, you know?

- Stryker

Re: My car

Posted: 18 Oct 2010, 21:36
by fuzzball27
Edit: Are you referring to the INability to detect pressure with the touch sensor? This is a mechanical limitation of the NXT touch sensor. The NXT Touch sensor either returns 0 (1023) or 1 (18x). The RCX touch sensor changes resistance with force applied. Unlike the NXT Touch sensor, the RCX Touch sensor is NOT a switch, but rather a variable resistor. The values range from ~55-1022* as being pressed, and 1023 and not being pressed.
I thought that the opposite was the case. According to Danny Benedettelli when reading raw values for the NXT touch sensor, the readings can be anywhere from 50-1000.
I need a very quick response (as close to instant as in possible), for example when I am holding the thumbsticks all the way back, it’s driving backwards, but then I flip them all the way forward and make it pop a wheelie. Then, when I release the thumbsticks (which were in the “100% forwards” position), I want them to automatically center themselves (back to the 'neutral' position).
Have you tried using variables? For example, you could assign a variable to each motor, record how many degrees you moved each motor using the variables, and when you push the orange button they center using the variables to know how far to go.

Re: My car

Posted: 18 Oct 2010, 21:42
by mattallen37
I guess Danny Benedettelli misspoke. I just tested it, and I KNOW that the NXT touch sensor doesn't have analog ability, and that the RCX touch sensor DOES. Try it yourself.

Re: My car

Posted: 18 Oct 2010, 21:54
by fuzzball27
I guess Danny Benedettelli misspoke. I just tested it, and I KNOW that the NXT touch sensor doesn't have analog ability, and that the RCX touch sensor DOES. Try it yourself.
Tested it. I'm getting 200, 183, 180, 179, 181, and 1023 on the NXT touch sensor. I believe Danny and John Hanson were correct, although it is only sensitive in the low range.

Re: My car

Posted: 18 Oct 2010, 22:00
by mattallen37
From different sensors? You should NEVER get anywhere NEAR that much difference from a single NXT touch sensor. Either way, it is either open or closed, it is NOT able to do anything in between, right?

If you can, also try an RCX touch sensor, and you will see a HUGE difference in performance.

Re: My car

Posted: 18 Oct 2010, 22:10
by fuzzball27
Same sensor. I'm telling you, it has the capability. If it didn't there wouldn't even be a raw value option in NXT-G for the touch sensor. thats impractical. I tested it with the RCX sensor, it is much better. If you press slowly on the NXT sensor you will see what I mean.

Re: My car

Posted: 18 Oct 2010, 22:52
by mattallen37
I did some tests. I used the following NXC code.

Code: Select all

task main()                            // the main (only) task
{
  SetSensorTouch(S1);                  // initialize a sensor on the analog pin
  SetSensorTouch(S2);                  // initialize a sensor on the analog pin
  SetSensorTouch(S3);                  // initialize a sensor on the analog pin
  SetSensorTouch(S4);                  // initialize a sensor on the analog pin
  while (true)                         // repeat forever
  {
    Wait(50);                          // slow the program down a little
    ClearScreen();                     // clear the screen

    SetSensorMode(S1,IN_MODE_BOOLEAN); // make the sensor be read in a true/ false manner
    SetSensorMode(S2,IN_MODE_BOOLEAN); // make the sensor be read in a true/ false manner
    SetSensorMode(S3,IN_MODE_BOOLEAN); // make the sensor be read in a true/ false manner
    SetSensorMode(S4,IN_MODE_BOOLEAN); // make the sensor be read in a true/ false manner
    Wait(1);                           // wait for the last step to take place fully
    NumOut(0,LCD_LINE1,SENSOR_1);      // display the boolean result
    NumOut(24,LCD_LINE1,SENSOR_2);     // display the boolean result
    NumOut(48,LCD_LINE1,SENSOR_3);     // display the boolean result
    NumOut(72,LCD_LINE1,SENSOR_4);     // display the boolean result

    SetSensorMode(S1,IN_MODE_RAW);     // scale from 1023 - 0
    SetSensorMode(S2,IN_MODE_RAW);     // scale from 1023 - 0
    SetSensorMode(S3,IN_MODE_RAW);     // scale from 1023 - 0
    SetSensorMode(S4,IN_MODE_RAW);     // scale from 1023 - 0
    Wait(1);                           // wait for the last step to take place fully
    NumOut(0,LCD_LINE2,SENSOR_1);      // display the RAW result
    NumOut(24,LCD_LINE2,SENSOR_2);     // display the RAW result
    NumOut(48,LCD_LINE2,SENSOR_3);     // display the RAW result
    NumOut(72,LCD_LINE2,SENSOR_4);     // display the RAW result
  }
}
I tested all six of my NXT touch sensors, and there is VERY little difference in the results (from one to another).

They either read 1023 (0) or 181-184 (1). Also note, that when pressed, they do not give jittery results, and a sensor that is pressed, will ALWAYS return the same value.

I also have what seems to be a perfect explanation to your observations.

Switches have a "bounce", where they are part way between two states. Often, this effect is reduced mechanically by adding a magnet or spring, but there is still a short time where it is part way between two states. What you are likely observing is this effect. The NXT Touch sensor doesn't have any mechanical workings to reduce the effect, so it is more apparent than it would be with the proper mechanics integrated. If you take two pieces of metal (as switch contacts), and touch them together, there will be a point in which it will allow only a tiny bit of current through (high resistance), but as the metal makes better contact, it conducts more current, and therefore the resistance drops. You are seeing this effect when you attempt to get in-between readings. It is not meant to be a variable sensor by any means.

The RCX touch sensor is made differently, and it IS made to be variable (it uses something like graphite or conductive rubber instead of metal contacts).

Re: My car

Posted: 19 Oct 2010, 17:23
by fuzzball27
I made a base program for the idea of variables, but Sourceforge won't let me upload a .rbt file. Is there a way around that?

Re: My car

Posted: 19 Oct 2010, 18:17
by mattallen37
Rename the .rbt file with a .zip extension (or any other that will work), and we should be able to convert it back, and use it.