From: Brian Bagnall <bbagnall@mt...> - 2006-11-17 14:25:17
> 2. First, think about and specify what options we want to support. Then
> up with an
> API that reflects our decisions. There are a lot of options:
> A PC with multiple BT dongles and USB cables. Controlling multiple NXT's
> with 1 BT dongle.
> Controlling 1 NXT from multiple USB dongles. Controlling 1 NXT with 1
> cable connection.
> Combinations of those options.
Controlling multiple NXT's with 1 Bluetooth dongle would be the ideal
target, if that's possible. Rojit from the leJOS discussion list is the only
one who seems to have had some success here, but it wasn't 100% from what he
said. I'll contact him and see if he can tell us more since no one here has
multiple NXT bricks.
> Maybe we should stick with option 1 for v0.6 and think about option 2 for
> v0.7 (or later) ?
I'm fine with that. Motor tacho accuracy and working SyncMotors should be
high priorities for the 0.6 release, since they are pretty flaky right now.
Also, I need to get the Ultrasonic class working, which I thought I had
nailed for 0.5. If we get somewhere with it we could release it as
preliminary support (i.e. it's not tested but they can play with it).
> Forgot 1 thing. We should also get rid of NXTCommand.setVerify(boolean).
> How about (Sorry for reopening the discussion).
> 2 new classes in icommand.platform.nxt: PC an Connection.
> Connection con = PC.connect()
> This is more true to the fact that the connection is initated by the PC
> and not the NXT. It also has a good opening for supporting more options.
> Connection con1 = PC.connect(USB, NXT1); //connect to the 1st NXT with USB
> Connection con2 = PC.connect(BT, NXT2) //connect to the 2nd NXT over BT
> con1.select() //select the connection to the 1st NXT
> Battery.getVoltage() // 1st NXT is selected, so we do not need to specify
> the NXT as method parameter.
I like that architecture for handling the singleton situation. It's probably
the best we can do, considering our goal is to stick to the leJOS
architecture, which puts some limits on us. The obvious downside is that
user code will have to keep calling con2.select() to switch back and forth,
which is messy but necessary. But it's better to cater to single NXT owners,
who make up the majority of people out there.
It would be nice to add a seperate package tailored to the multiple NXT
brick people. One I idea I have is to be very port-centric, since the NXT
will have adapters from HiTechnic and Mindsensors.com for expansion. Plus
there is a NXT-RCX Link to control the RCX, which essentially adds more
ports to the mix. So with multiple NXT's the option could be there for
Motor motor1 = new Motor(nxt1.getPort("A"));
Motor motor5 = new Motor(nxt2.getPort("A"));
PortExpander ports = new PortExpander(nxt1.getPort("C"));
Motor motor7 = new Motor(ports.getPort("D"));
Also, when leJOS NXT comes out we will want to mirror that interface so code
running on the PC is almost identical (other than import statements). We'll
have to wait and see how leJOS NXT develops.