Questions tagged [nxt-python]

nxt-python is a python driver/interface for the Lego Mindstorms NXT robot.

From nxt-python homepage:

nxt-python is a python driver/interface for the Lego Mindstorms NXT robot.

nxt-python works by sending the direct commands detailed in LEGO's "Bluetooth Development Kit" to the nxt brick, and on occasion providing a greater level of abstraction.

In the sensor module, support has been added for many third-party sensors using protocol information from the sensors' manufacturers or by reverse engineering demo programs for other languages.

11 questions
2
votes
1 answer

Python nxt mindstorms connection issues

I want to connect to a LEGO Mindstorms NXT robot using Python 3 via USB, however I am getting a BrickNotFoundError when I attempt to connect. Here is the script I am attempting to run: #!/usr/bin/env python import nxt.locator from nxt.motor import…
2
votes
0 answers

Problems to connect to NXT brick

I'm using nxt-python 1.2.0, PyBluez 0.22, PyUsb 1.0.0 with Python 2.7 and LibUSB-Win32 1.2.6.0 on Windows 10. I tried to connect to my NXT brick with bluetooth and with usb but I could not get it to connect either way. With bluetooth, I get the…
Va2sili
  • 21
  • 3
1
vote
0 answers

How to resolve nxt-python error "ImportError: No module named 'nxt'"

I am attempting to use nxt-python in order to program a robot. I installed nxt-python for mac by following these instructions. After installing it I decided to run one of the example scripts: #!/usr/bin/env python import nxt.locator from nxt.motor…
Foobar
  • 7,458
  • 16
  • 81
  • 161
1
vote
1 answer

Errors when connecting to nxt brick

I'm using nxt-python to connect to my nxt brick from my raspberry pi. After some struggle with the python 3.2 versions of the bluetooth and usb libraries it requires i've managed to get it to connect via bluetooth and ask for a passkey. After some…
DutChen18
  • 1,133
  • 1
  • 7
  • 24
1
vote
0 answers

NXT programming in python

I need some help with my program. Somehow it goes to the exception and prints EROR1 and EROR2. I'm looking for a way how to solve nxt.error.DirProtError but I couldn't find anything. import nxt, nxt.bluesock, time from nxt.error import…
og13
  • 11
  • 2
1
vote
1 answer

Fixing the turn method in nxt-python

I want to be able to stop my robot from moving when it meets an obstacle. However the turn method in the SynchronizedMotors class under motor.py doesn't allow me to do so. How could I fix that? Is there any direct solution? I did try using a thread,…
Edward
  • 93
  • 10
0
votes
0 answers

Why Is My NXT-Python Code not working over bluetooth

I am on my Raspberry pi Running Python 3.9.2 And i Believe my NXT-Python version is python-3.2.0 I'm Trying to run code over Bluetooth By the way Im Completely new to nxt-python this is my simple program found in the nxt-python documentation import…
0
votes
1 answer

How to fix nxt.motor.BlockedException?

I have the following script:  #!/usr/bin/env python import nxt.locator from nxt.motor import * def spin_around(b): m_left = Motor(b, PORT_B) m_left.turn(100, 360) m_right = Motor(b, PORT_C) m_right.turn(-100, 360) print("Script…
Foobar
  • 7,458
  • 16
  • 81
  • 161
0
votes
1 answer

nxt-python error: usb.core.NoBackendError

I have Python 2 and Python 3 installed on my system. I run the following script: #!/usr/bin/env python import nxt.locator from nxt.motor import * def spin_around(b): m_left = Motor(b, PORT_B) m_left.turn(100, 360) m_right = Motor(b,…
Foobar
  • 7,458
  • 16
  • 81
  • 161
0
votes
1 answer

Ultrasonic thread that runs in the background in python

How do I create a thread that continuously checks for obstacles using the ultrasonic class in nxt-python 2.2.2? I want to implement it in a way that while my robot is moving it also detects obstacles in a background process and once it detects an…
Edward
  • 93
  • 10
0
votes
1 answer

Robot does not stop

Attached is a code that moves the robot to a particular distance, however i want it to stop moving as it approaches and obstacle. How do i do this? i have tried adding the ultrasonic to detect an obstacle. I am using nxt-python def move_to(brick,…
Edward
  • 93
  • 10