Open Josh-Hout opened 1 year ago
Running with Debug i got more info
DEBUG:nxt.locator:configuration files=['.nxt-python.conf', '/home/joshua/.nxt-python.conf']
DEBUG:nxt.locator:configuration read from []
DEBUG:nxt.locator:no section default, using DEFAULT
INFO:nxt.locator:using backend from nxt.backend.usb
INFO:nxt.locator:using backend from nxt.backend.bluetooth
INFO:nxt.backend.bluetooth:connecting via Bluetooth (00:16:53:15:DC:F2)
WARNING:nxt.backend.bluetooth:failed to connect to device Bluetooth (00:16:53:15:DC:F2)
DEBUG:nxt.backend.bluetooth:error from connect
Traceback (most recent call last):
File "<string>", line 3, in connect
_bluetooth.error: (111, 'Connection refused')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joshua/.local/lib/python3.9/site-packages/nxt/backend/bluetooth.py", line 127, in find
brick = sock.connect()
File "/home/joshua/.local/lib/python3.9/site-packages/nxt/backend/bluetooth.py", line 52, in connect
sock.connect((self._host, PORT))
File "<string>", line 5, in connect
bluetooth.btcommon.BluetoothError: [Errno 111] Connection refused
Is your NXT paired with your computer?
How did you get the device address?
I should add something in the manual for a step by step procedure to connect for each platform.
I got the device address by using usb but then I realized that won’t work because my robot would move
Im also getting better errors im only getting A device is busy error
Is your NXT paired with your computer?
I can only connect with serial port
But it is connected
got similar issue (on macos) :
DEBUG:nxt.locator:configuration read from [] DEBUG:nxt.locator:no section default, using DEFAULT INFO:nxt.locator:using backend from nxt.backend.usb
INFO:nxt.backend.bluetooth:no bluetooth module
Traceback (most recent call last):
File "/Users/dennis/Desktop/nxt_test.py", line 16, in
@Josh-Hout Here is what I do to make it work:
% bluetoothctl
Agent registered
[bluetooth]# devices
[bluetooth]# scan on
Discovery started
[NEW] Device 00:16:53:AA:BB:CC 00-16-53-AA-BB-CC
[CHG] Device 00:16:53:AA:BB:CC LegacyPairing: no
[CHG] Device 00:16:53:AA:BB:CC Name: NXT1
[CHG] Device 00:16:53:AA:BB:CC Alias: NXT1
[CHG] Device 00:16:53:AA:BB:CC LegacyPairing: yes
[bluetooth]# pair 00:16:53:AA:BB:CC
Attempting to pair with 00:16:53:AA:BB:CC
Request PIN code
(here, enter code 1234 on NXT screen)
[agent] Enter PIN code: 1234
[CHG] Device 00:16:53:AA:BB:CC Connected: yes
[CHG] Device 00:16:53:AA:BB:CC UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device 00:16:53:AA:BB:CC ServicesResolved: yes
[CHG] Device 00:16:53:AA:BB:CC Paired: yes
Pairing successful
[CHG] Device 00:16:53:AA:BB:CC ServicesResolved: no
[CHG] Device 00:16:53:AA:BB:CC Connected: no
[bluetooth]# scan off
Discovery stopped
[bluetooth]# devices
Device 00:16:53:AA:BB:CC NXT1
[bluetooth]#
Now I can run a nxt-python script using the 00:16:53:AA:BB:CC address.
If I keep bluetoothctl open, during the script run, I can see:
[CHG] Device 00:16:53:AA:BB:CC Connected: yes
[CHG] Device 00:16:53:AA:BB:CC Connected: no
If it does not work, try to remove the NXT from known devices and start again.
@dmue-vbg
INFO:nxt.backend.bluetooth:no bluetooth module
That’s not the same problem, you do not have a python bluetooth module installed.
See: https://ni.srht.site/nxt-python/latest/installation.html#installation-using-pip
That’s not easy because the current state of pybluez is not good.
@schodet unfortunately i already tried all this installation procedures with a bunch of variations but without any success :( i don't give up hope that i will find a way. thank you for your reply.
@dmue-vbg look at nxt/backend/bluetooth.py
, it gives this error message when it is not able to import bluetooth
. You can try to import bluetooth in a python script, you may have a more useful feedback.
Im Trying to run code over Bluetooth
By the way Im Completely new to nxt-python
this is my simple program found in the nxt doc
I ran the program and got a result of
And i Do have python3-bluez
Am i doing something wrong?