Skip to content

Testing Actuator with ROS and WSL

Andrew edited this page Oct 26, 2024 · 1 revision
  1. Upload actuator_current_sense.ino to the Teensy connected to the actuator board.

    • Make sure the board is powered, whether from the Teensy or a power supply
  2. Connect a servo to the actuator servor pins (or you could do this on a breadboard). There are 5 servo channels. The pins from top to bottom are red (pwr), brown (gnd), orange/yellow (pwm). Confirm that the pin numbers match with the pins in the code. You can check the Altium file.

    • J2 (2nd servo port): SERVO_PIN=11, CURRENT_PIN=16
  3. In Powershell (Administrator), attach the Teensy USB to WSL:

    • usbipd list to determine the busid of the teensy (replace '2-3' below when binding/attaching)
    • usbipd bind --busid 2-3
    • usbipd attach --wsl --busid 2-3
  4. Open 4 separate WSL windows.

In Window 1: Start ROS with roscore

In Window 2: ls /dev/tty* (confirm you see ttyACM0 which should be the teensy). Then launch the node: rosrun rosserial_python serial_node.py /dev/ttyACM0 .

In Window 3: rostopic list This is where you will be publishing 'messages' to your node. For the actuator, it is currently setup with /close as the topic name which takes in booleans. So you can use: rostopic pub /close std_msgs/Bool "data: false"

In Window 4: We want to subscribe to messages (topics) from the node which you can see with rostopic list. To see the messages that the Teensy publishes to /contact, use rostopic echo /contact

Clone this wiki locally