Subject:
|
Communication between RCX's with BrickOS
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Thu, 2 Jan 2003 22:57:48 GMT
|
Viewed:
|
2990 times
|
| |
| |
Hello Everyone,
I have been working on a dual RCX robot for quite some time now, and have
just recently upgraded to BrickOS. At first I attempted to used the LNP
communication functions, such as lnp_adressing_write. I am not an expert,
and I got really bogged down with all of the overhead in setting up the
program to enable communication. Then I looked in the LNP header file and
saw the functions for communicating via standard firmware messages.
send_msg() is the BrickOS equivalent of SendMessage()in NQC. I decided to
use these since sending single integer messages back and forth is all I need
for my application. The trouble I am having now is that the communication
only seems to work in one direction. Here is how I have things set up: The
Master RCX sends a command to the slave in a function that looks like this:
void drive(int dist)
{
send_msg(dist);
clear_msg();
...
while(lnp_rcx_message == 0);//wait for response
return;
}
The Slave RCX has recieving code that looks like this:
while(1)
{
if(lnp_rcx_message > 0)
switch(lnp_rcx_message)
{
...//execute command from master
send_msg(done);
clear_msg();
}
}
What happens is the Slave RCX does what it is supposd to and sends the
reply, but the Master seems to miss it and just sits there waiting for the
reply. The standard firmware messages are stored in the variable
lnp_rcx_message. I can't see what I have done differently in the master code
that it misses the reply. I have tried using the get_msg() function and
wait_event(msg_recieved, 0) but neither seem to work. Has anyone else used
these standard firmware message functions? Is there a better way to recieve
messages?
Thanks for your help,
Rob
|
|
Message has 1 Reply: | | Re: Communication between RCX's with BrickOS
|
| ...Problem Solved #include <lnp/lnp-logical.h> lnp_logical_range(1); I set the IR transmission range to far and everything works fine. It seems the issue was that the RCX's are not facing eachother and depend on bouncing mesages off a wall. I'm (...) (22 years ago, 3-Jan-03, to lugnet.robotics.rcx.legos)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|