Skip to content

does not accept usb-port from configs.py #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mukral opened this issue May 10, 2025 · 4 comments
Open

does not accept usb-port from configs.py #1094

mukral opened this issue May 10, 2025 · 4 comments
Labels
bug Something isn’t working correctly robots Issues concerning robots HW interfaces

Comments

@mukral
Copy link

mukral commented May 10, 2025

Hello,

script
find_motors_bus_port.py
found COM3 and COM4 (windows environment).

script
python lerobot/scripts.py --port COM4 --brand feetech --model sts3215 --baudrate 1000000 --ID 1
works and the motor moves.

But when I try to calibrate and run
python lerobot/scripts/control_robot.py --robot.type=so101 --control.type=calibrate
I receive an error
serial.serialutil.SerialException: could not open port '/dev/tty.usbmodem585A0076891'
which is the default one from original file.

although port in config.py is set to COM4 and COM3:
...
@RobotConfig.register_subclass("so101")
@DataClass
class So101RobotConfig(ManipulatorRobotConfig):
calibration_dir: str = ".cache/calibration/so101"
# max_relative_target limits the magnitude of the relative positional target vector for safety purposes.
# Set this to a positive scalar to have the same value for all motors, or a list that is the same length as
# the number of motors in your follower arms.
max_relative_target: int | None = None

leader_arms: dict[str, MotorsBusConfig] = field(
    default_factory=lambda: {
        "main": FeetechMotorsBusConfig(
            port="COM4",
            motors={
                # name: (index, model)
                "shoulder_pan": [1, "sts3215"],
                "shoulder_lift": [2, "sts3215"],
                "elbow_flex": [3, "sts3215"],
                "wrist_flex": [4, "sts3215"],
                "wrist_roll": [5, "sts3215"],
                "gripper": [6, "sts3215"],
            },

...
Cache also should be deleted , because I've booted the system (several) times.
Any idea?

short other question: does anybody know how to replace the ' " ' in
--control.arms='["main_follower"]'?
windows seems to have problems with it and throws an error
The given value='[main_follower]' is not of a valid input for a list type

Thanks a lot,
Markus

@jakmilller
Copy link

I encountered the same issue on a Linux system. Although I'm sure there's alternative solutions, I fixed it by creating my own configuration file so100_config.yaml seen below

robot:
  type: so100
  cameras: {}
  follower_arms:
    main:
      mock: false
      motors:
        elbow_flex: [3, "sts3215"]
        gripper: [6, "sts3215"]
        shoulder_lift: [2, "sts3215"]
        shoulder_pan: [1, "sts3215"]
        wrist_flex: [4, "sts3215"]
        wrist_roll: [5, "sts3215"]
      port: /dev/ttyACM1
      type: feetech  # Added missing type field
  leader_arms:
    main:
      mock: false
      motors:
        elbow_flex: [3, "sts3215"]
        gripper: [6, "sts3215"]
        shoulder_lift: [2, "sts3215"]
        shoulder_pan: [1, "sts3215"]
        wrist_flex: [4, "sts3215"]
        wrist_roll: [5, "sts3215"]
      port: /dev/ttyACM0
      type: feetech  # Added missing type field
control:
  type: calibrate
  arms: ["main_follower"]

Try inserting your appropriate port names into this and running python3 lerobot/scripts/control_robot.py --config so100_config.yaml. Hopefully this works for you.

@jakmilller
Copy link

If you get the same error when trying to teleoperate, change the last part of the file to

control:
  type: teleoperate

deleting the arms parameter, and run the same command as above.

@CarolinePascal CarolinePascal added bug Something isn’t working correctly robots Issues concerning robots HW interfaces labels May 14, 2025
@CarolinePascal
Copy link
Collaborator

Hi @mukral !

Could you check if the port you want to use is correctly reported in the configuration displayed when the script is launched ? With the unmodified default configs.py you should see :

INFO 2025-05-14 12:02:43 ol_robot.py:409 {'control': {'arms': ['main_follower']},
 'robot': {'calibration_dir': '.cache/calibration/so101',
           'cameras': {},
           'follower_arms': {'main': {'mock': False,
                                      'motors': {'elbow_flex': [3, 'sts3215'],
                                                 'gripper': [6, 'sts3215'],
                                                 'shoulder_lift': [2,
                                                                   'sts3215'],
                                                 'shoulder_pan': [1, 'sts3215'],
                                                 'wrist_flex': [4, 'sts3215'],
                                                 'wrist_roll': [5, 'sts3215']},
                                      'port': '/dev/tty.usbmodem585A0076891'}},
           'gripper_open_degree': None,
           'leader_arms': {'main': {'mock': False,
                                    'motors': {'elbow_flex': [3, 'sts3215'],
                                               'gripper': [6, 'sts3215'],
                                               'shoulder_lift': [2, 'sts3215'],
                                               'shoulder_pan': [1, 'sts3215'],
                                               'wrist_flex': [4, 'sts3215'],
                                               'wrist_roll': [5, 'sts3215']},
                                    'port': '/dev/tty.usbmodem58760431091'}},
           'max_relative_target': None,
           'microphones': {},
           'mock': False}}

If your modifications were correctly taken into account, the output should be modified accordingly.

Best,

Caroline.

@ZeroHezi
Copy link

ZeroHezi commented May 14, 2025

When running control_robot.py, maybe the program defaults to loading modules from the site-packages directory in the virtual environment, rather than from the current working directory. To resolve this, add the following code at the beginning of the control_robot.py script to insert the current working directory at the front of sys.path, ensuring that modules from the current directory are loaded first:

import sys
current_working_directory = '/home/user/lerobot/'
sys.path.insert(0, current_working_directory)

With this change, Python will prioritize loading modules from the current_working_directory over those in site-packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working correctly robots Issues concerning robots HW interfaces
Projects
None yet
Development

No branches or pull requests

4 participants