Subject:
|
Re: Several hardware questions.. Laser link Hardware expansion n' more
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 5 Jul 2002 15:06:23 GMT
|
Viewed:
|
614 times
|
| |
| |
This is an interesting aspect of using two RCXs. My only experience is with
NQC and the single byte "Message" function, but I have succeeded in making
the communication link bi-directional and reliable.
I simply create a process in the "master RCX" which polls the "slave RCX" at
regular intervals of one second. The byte codings are such that the most
significant byte indicates the message direction (ie, master to slave or
slave to master) so I can snoop the communciation from the IR tower to the
PC. (With the mod I published on brickshelf to keep the tower alive as long
as the COM port is enabled.)
The code in the slave RCX is very simple, it has a process continually
waiting for a command which is executed upon receipt, and other processes
performing the motion control functions as required for the type of platform
in question and which rely on a system of "public" variables which are
updated as a result of received commands.
The polling process in the master RCX places received status information in
a public variable for other processes to use. It also monitors a transmit
request variable for commands to be sent. Since "poll" is defined to be 0
and all other commands are thus non zero, this variable is usually zero
except when a command is placed in it. The polling process abandons its one
second waiting period and sends any non zero command code as soon as it sees
it as long as a poll/response cycle is not already in progress. After the
command has been sent, the command variable is cleared which frees it for
other processes waiting to send a command.
I have had no problems with lost messages with this sytem. I do have code
which will retransmit commands to the slave if no response is received
within a certain timeout period and a counter to record how many times a
retransmit has occured. The only time this counter has ever registered
anything is if I forget to press the run button on the slave RCX before the
master one. If I was feeling adventurous, I'd probably try and make the
master RCX send a "start program" command to the slave but I haven't dug
into all the details to find out how to do that yet.
JB
In lugnet.robotics, Steve Hassenplug writes:
> I've been working on just such a robot. (two RCXs, two rotation sensors, four light sensors, and two touch sensors)
>
> Currently, my biggest problem has been communicating between RCXs. I keep getting collisions with my messages.
>
> I've had to limit the messages to one direction. That seems to be working better.
>
|
|
Message is in Reply To:
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|