View unanswered posts | View active topics It is currently Sat Nov 01, 2014 2:19 am






Reply to topic  [ 4 posts ] 
Programming your robot with sensor inputs 
Author Message
Rookie

Joined: Sat Jun 02, 2007 11:09 am
Posts: 3
Post 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 :wink:

I'd love to know how i can make a more fun way of programming the robot without a computer :)


Wed Jun 06, 2007 10:53 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
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 :D


Scott B-)

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Thu Jun 07, 2007 4:19 am
Profile WWW
Rookie

Joined: Sun Apr 15, 2007 8:33 am
Posts: 40
Location: USA
Post 
Hi,

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...

good idea.

jm

_________________
SuntzuMaster- a French gentlemen in USA.


Thu Jun 07, 2007 9:18 am
Profile
Rookie

Joined: Sat Jun 02, 2007 11:09 am
Posts: 3
Post 
starwarslegokid wrote:
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 :D


Scott B-)

Thank you!
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.


Thu Jun 07, 2007 3:09 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.