Subject:
|
Re: Controlling 2 or more RCX - Here's how to do it
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Tue, 21 Mar 2000 07:56:56 GMT
|
Viewed:
|
1123 times
|
| |
| |
Hi Jason,
Here's a possible solution.
=-= GOAL =-=
To have a PC program control multiple RCX's in real time. Each RCX is an
individual and should be able to respond to commands sent only to it.
=-= PROBLEM =-=
The tower sends its commands to ALL RCX's in range. It does not know anything
about an "individual" robot.
=-= SOLUTION =-=
The solution comes in two parts. The first part is to create a way to uniquely
identify a robot. The second part is to have each command apply to a given
robot and check the robot's ID to see if it should execute.
SOLUTION STEP 1: CREATE A ROBOT ID
This can be done by reserving one of the RCX's 32 variables. This variable
will store the robot's ID, which is nothing more than a serial number. Your
GUI interface will need a control to set this ID in a robot. Perhaps a text
box for entering the ID number and a button to send the ID to the robot.
To use this interface turn on all your robots. Take all of them but one to
another room. Set the ID for the one robot in the room. Take that robot to the
other room and bring in a new robot. Set the ID for that robot. Repeat until
all robots have an ID.
SOLUTION STEP 2: ASSOCIATE COMMANDS WITH ROBOT ID'S
This would mean adding a control to your interface to allow the user to enter
a Robot ID associated with the command. The intent is only that robot would
execute the command. The code emited by the interface would wrap the command
with an "IF" statement that would check the robot ID variable before executing
the code. Only if the robot ID matched the value associated with the command
would the command execute. All robots would receive the instruction from the
tower, but only one ID would match, and only one robot would exectute the
instructions. The pseudo-code emited to the robots for each command would look
like this:
IF THIS_ROBOTS_ID EQUALS THE_TARGET_ROBOT_ID THEN
....Code associated with the command goes here....
END IF
In VB the code would look like this:
'Some constants for .If
Public Const VARIABLE = 0
Public Const CONSTANT = 2
Public Const EQUAL = 2
'This is the RCX variable we use to store the Robot ID the RCX.
Public Const ROBOT_ID = 0
'This is the VB variable that contains the target Robot ID for the command
being sent from the PC.
Dim iID as Integer
iID = editTargetRobotID.Text
'This is the wrapper you'd place around your commands before sending them out
to all robots.
.If VARIABLE, ROBOT_ID, EQUAL, CONSTANT, iID
....Code associated with the command goes here....
.EndIf
This should give you what you want, real-time control of individual robots.
David Leeper (looks forward to seeing your results)
In lugnet.robotics, "Jason Di Fazio" <difazio@uwindsor.ca> writes:
> I am developing a GUI in Visual Basic to control the RCX realtime. I =
> have kind of run into a snag though and I could use some help. Right =
> now I have 2 RCX which I am trying to control. The problem I am not =
> sure how to control each RCX separately. If I want to control Motor1 on =
> RCX1 I will also turn on Motor1 of RCX2. Is there a way out of this??? =
> Is it possible to talk to only one RCX at a time?? Is there a way to =
> specify the RCX I want to talk to?? =20
>
>
> Jason Di Fazio
> Electrical Engineering
> University of Windsor
> difazio@uwindsor.ca
>
>
> --
> MIME ATTACHMENTS DISCARDED:
>
> 1. Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> Content-Length: 1086
|
|
Message is in Reply To:
| | Controlling 2 or more RCX
|
| I am developing a GUI in Visual Basic to control the RCX realtime. I have kind of run into a snag though and I could use some help. Right now I have 2 RCX which I am trying to control. The problem I am not sure how to control each RCX separately. If (...) (25 years ago, 19-Mar-00, to lugnet.robotics)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|