Skip to content

Add CAN and IMU emulation scripts - #27

Draft
EricPedley wants to merge 14 commits into
masterfrom
eric/can-imu-emulator
Draft

EricPedley wants to merge 14 commits into
masterfrom
eric/can-imu-emulator

Conversation

@EricPedley

@EricPedley EricPedley commented Sep 11, 2025

Copy link
Copy Markdown
Contributor

This makes it easier to test firmware changes without actually using the real hardware. So far, we've had quite a few scary moments testing firmware changes on the robot due to:

  • changing the command structure
  • making kinfer files that just pass through commands
  • changing the number of DOFS on the robot
    The scary thing that happens is the joints getting setpoints that are far away from their current position, or in impossible-to-reach configurations, and it slams against itself or the hard-stops or the the table really violently.

This PR adds some files that will emulate the actuator CAN buses and IMU connection so the firmware can be ran without any hardware.

  • to run the CAN emulation
    • cd into scripts and run run.sh
    • run export CAN_INTERFACES=can0,can1 before running the firmware
  • to run the IMU emulation
    • cd into scripts/usb and run start.sh
    • export IMU_DEV=/tmp/imu_emulator_in before running the firmware for it to connect to the emulator

also, this changes how logging works, so you explicitly have to set export RUST_LOG=info otherwise no logs will be printed. But now RUST_LOG=debug works, whereas it was broken before.

Will update this branch+PR description more before asking for review

motor now should be emulating multi acutator buses

Add PTY-based IMU emulator scripts (socat + python)

Rename PTY links to imu_emulator_in / imu_emulator_out for clarity

socat: create PTYs with mode=0666 so firmware can open without sudo

add printing to see if progress

change imu path with env var

add a bunch of bullshit to read IMU emulator correctly

fix actuator id parse(?)

Fix another thingy

fix stupid fucking hardcoded info log level

add going to positions

fix bus timeout issue

get past homing stage and add a shit ton more debug crap that I probably don't need anymore

add script that does setup and teardown

add rerun logging to motor emulator
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants