8000 GitHub - mamacker/SerialMotorController
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mamacker/SerialMotorController

Repository files navigation

Robot Motor Controller Library

This library is the first step in creating a small robot using an API similar to the one used by Pioneers at Berkeley.

Getting Started

1. Install Dependencies

Make sure you have the following installed:

  • Python 3
  • Pygame
  • PySerial
  • Pynput

You can install the required Python packages using pip:

pip install pygame pyserial pynput

2. Determine the COM Port on Windows

  1. Open Device Manager by right-clicking on the Windows Start menu and selecting Device Manager.
  2. In Device Manager, expand the Ports (COM & LPT) section.
  3. Look for a device labeled USB Serial Device. Note the COM port number (e.g., COM3).

This is the COM port you’ll need to use in your code.

The serial port on Mac

  1. Open settings and navigate to Security and Privacy

  2. Open input monitoring

  3. Enable the terminal for input monitoring

  4. Re-open terminal (you may need to close it)

  5. Change directory to /dev/ and list the "usbmodems"

ls /dev/cu.*

You should see similar output (you want the one that has "usbmodem"):

/dev/cu.Bluetooth-Incoming-Port    /dev/cu.usbmodem14792    /dev/cu.SLAB_USBtoUART      /dev/cu.SLAB_USBtoUART7

3. Test Simple Communications

Try to auto find the port.

  1. Easy test is to run test_robot.py. This will auto-find your com ports.
  2. Run it:
    python3 test_robot.py

Direct edit of a test.

  1. More direct editing - in case you know one of the motor controller ports.

  2. Open test.py in your code editor.

  3. Replace the COM port (or /dev/tty*** on Linux/Mac) with the appropriate COM port for your device.

  4. Save test.py.

  5. Run the test script to verify communication with the motor controller:

    python3 ./test.py

If everything is set up correctly, you should see messages coming back from the motor controller.

Communicating with Motor Controllers

Each motor controller has a unique name. You can find out the name by sending the following serial command:

GET_NAME

This will return a string that identifies the motor controller, like: TLAWIEESYT.

4. Update the Code with Motor Controller Names

Make sure to enter these names in the code wherever necessary to identify and control each motor controller correctly.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0