# mih_interact (ROS2) ### 1. LEDs - teensy 3.2 - ![](https://i.imgur.com/GN1Hey8.png =187x300) - neopixel - logic level shifter - CAN-BUS - [How to use CAN bus on Teensy 4.1, 4.0 and 3.2 ?](https://forum.pjrc.com/threads/64321-How-to-use-CAN-bus-on-Teensy-4-1-4-0-and-3-2) - [FlexCAN library](https://github.com/pawelsky/FlexCAN_Library) - read and write test w/ kvaser node ``` #include <FlexCAN_T4.h> FlexCAN_T4<CAN0, RX_SIZE_256, TX_SIZE_16> can0; CAN_message_t msg; CAN_message_t tx_msg; int LED_PIN = 13; void setup(void) { can0.begin(); can0.setBaudRate(500000); pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, 1); delay(500); Serial.println(F("Hello Teensy 3.2 CAN Test.")); } void loop() { if ( can0.read(msg) ) { Serial.print("CAN0 "); Serial.print("MB: "); Serial.print(msg.mb); Serial.print(" ID: 0x"); Serial.print(msg.id, HEX ); Serial.print(" EXT: "); Serial.print(msg.flags.extended ); Serial.print(" LEN: "); Serial.print(msg.len); Serial.print(" DATA: "); for ( uint8_t i = 0; i < msg.len; i++ ) { Serial.print(msg.buf[i]); Serial.print(" "); } Serial.print(" TS: "); Serial.println(msg.timestamp); digitalWrite(LED_PIN, !digitalRead(LED_PIN)); } else { tx_msg.mb= 0; tx_msg.id= 0x7FF; tx_msg.flags.extended= 0; tx_msg.len= 8; tx_msg.buf[0]='a'; tx_msg.buf[1]='b'; tx_msg.buf[2]='c'; tx_msg.buf[3]='d'; tx_msg.buf[4]='e'; tx_msg.buf[5]='f'; tx_msg.buf[6]='g'; tx_msg.buf[7]='h'; can0.write(tx_msg); } } ``` - Kvaser can-bus official ROS pkg does not support to ROS2 foxy - on ROS1 **(uint8[8] data)** ``` rostopic pub -r 10 /can_rx can_msgs/Frame "header: seq: 0 stamp: {secs: 0, nsecs: 0} frame_id: '' id: 0x0D is_rtr: false is_extended: false is_error: false dlc: 4 data: [1,2,3,4,5,6,7,8]" ``` ### 2. Dynamixel - Pre-install `sudo apt install ros-foxy-dynamixel-sdk ros-foxy-dynamixel-sdk-custom-interfaces ros-foxy-dynamixel-sdk-examples` - Dynamixel SDK - [eManual](https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/device_setup/#controller) - [AX-12 control table](https://emanual.robotis.com/docs/en/dxl/ax/ax-12a/#control-table-data-address) - [DYNAMIXEL Protocol 1.0](https://emanual.robotis.com/docs/en/dxl/protocol1/) ### 3. PoseNet - PoseNet - [TPU Posenet ROS2](https://github.com/shunchan0677/TPU-Posenet-ROS2)