|Programming your robot with sensor inputs
|Page 1 of 1|
|Author:||Ran [ Wed Jun 06, 2007 10:53 am ]|
|Post subject:||Programming your robot with sensor inputs|
(First, i'm very sorry for not being a native speaker. I hope you can understand me anyway).
Hello, do you know if there is any good NXT/RCX programs in which you can "program" your own robot inside the program using sensors?
I played around with the rotation sensor, and i quickly figured out that it could be used for quick input. I'm currently doing a program in which you can input commands to the robot using the rotation sensor and a touch sensor (or whatever sensors you'd like to use), the commands is then saved as an array which is then read, and the robot does the things you just ordered it to do. I suppose there's much to learn about this fun (but still simple) way of programming a robot in the robots own program
Currently, the inputs is really simple. When you start the program on the RCX/NXT, the value of the rotation sensor is displayed on the display. To program something, let's say "Set MotorC to 100 power", you turn the rotation sensor to the code for that, in this case 6, then you press the touch sensor. Then you continue until your code is finished, and when you're done, you select 0 as an input to stop inputing and to start the robot's program.
It's really simple, but you can still do some sweet stuff with it
In the next version, i'm thinking of adding variables to it, where you first select your command, then you input a number.
Something like this, a quick program that is made with 16 inputs:
1 set M1 to > 100
2 set motorA and motorB to variable > 1
3 subtract one from variable > 1
4 wait INPUT ms > 20
5 if INPUT variable is 0, +2 orders > 1
6 move INPUT orders forward/backward > -4
7 play bip nr INPUT > 1
8 end of program, restart y/n > 1
I don't know if it's hard to understand, but basically, the robot starts moving at 100 speed forward, then it decreases it's speed to 0 over a 2 second period, then it repeats that until the battery is drained
I'd love to know how i can make a more fun way of programming the robot without a computer
|Author:||starwarslegokid [ Thu Jun 07, 2007 4:19 am ]|
That is a great idea, using the rotation sensor as a control and choosing what code you want it to run, I like it B-)
There is also another way to program your NXT without a computer. You can use the NXT Program feature that comes on the firmware. To get to this feature, turn Your NXT on, then scroll right once and select NXT Program. It then shows a screen and tells you witch ports to connect each sensor and motor to (you don't have to connect all of them if you don't want to). It has segments of code to choose from, and you can build a 4 step program. I think your program is allot nicer though, and it sounds like you can make programs longer than 4 steps
|Author:||SuntzuMaster [ Thu Jun 07, 2007 9:18 am ]|
your idea looks like a language interpreter. In the past I worked with system expert and that was based on rules like : if x < c do y...
|Author:||Ran [ Thu Jun 07, 2007 3:09 pm ]|
Yeah, i suppose you could do several hundreds of program lines without any problems.
Hm, maybe i'll inplent multiple ways to program the unit, such as using two buttons to punch in 5-bit (31 alternatives and one to end input) code pieces and/or using a light sensor to scan bar codes (in the base of your choice between 2 to 5 or so ).
I've made a first edition now, on monday i'll bugtest it. The program is currently made for RCXs, but can easily be modified to work for NXTs.
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group