LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

NXT PID Controller from PC

Hello,

 

I've implemented a PID controller on PC to control NXT Robot in this steps:
 
1. NXT sends the sensor value (Light sensor) to PC.
2. PC performs all calculations (PID controller and motor power for each wheel)
3. NXT receives the powers of motors and applies to corresponding motor.
 
With USB connection, robot follows the line very well and execution time is only 15 ms. But with Bluetooth, execution time up to 60 ms (!!) and the robot cannot follow the line properly.
 
Is it normal that Bluetooth has this latency? The only solution is to implement the PID controller directly on the NXT?
I've attached the robot's program.
 
Thanks!
0 Kudos
Message 1 of 3
(6,401 Views)

Nobody has had time problems sending and receiving with bluetooth to/from NXT?

0 Kudos
Message 2 of 3
(6,371 Views)

Bluetooth is always going to be slower than USB, and best performance would be doing the PID control on the NXT.

Can you attach your host side program as well so we can see how you are sending/receiving messages on that pc? 

 

Are you using a mac with built in bluetooth radio? Sometimes people get better performance on mac with an external dongle.

 

Another option would be disabling the status check when a message is written to the NXT. 

See the following vi: 

C:\Program Files (x86)\National Instruments\LabVIEW 2012\vi.lib\NXT\DirectCommands\NXTToolkit.DC.MessageWrite.vi

There is a true constant on the diagram that specifies "requireResponse". This enables getting a response back that the messageWrite succeeded. I'm not sure how important it is, but setting that to false would reduce the number of bluetooth transactions in the loop by one.

0 Kudos
Message 3 of 3
(6,241 Views)