Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
Re: AMX 13 bridge layer
Wow, that thing looks amazing! Nice job! You should make a video of it and post it on YouTube
= Xander
_________________ | Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat) | My Blog: I'd Rather Be Building Robots | ROBOTC 3rd Party Driver Suite: [Project Page]
Tue Dec 04, 2012 3:26 pm
didiercoll
Novice
Joined: Sat Sep 15, 2012 11:28 am Posts: 67
Re: AMX 13 bridge layer
thanks
it will be done on youtube with my son next week ;
please clic on the first five pictures to see videos
it would be better if the actuator could be stop where we want by the program in order to do a robot ;
and if there were no problems with NXTBee ( sometimes the AMX start randomly ... )
Why use a NXTBee (or two? I can't really tell if there is one connected to the left NXT)?
You know, if you want to communicate withing a robot (no need for it to be wireless), you can just connect the NXT's using an NXT cable (between sensor port 4 of each), and communicate using RS485 (at up to about 8 times the max speed that the NXTBees support).
_________________ Matt
Tue Dec 04, 2012 7:10 pm
didiercoll
Novice
Joined: Sat Sep 15, 2012 11:28 am Posts: 67
Re: AMX 13 bridge layer
You know, if you want to communicate withing a robot (no need for it to be wireless), you can just connect the NXT's using an NXT cable (between sensor port 4 of each), and communicate using RS485 (at up to about 8 times the max speed that the NXTBees support).
fine !
the second NXTBee is behind the AMX , on the other side , you can not see it ;
well ; it is the idea I am looking for years and each time I ask the question to experts they say it is not possible to link with wires two NXT ;
but using RS485 needs some programs or API or others like that ?
would you tell me or give me the link to an exemple ?
The official RS485 support in NXC (I would assume ROBOTC would be similar), does not take care of any sort of SW layer network protocol. Basically you can send and receive raw bytes, but you need to design your own SW protocol. Usually I use a master/slave setup, where the mater initiates any communication, and the slave only "talks" if the master requests something.
As far as the HW, all I do is connect a cable between sensor port 4 of the NXTs.
I have a master and a slave connected from 4 to 4 ; I use the last robotC ;
the debug window gives only
SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1 SMALL 1
it means the link between the two nxt do not works ????
below the code
Code:
Re: NXT to NXT Communication HELP!!! This is the slave:
Code: int counter = 0; task main () { int num; int chksum; ubyte incoming[16]; nxtEnableHSPort(); nxtHS_Mode = hsRawMode; nxtSetHSBaudRate(9600); wait1Msec(2000); writeDebugStreamLine("slave alive"); while(true) { num = nxtGetAvailHSBytes(); if (num > 0) { nxtReadRawHS(incoming[0], num); if (num == 16) { chksum = 0; for (int i = 1; i < 15; i++) { chksum ^= incoming[i]; } if ((chksum == incoming[0]) && (chksum == incoming[15])) { counter++; writeDebugStreamLine("%d %d", counter, incoming[0]); } else writeDebugStreamLine("BAD CHKSUM"); } else { writeDebugStreamLine("SMALL %d", num); } } } }
After a really quick glance, I suggest you add a delay of 20 or so ms between
if (num > 0) {
and
nxtReadRawHS(incoming[0], num);
in the slave program.
_________________ Matt
Wed Dec 05, 2012 3:25 pm
didiercoll
Novice
Joined: Sat Sep 15, 2012 11:28 am Posts: 67
Re: AMX 13 bridge layer
thanks
I add 20ms
and get
SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15 SMALL 1 SMALL 15
the last
SMALL 15 SMALL 1 SMALL 15
are flashing
the same with 50 ms
when I compile , there is a yellow cross with :
*Warning*:Comparison between 'signed' and 'unsigned' operands. if ((chksum == incoming[0]) && (chksum == incoming[15]))
int counter = 0; task main () { int num; ubyte chksum; ubyte incoming[16]; nxtEnableHSPort(); nxtHS_Mode = hsRawMode; nxtSetHSBaudRate(9600); wait1Msec(2000); writeDebugStreamLine("slave alive"); while(true) { num = nxtGetAvailHSBytes(); if (num > 0) { wait1Msec(20); num = nxtGetAvailHSBytes(); nxtReadRawHS(incoming[0], num); if (num == 16) { chksum = 0; for (int i = 1; i < 15; i++) { chksum ^= incoming[i]; } if ((chksum == incoming[0]) && (chksum == incoming[15])) { counter++; writeDebugStreamLine("%d %d", counter, incoming[0]); } else writeDebugStreamLine("BAD CHKSUM"); } else { writeDebugStreamLine("SMALL %d", num); } } } }
I don't think any of the checksum stuff is even implemented in the master, so you should see a consistent "BAD CHKSUM" on the debug stream of the slave.
_________________ Matt
Wed Dec 05, 2012 3:53 pm
didiercoll
Novice
Joined: Sat Sep 15, 2012 11:28 am Posts: 67
Re: AMX 13 bridge layer
thanks
I do not understand what you say ( my poor english and computer knowledge )
but it gives :
slave alive SMALL 127 BAD CHKSUM BAD CHKSUM BAD CHKSUM BAD CHKSUM 1 15 BAD CHKSUM BAD CHKSUM BAD CHKSUM BAD CHKSUM BAD CHKSUM BAD CHKSUM BAD CHKSUM
Users browsing this forum: No registered users and 8 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