Page 1 of 3

My car

Posted: 15 Oct 2010, 02:23
by stryker001
Hey there, I have a wonderful idea that's been in my head for awhile. I just recently started building it, and it's almost finished (well, at least half of it is).

I am working on a remotely controlled NXT car. The controller is a second NXT, with two Forward/Backward joysticks on either side. I have built the car, but the programming is nowhere near being finished. The controller is nowhere near being finished, but the programming is (almost) done.

Currently, I have the basic program setup worked out, and I have a even more basic build design, I'm still working on that in my head. However, it's this particular aspect of the controller's joysticks that I need help programming.

My idea is to feed two motor's rotation vales (one on the left, one on the right) as the Joystick values, thus creating two Forward/Backward sticks, not a Throttle/Steering setup (ugh). I was planning on having it set up so that when the stick is pointing straight up, it's at the neutral position. Then, it could recognize forward and backward commands, on each stick. However, I wanted to ensure that the stick returned to the neutral position, so that if you pushed up on the stick and then let go, it would drop back down. This could easily be accomplished by springs, but if it was accomplished via programming, then you could apply it elsewhere. (Not to mention, the NXT doesn't come with springs.)

Currently I am attempting a setup where the Controller reads a motor's rotation value in degrees (as a variable), reduces it some, and then tells the motor to move the opposite direction with the variable going to the power input. This seems to be causing many problems, however. If anyone can help me, I would be delighted. I can send whatever I need to send to you (screenshots, program itself, etc.), just ask and you shall receive. (I would post it here, but I have no idea how.) Thanks in advance!

- Stryker

Re: My car

Posted: 16 Oct 2010, 09:28
by dad-and-adam
I wanted to ensure that the stick returned to the neutral position, so that if you pushed up on the stick and then let go, it would drop back down. This could easily be accomplished by springs, but if it was accomplished via programming, then you could apply it elsewhere.
Here's a couple of ideas for the stick centering:
1) Have the sticks centered by using a low power setting. -So low that finger pressure can push them off center.

2) Mount a touch sensor at the upper ends of the sticks. Press the touch sensor to move the sticks, When the touch sensor is unpressed, the sticks return to center.
Currently I am attempting a setup where the Controller reads a motor's rotation value in degrees (as a variable), reduces it some, and then tells the motor to move the opposite direction with the variable going to the power input. This seems to be causing many problems,
What kind of problems is it causing?

Dave

Re: My car

Posted: 16 Oct 2010, 18:17
by fuzzball27
I have run into this same exact problem. The best solution I can think of is creating stages to each section of the motor rotation. For example, when motor degreese (md) is 10>md<20 the power level (pl) would be 10. and for 20<md>30, pl=20; 30<md>40, pl=30 and so on. What programming language are you using?

Re: My car

Posted: 17 Oct 2010, 02:29
by stryker001
I have run into this same exact problem. The best solution I can think of is creating stages to each section of the motor rotation. For example, when motor degrees (md) is 10>md<20 the power level (pl) would be 10. and for 20<md>30, pl=20; 30<md>40, pl=30 and so on.
I had initially considered this, but I wanted a smoother amount of resistance; also, I wanted it to be adaptable for different devices.
What programming language are you using?
NXT-G. Sadly, I haven't made the time to learn C or C++, so I can't really do NXC. :|

Here's a couple of ideas for the stick centering:
1) Have the sticks centered by using a low power setting. -So low that finger pressure can push them off center.
2) Mount a touch sensor at the upper ends of the sticks. Press the touch sensor to move the sticks, When the touch sensor is unpressed, the sticks return to center.
I am attempting to accomplish Idea #1. Idea #2 is great, but that only works for up/down (logic signals), not values (amounts of) "up/down-ness" (aka, degrees). The idea I'm trying to get at is that it pushes back harder the farther you push, not "push all the way and then let it reset" (although that can be useful in some situations).
What kind of problems is it causing?
Stuff like, the motors lock up, or they turn the wrong way, or the resistance doesn't change, etc.

- Stryker

Re: My car

Posted: 17 Oct 2010, 02:52
by alpharhino
You could have the levers as pedals with touch sensors which would speed the robot up gradually.

-Ryan

Re: My car

Posted: 17 Oct 2010, 20:57
by fuzzball27
You could have the levers as pedals with touch sensors which would speed the robot up gradually.
Do you mean using the touch sensor raw values? Because NXT-g cannot read raw values.

Re: My car

Posted: 17 Oct 2010, 21:03
by alpharhino
No
Have the robot add power as the length of time that the touch sensor is held increase
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

Re: My car

Posted: 17 Oct 2010, 23:07
by mattallen37
fuzzball27 wrote:... NXT-g cannot read raw values.
What version? I just checked to be sure, and NXT-G 2.0 allows it.

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 know that the software/firmware returns a boolean value of 1 or 0, with a threshold of somewhere in the 460ish range.

Re: My car

Posted: 18 Oct 2010, 00:23
by alpharhino
NXT-G 1.1 can as well.

-Ryan

Re: My car

Posted: 18 Oct 2010, 17:16
by fuzzball27
Thanks, nice to know. Is that with the advanced programming expansion pack?

Any progress on the car?