### Factory Reset Example in C Source: https://docs.robotis.com/docs/software/dynamixel_sdk/sample_code/c/reset_protocol_1_0 This example demonstrates how to initialize the port and perform a factory reset on a Protocol 1.0 Dynamixel device. Ensure the DEVICENAME and BAUDRATE constants are configured correctly for your specific hardware setup. ```c /* * reset.c * * Created on: 2016. 5. 16. * Author: Leon Ryu Woon Jung */ // // ********* Factory Reset Example ********* // // // Available Dynamixel model on this example : All models using Protocol 1.0 // This example is designed for using a Dynamixel MX-28, and an USB2DYNAMIXEL. // To use another Dynamixel model, such as X series, see their details in E-Manual(support.robotis.com) and edit below "#define"d variables yourself. // Be sure that Dynamixel PRO properties are already set as %% ID : 1 / Baudnum : 1 (Baudrate : 1000000 [1M]) // // Be aware that: // This example resets all properties of Dynamixel to default values, such as %% ID : 1 / Baudnum : 34 (Baudrate : 57600) // #ifdef __linux__ #include #include #include #elif defined(_WIN32) || defined(_WIN64) #include #endif #include #include "dynamixel_sdk.h" // Uses DYNAMIXEL SDK library // Control table address #define ADDR_MX_BAUDRATE 4 // Control table address is different in Dynamixel model // Protocol version #define PROTOCOL_VERSION 1.0 // See which protocol version is used in the Dynamixel // Default setting #define DXL_ID 1 // Dynamixel ID: 1 #define BAUDRATE 1000000 #define DEVICENAME "/dev/ttyUSB0" // Check which port is being used on your controller // ex) Windows: "COM1" Linux: "/dev/ttyUSB0" #define FACTORYRST_DEFAULTBAUDRATE 57600 // Dynamixel baudrate set by factoryreset #define NEW_BAUDNUM 1 // New baudnum to recover Dynamixel baudrate as it was #define OPERATION_MODE 0x00 // Mode is unavailable in Protocol 1.0 Reset #define TORQUE_ENABLE 1 // Value for enabling the torque #define TORQUE_DISABLE 0 // Value for disabling the torque int getch() { #ifdef __linux__ struct termios oldt, newt; int ch; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); return ch; #elif defined(_WIN32) || defined(_WIN64) return _getch(); #endif } int kbhit(void) { #ifdef __linux__ struct termios oldt, newt; int ch; int oldf; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); oldf = fcntl(STDIN_FILENO, F_GETFL, 0); fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); fcntl(STDIN_FILENO, F_SETFL, oldf); if (ch != EOF) { ungetc(ch, stdin); return 1; } return 0; #elif defined(_WIN32) || defined(_WIN64) return _kbhit(); #endif } void msecSleep(int waitTime) { #ifdef __linux__ usleep(waitTime * 1000); #elif defined(_WIN32) || defined(_WIN64) Sleep(waitTime); #endif } int main() { // Initialize PortHandler Structs // Set the port path // Get methods and members of PortHandlerLinux or PortHandlerWindows int port_num = portHandler(DEVICENAME); // Initialize PacketHandler Structs packetHandler(); int dxl_comm_result = COMM_TX_FAIL; // Communication result uint8_t dxl_error = 0; // Dynamixel error uint8_t dxl_baudnum_read; // Read baudnum // Open port if (openPort(port_num)) { printf("Succeeded to open the port!\n"); } else { printf("Failed to open the port!\n"); printf("Press any key to terminate...\n"); getch(); return 0; } // Set port baudrate if (setBaudRate(port_num, BAUDRATE)) { printf("Succeeded to change the baudrate!\n"); } else { printf("Failed to change the baudrate!\n"); printf("Press any key to terminate...\n"); getch(); return 0; } // Read present baudrate of the controller printf("Now the controller baudrate is : %d\n", getBaudRate(port_num)); // Try factoryreset ``` -------------------------------- ### Setup Physical AI Tools Container Source: https://docs.robotis.com/docs/systems/omx/resources/legacy/physical_ai_tools/setup_guide Commands to clone the repository and start the container. ```bash git clone --recurse-submodules https://github.com/ROBOTIS-GIT/physical_ai_tools.git ``` ```bash cd physical_ai_tools/docker && ./container.sh start ``` -------------------------------- ### Factory Reset C++ Example Source: https://docs.robotis.com/docs/software/dynamixel_sdk/sample_code/cpp/reset_protocol_2_0 This example demonstrates how to initialize the Dynamixel SDK and perform a factory reset on a device using Protocol 2.0. Ensure the device name and baudrate are correctly configured for your specific hardware setup. ```cpp /* * factory_reset.cpp * * Created on: 2016. 2. 21. * Author: leon */ // // ********* Factory Reset Example ********* // // // Available Dynamixel model on this example : All models using Protocol 2.0 // This example is designed for using a Dynamixel PRO 54-200, and an USB2DYNAMIXEL. // To use another Dynamixel model, such as X series, see their details in E-Manual(support.robotis.com) and edit below "#define"d variables yourself. // Be sure that Dynamixel PRO properties are already set as %% ID : 1 / Baudnum : 3 (Baudrate : 1000000 [1M]) // // Be aware that: // This example resets all properties of Dynamixel to default values, such as %% ID : 1 / Baudnum : 1 (Baudrate : 57600) // #ifdef __linux__ #include #include #include #elif defined(_WIN32) || defined(_WIN64) #include #endif #include #include "dynamixel_sdk.h" // Uses DYNAMIXEL SDK library // Control table address #define ADDR_PRO_BAUDRATE 8 // Control table address is different in Dynamixel model // Protocol version #define PROTOCOL_VERSION 2.0 // See which protocol version is used in the Dynamixel // Default setting #define DXL_ID 1 // Dynamixel ID: 1 #define BAUDRATE 1000000 #define DEVICENAME "/dev/ttyUSB0" // Check which port is being used on your controller // ex) Windows: "COM1" Linux: "/dev/ttyUSB0" #define FACTORYRST_DEFAULTBAUDRATE 57600 // Dynamixel baudrate set by factoryreset #define NEW_BAUDNUM 3 // New baudnum to recover Dynamixel baudrate as it was #define OPERATION_MODE 0x01 // 0xFF : reset all values // 0x01 : reset all values except ID // 0x02 : reset all values except ID and baudrate int getch() { #ifdef __linux__ struct termios oldt, newt; int ch; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); return ch; #elif defined(_WIN32) || defined(_WIN64) return _getch(); #endif } int kbhit(void) { #ifdef __linux__ struct termios oldt, newt; int ch; int oldf; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); oldf = fcntl(STDIN_FILENO, F_GETFL, 0); fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); fcntl(STDIN_FILENO, F_SETFL, oldf); if (ch != EOF) { ungetc(ch, stdin); return 1; } return 0; #elif defined(_WIN32) || defined(_WIN64) return _kbhit(); #endif } void msecSleep(int waitTime) { #ifdef __linux__ usleep(waitTime * 1000); #elif defined(_WIN32) || defined(_WIN64) Sleep(waitTime); #endif } int main() { // Initialize PortHandler instance // Set the port path // Get methods and members of PortHandlerLinux or PortHandlerWindows dynamixel::PortHandler *portHandler = dynamixel::PortHandler::getPortHandler(DEVICENAME); // Initialize PacketHandler instance // Set the protocol version // Get methods and members of Protocol1PacketHandler or Protocol2PacketHandler dynamixel::PacketHandler *packetHandler = dynamixel::PacketHandler::getPacketHandler(PROTOCOL_VERSION); int dxl_comm_result = COMM_TX_FAIL; // Communication result uint8_t dxl_error = 0; // Dynamixel error uint8_t dxl_baudnum_read; // Read baudnum // Open port if (portHandler->openPort()) { printf("Succeeded to open the port!\n"); } else { printf("Failed to open the port!\n"); printf("Press any key to terminate...\n"); getch(); return 0; } // Set port baudrate ``` -------------------------------- ### Bulk Read and Write Implementation Source: https://docs.robotis.com/docs/software/dynamixel_sdk/bulk_read_write_tutorial/cpp This example shows the full implementation of bulk read and write operations, including port initialization, parameter setup, and the main control loop. ```cpp dxl_addparam_result = groupBulkWrite.addParam(dxl_id2, led_address, data_length_1byte, &led_data); if (!dxl_addparam_result) { std::cout <<"[ID:" << (int)dxl_id2 <<"]groupBulkWrite addparam failed" << std::endl; return 0; } dxl_comm_result = groupBulkWrite.txPacket(); if (dxl_comm_result != COMM_SUCCESS) { std::cout << packetHandler->getTxRxResult(dxl_comm_result) << std::endl; } groupBulkWrite.clearParam(); int dxl1_present_position; do{ dxl_comm_result = groupBulkRead.txRxPacket(); if (dxl_comm_result != COMM_SUCCESS) { std::cout << packetHandler->getTxRxResult(dxl_comm_result) << std::endl; } dxl_getdata_result = groupBulkRead.isAvailable(dxl_id1, present_position_address, data_length_4byte); if (dxl_getdata_result != true) { std::cout << "[ID:" << (int)dxl_id1 << "] groupBulkRead getdata failed" << std::endl; return 0; } dxl_getdata_result = groupBulkRead.isAvailable(dxl_id2, led_address, data_length_1byte); if (dxl_getdata_result != true) { std::cout << "[ID:" << (int)dxl_id2 << "] groupBulkRead getdata failed" << std::endl; return 0; } dxl1_present_position = groupBulkRead.getData(dxl_id1, present_position_address, data_length_4byte); dxl2_led_value_read = groupBulkRead.getData(dxl_id2, led_address, data_length_1byte); printf("[ID:%03d] Present Position : %d \t [ID:%03d] LED Value: %d\n", dxl_id1, dxl1_present_position, dxl_id2, dxl2_led_value_read); } while (abs(target_position - dxl1_present_position) > 10); } data = 0; packetHandler->write1ByteTxRx(portHandler, dxl_id1, torque_on_address, data); packetHandler->write1ByteTxRx(portHandler, dxl_id2, torque_on_address, data); portHandler->closePort(); return 0; } ``` ```cpp #include "dynamixel_sdk/dynamixel_sdk.h" #include int main(){ dynamixel::PortHandler *portHandler = dynamixel::PortHandler::getPortHandler("COM3"); dynamixel::PacketHandler *packetHandler = dynamixel::PacketHandler::getPacketHandler(2.0); dynamixel::GroupBulkWrite groupBulkWrite(portHandler, packetHandler); dynamixel::GroupBulkRead groupBulkRead(portHandler, packetHandler); uint8_t dxl_error = 0; int dxl_comm_result = COMM_TX_FAIL; bool dxl_addparam_result = false; bool dxl_getdata_result = false; if (portHandler->openPort()) { std::cout << "Succeeded to open the port!\n"; } else { std::cout << "Failed to open the port!\n"; return 0; } if (portHandler->setBaudRate(57600)) { std::cout << "Succeeded to change the baudrate!\n"; } else { std::cout << "Failed to change the baudrate!\n"; return 0; } uint8_t dxl_id1 = 1; uint8_t dxl_id2 = 2; uint16_t torque_on_address = 64; uint8_t data = 1; dxl_comm_result = packetHandler->write1ByteTxRx(portHandler, dxl_id1, torque_on_address, data, &dxl_error); if (dxl_comm_result != COMM_SUCCESS) { std::cout << packetHandler->getTxRxResult(dxl_comm_result) << std::endl; } else if (dxl_error != 0) { std::cout << packetHandler->getRxPacketError(dxl_error) << std::endl; } else { std::cout << "Dynamixel#1 has been successfully connected \n"; } dxl_comm_result = packetHandler->write1ByteTxRx(portHandler, dxl_id2, torque_on_address, data, &dxl_error); if (dxl_comm_result != COMM_SUCCESS) { std::cout << packetHandler->getTxRxResult(dxl_comm_result) << std::endl; } else if (dxl_error != 0) { std::cout << packetHandler->getRxPacketError(dxl_error) << std::endl; } else { std::cout << "Dynamixel#2 has been successfully connected \n"; } uint16_t present_position_address = 132; uint16_t data_length_4byte = 4; dxl_addparam_result = groupBulkRead.addParam(dxl_id1, present_position_address, data_length_4byte); if (!dxl_addparam_result) { std::cout <<"[ID:" << (int)dxl_id1 <<"]groupBulkRead addparam failed" << std::endl; return 0; } uint16_t led_address = 65; uint16_t data_length_1byte = 1; dxl_addparam_result = groupBulkRead.addParam(dxl_id2, led_address, data_length_1byte); if (!dxl_addparam_result) { std::cout <<"[ID:" << (int)dxl_id2 <<"]groupBulkRead addparam failed" << std::endl; return 0; } int target_position = 0; uint8_t dxl2_led_value_read = 0; while(true){ std::cout << "Enter target position (0 ~ 4095): "; std::cin >> target_position; if(target_position == -1){ break; } else if(target_position < 0 || target_position > 4095){ std::cout << "Position must be between 0 and 4095." << std::endl; continue; } ``` -------------------------------- ### Install qt_ros package Source: https://docs.robotis.com/docs/systems/op3/recovery Install the qt_ros package using apt. ```bash $ sudo apt install ros-kinetic-qt-ros ``` -------------------------------- ### Start Docker Container Source: https://docs.robotis.com/docs/systems/aiworker/simulation/isaac_sim_lab Builds and starts the simulation environment container. ```bash ./docker/container.sh start ``` -------------------------------- ### Build and Install SDK Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/c Navigate to the appropriate build directory and install the SDK. ```bash $ cd DynamixelSDK/c/build/linux64 # for 64-bit systems $ sudo make install ``` -------------------------------- ### Get Time Since Start (Linux) Source: https://docs.robotis.com/docs/software/dynamixel_sdk/api_reference/c/c_porthandler Retrieves the elapsed time since the start of the port operation. ```c double getTimeSinceStartLinux(int port_num) ``` -------------------------------- ### getTimeSinceStartWindows Source: https://docs.robotis.com/docs/software/dynamixel_sdk/api_reference/c/c_porthandler Gets the time elapsed since the start. ```APIDOC ## double getTimeSinceStartWindows(int port_num) ### Description This function retrieves the time elapsed since the start. ### Parameters - **port_num** (int) - Port number ``` -------------------------------- ### Navigate to Example Directory Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/c Change the current working directory to the specific protocol and architecture folder for the example. ```bash $ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux32 ``` ```bash $ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux64 ``` -------------------------------- ### getTimeSinceStartLinux Source: https://docs.robotis.com/docs/software/dynamixel_sdk/api_reference/c/c_porthandler Gets the time elapsed since the start of the process. ```APIDOC ## double getTimeSinceStartLinux(int port_num) ### Description This function gets the time elapsed since the start. ### Parameters - **port_num** (int) - Port number ``` -------------------------------- ### Build and Install SDK Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/cpp Navigate to the appropriate build directory and compile the library. ```bash $ cd DynamixelSDK/c++/build/linux64 # for 64-bit systems $ sudo make install ``` -------------------------------- ### Complete Launch File Example Source: https://docs.robotis.com/docs/software/dynamixel_workbench/how_to_set_smoothing_filter Full example of the ompl_planning_pipeline.launch.xml file after applying all modifications. ```xml ``` -------------------------------- ### getTimeSinceStartMac Source: https://docs.robotis.com/docs/software/dynamixel_sdk/api_reference/c/c_porthandler Gets the time elapsed since the start of the port operation. ```APIDOC ## double getTimeSinceStartMac(int port_num) ### Description This function returns the time elapsed since the start of the port operation. ### Parameters - **port_num** (int) - Port number ``` -------------------------------- ### Clone and Setup Kimodo Repository Source: https://docs.robotis.com/docs/systems/aisapiens/motion_generation_retargeting/kimodo Initial steps to clone the repository and prepare the Python environment. ```bash git clone https://github.com/nv-tlabs/kimodo.git cd kimodo ``` ```bash conda create -n kimodo python=3.10 conda activate kimodo ``` -------------------------------- ### Setup ROS Sources List Source: https://docs.robotis.com/docs/systems/openmanipulator_x/quick_start_guide Configures the package repository for manual ROS installation. ```bash $ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' ``` -------------------------------- ### Example Launch Summary Output Source: https://docs.robotis.com/docs/systems/turtlebot3/examples/applications Sample output showing the parameters and nodes initialized for a robot in a namespace. ```text SUMMARY ======== PARAMETERS * /rosdistro: kinetic * /rosversion: 1.12.13 * /tb3_0/turtlebot3_core/baud: 115200 * /tb3_0/turtlebot3_core/port: /dev/ttyACM0 * /tb3_0/turtlebot3_core/tf_prefix: tb3_0 * /tb3_0/turtlebot3_lds/frame_id: tb3_0/base_scan * /tb3_0/turtlebot3_lds/port: /dev/ttyUSB0 NODES /tb3_0/ turtlebot3_core (rosserial_python/serial_node.py) turtlebot3_diagnostics (turtlebot3_bringup/turtlebot3_diagnostics) turtlebot3_lds (hls_lfcd_lds_driver/hlds_laser_publisher) ROS_MASTER_URI=http://192.168.1.2:11311 process[tb3_0/turtlebot3_core-1]: started with pid [1903] process[tb3_0/turtlebot3_lds-2]: started with pid [1904] process[tb3_0/turtlebot3_diagnostics-3]: started with pid [1905] [INFO] [1531356275.722408]: ROS Serial Python Node [INFO] [1531356275.796070]: Connecting to /dev/ttyACM0 at 115200 baud [INFO] [1531356278.300310]: Note: publish buffer size is 1024 bytes [INFO] [1531356278.303516]: Setup publisher on sensor_state [turtlebot3_msgs/SensorState] [INFO] [1531356278.323360]: Setup publisher on version_info [turtlebot3_msgs/VersionInfo] [INFO] [1531356278.392212]: Setup publisher on imu [sensor_msgs/Imu] [INFO] [1531356278.414980]: Setup publisher on cmd_vel_rc100 [geometry_msgs/Twist] [INFO] [1531356278.449703]: Setup publisher on odom [nav_msgs/Odometry] [INFO] [1531356278.466352]: Setup publisher on joint_states [sensor_msgs/JointState] [INFO] [1531356278.485605]: Setup publisher on battery_state [sensor_msgs/BatteryState] [INFO] [1531356278.500973]: Setup publisher on magnetic_field [sensor_msgs/MagneticField] [INFO] [1531356280.545840]: Setup publisher on /tf [tf/tfMessage] [INFO] [1531356280.582609]: Note: subscribe buffer size is 1024 bytes [INFO] [1531356280.584645]: Setup subscriber on cmd_vel [geometry_msgs/Twist] [INFO] [1531356280.620330]: Setup subscriber on sound [turtlebot3_msgs/Sound] [INFO] [1531356280.649508]: Setup subscriber on motor_power [std_msgs/Bool] [INFO] [1531356280.688276]: Setup subscriber on reset [std_msgs/Empty] [INFO] [1531356282.022709]: Setup TF on Odometry [tb3_0/odom] [INFO] [1531356282.026863]: Setup TF on IMU [tb3_0/imu_link] [INFO] [1531356282.030138]: Setup TF on MagneticField [tb3_0/mag_link] [INFO] [1531356282.033628]: Setup TF on JointState [tb3_0/base_link] [INFO] [1531356282.041117]: -------------------------- [INFO] [1531356282.044421]: Connected to OpenCR board! [INFO] [1531356282.047700]: This core(v1.2.1) is compatible with TB3 Burger [INFO] [1531356282.051355]: -------------------------- [INFO] [1531356282.054785]: Start Calibration of Gyro [INFO] [1531356284.585490]: Calibration End ``` -------------------------------- ### Build and install the SDK from source Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/python Navigate to the SDK python directory and install the package using pip. ```bash $ cd DynamixelSDK/python $ pip install . ``` ```bash $ pip install . ``` -------------------------------- ### C++ SDK Build Output Log Source: https://docs.robotis.com/docs/software/dynamixel_easy_sdk/getting_started Example of a successful build and installation log for the C++ library. ```bash mkdir -p ./.objects/ g++ -shared -fPIC -m64 -o ./libdxl_x64_cpp.so ./.objects/group_bulk_read.o ./.objects/group_bulk_write.o ./.objects/group_sync_read.o ./.objects/group_sync_write.o ./.objects/group_fast_bulk_read.o ./.objects/group_fast_sync_read.o ./.objects/group_handler.o ./.objects/packet_handler.o ./.objects/port_handler.o ./.objects/protocol1_packet_handler.o ./.objects/protocol2_packet_handler.o ./.objects/port_handler_linux.o ./.objects/connector.o ./.objects/control_table.o ./.objects/motor.o ./.objects/dynamixel_error.o ./.objects/group_executor.o -lrt cp "./libdxl_x64_cpp.so" "/usr/local/lib/libdxl_x64_cpp.so" ln -s "/usr/local/lib/libdxl_x64_cpp.so" "/usr/local/lib/libdxl_x64_cpp.so.2" ln -s "/usr/local/lib/libdxl_x64_cpp.so" "/usr/local/lib/libdxl_x64_cpp.so.2.0" ln -s "/usr/local/lib/libdxl_x64_cpp.so" "/usr/local/lib/libdxl_x64_cpp.so.2.0.0" cp -r ../../include/dynamixel_sdk/* /usr/local/include/dynamixel_sdk cp -r ../../include/dynamixel_easy_sdk/* /usr/local/include/dynamixel_easy_sdk cp -r ../../../control_table /usr/local/share/dynamixel_sdk/ ldconfig ``` -------------------------------- ### Setup LEAP Motion Source: https://docs.robotis.com/docs/systems/turtlebot3/quick_start_guide/teleoperation Start the LEAP daemon, command panel, and clone the ROS integration package. ```bash $ leapd $ LeapCommandPanel $ git clone git@github.com:warp1337/rosleapmotion.git ``` -------------------------------- ### Compile and Run the Tutorial Source: https://docs.robotis.com/docs/software/dynamixel_easy_sdk/single_motor_tutorial/single_motor_tutorial_step1 Use the g++ compiler to build the application with the required Dynamixel library and execute the resulting binary. ```bash $ g++ tutorial_step1.cpp -o tutorial_step1 -l dxl_x64_cpp $ ./tutorial_step1 ``` -------------------------------- ### Controller Launch Summary Source: https://docs.robotis.com/docs/systems/openmanipulator_p/ros/ros_simulation Example output showing successful initialization of the controller node. ```text SUMMARY ======== PARAMETERS * /open_manipulator_p/control_period: 0.01 * /open_manipulator_p/moveit_sample_duration: 0.05 * /open_manipulator_p/planning_group_name: arm * /open_manipulator_p/using_moveit: False * /open_manipulator_p/using_platform: False * /rosdistro: kinetic * /rosversion: 1.12.14 NODES / open_manipulator_p (open_manipulator_p_controller/open_manipulator_p_controller) ROS_MASTER_URI=http://192.168.3.149:11311 :::info process[open_manipulator_p-1]: started with pid [4388] [INFO] Ready to simulate /open_manipulator_p on Gazebo ``` -------------------------------- ### Attempt OpenVINO Setup Source: https://docs.robotis.com/docs/systems/op3/advanced_tutorials Initializes the OpenVINO core, selects the hardware device, and compiles the model. Requires the model file to exist or triggers creation. ```python def _try_openvino_setup(self) -> bool: """Attempt OpenVINO model setup""" try: # Set model file paths model_dir = Path(f"{self.yolo_model_name}_openvino_model") xml_path = model_dir / f"{self.yolo_model_name}.xml" # Create model if needed if not xml_path.exists(): self.get_logger().info(f"⚙️ Creating OpenVINO model... ({self.yolo_model_name})") self._create_openvino_model() # Re-check after creation if not xml_path.exists(): self.get_logger().warn(f"❌ OpenVINO model creation failed: {xml_path}") return False # Initialize OpenVINO core self.ov_core = ov.Core() # Select device and compile model device = self._select_best_device() self.ov_model = self.ov_core.read_model(str(xml_path)) self.compiled_model = self.ov_core.compile_model(self.ov_model, device) self.device_info = f"OpenVINO {device}" self.is_openvino = True # Warmup self._warmup_model() self.get_logger().info(f"🚀 OpenVINO model loaded | Device: {device}") return True except Exception as e: self.get_logger().warn(f"⚠️ OpenVINO setup failed: {e}") return False ``` -------------------------------- ### Install Panorama Application Packages Source: https://docs.robotis.com/docs/systems/turtlebot3/examples/basic_examples Commands to clone and build the necessary ROS 2 packages for the panorama example on a Remote PC. ```bash $ cd ~/turtlebot3_ws/src/ $ git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3_applications.git $ git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3_applications_msgs.git $ cd ~/turtlebot3_ws/ $ colcon build --symlink-install ``` -------------------------------- ### Install demo program for startup Source: https://docs.robotis.com/docs/systems/op3/getting_started Configures the demo program to run on system startup using robot_upstart. ```bash $ rosrun robot_upstart install --job JOB_NAME --user root --master http://10.42.0.1 op3_demo/launch/demo.launch ``` ```bash rosrun robot_upstart install --job OP3-demo --user root --master http://10.42.0.1:11311 op3_demo/launch/demo.launch ``` -------------------------------- ### Run Serial Node for Arduino Examples Source: https://docs.robotis.com/docs/systems/turtlebot3/more_info/additional_sensors Starts the rosserial node on the Remote PC to communicate with the OpenCR board after uploading sensor firmware. ```bash $ rosrun rosserial_python serial_node.py __name:=turtlebot3_core _port:=/dev/ttyACM0 _baud:=115200 ``` -------------------------------- ### Build and Run Example Code Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/c Commands to compile an example project and execute the resulting binary. ```bash $ cd DynamixelSDK/c/example/protocol2.0 $ cmake -B build $ cmake --build build $ cd build/Debug $ set PATH=C:\Program Files (x86)\dynamixel_sdk_c\bin;%PATH% $ broadcast_ping.exe ``` -------------------------------- ### Indirect Address C++ Implementation Source: https://docs.robotis.com/docs/software/dynamixel_sdk/sample_code/cpp/indirect_address_protocol_2_0 This snippet provides the initial setup, control table definitions, and platform-specific input handling for the indirect address example. ```cpp /* * indirect_address.cpp * * Created on: 2016. 2. 21. * Author: leon */ // // ********* Indirect Address Example ********* // // // Available Dynamixel model on this example : All models using Protocol 2.0 // This example is designed for using a Dynamixel PRO 54-200, and an USB2DYNAMIXEL. // To use another Dynamixel model, such as X series, see their details in E-Manual(support.robotis.com) and edit below "#define"d variables yourself. // Be sure that Dynamixel PRO properties are already set as %% ID : 1 / Baudnum : 3 (Baudrate : 1000000 [1M]) // #ifdef __linux__ #include #include #include #elif defined(_WIN32) || defined(_WIN64) #include #endif #include #include #include "dynamixel_sdk.h" // Uses DYNAMIXEL SDK library // Control table address // Control table address is different in Dynamixel model #define ADDR_PRO_INDIRECTADDRESS_FOR_WRITE 49 // EEPROM region #define ADDR_PRO_INDIRECTADDRESS_FOR_READ 59 // EEPROM region #define ADDR_PRO_TORQUE_ENABLE 562 #define ADDR_PRO_LED_RED 563 #define ADDR_PRO_GOAL_POSITION 596 #define ADDR_PRO_MOVING 610 #define ADDR_PRO_PRESENT_POSITION 611 #define ADDR_PRO_INDIRECTDATA_FOR_WRITE 634 #define ADDR_PRO_INDIRECTDATA_FOR_READ 639 // Data Byte Length #define LEN_PRO_LED_RED 1 #define LEN_PRO_GOAL_POSITION 4 #define LEN_PRO_MOVING 1 #define LEN_PRO_PRESENT_POSITION 4 #define LEN_PRO_INDIRECTDATA_FOR_WRITE 5 #define LEN_PRO_INDIRECTDATA_FOR_READ 5 // Protocol version #define PROTOCOL_VERSION 2.0 // See which protocol version is used in the Dynamixel // Default setting #define DXL_ID 1 // Dynamixel ID: 1 #define BAUDRATE 1000000 #define DEVICENAME "/dev/ttyUSB0" // Check which port is being used on your controller // ex) Windows: "COM1" Linux: "/dev/ttyUSB0" #define TORQUE_ENABLE 1 // Value for enabling the torque #define TORQUE_DISABLE 0 // Value for disabling the torque #define DXL_MINIMUM_POSITION_VALUE -150000 // Dynamixel will rotate between this value #define DXL_MAXIMUM_POSITION_VALUE 150000 // and this value (note that the Dynamixel would not move when the position value is out of movable range. Check e-manual about the range of the Dynamixel you use.) #define DXL_MINIMUM_LED_VALUE 0 // Dynamixel LED will light between this value #define DXL_MAXIMUM_LED_VALUE 255 // and this value #define DXL_MOVING_STATUS_THRESHOLD 20 // Dynamixel moving status threshold #define ESC_ASCII_VALUE 0x1b int getch() { #ifdef __linux__ struct termios oldt, newt; int ch; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); return ch; #elif defined(_WIN32) || defined(_WIN64) return _getch(); #endif } int kbhit(void) { #ifdef __linux__ struct termios oldt, newt; int ch; int oldf; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); oldf = fcntl(STDIN_FILENO, F_GETFL, 0); fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); fcntl(STDIN_FILENO, F_SETFL, oldf); if (ch != EOF) { ungetc(ch, stdin); return 1; } return 0; ``` -------------------------------- ### Build and Run Example Code with CMake Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/cpp Commands to build an example project and execute the resulting binary after setting the library path. ```bash $ cd DynamixelSDK/c++/example/protocol2.0 $ cmake -B build $ cmake --build build $ cd build/Debug $ set PATH=C:\Program Files (x86)\dynamixel_sdk\bin;%PATH% $ broadcast_ping.exe ``` -------------------------------- ### Reboot Dynamixel Example Source: https://docs.robotis.com/docs/software/dynamixel_sdk/sample_code/cpp/reboot_protocol_2_0 Complete C++ implementation for rebooting a Dynamixel device. Ensure the DEVICENAME and BAUDRATE constants are configured for your specific hardware setup. ```cpp /* * reboot.cpp * * Created on: 2016. 2. 21. * Author: leon */ // // ********* reboot Example ********* // // // Available Dynamixel model on this example : All models using Protocol 2.0 // This example is designed for using a Dynamixel PRO 54-200, and an USB2DYNAMIXEL. // To use another Dynamixel model, such as X series, see their details in E-Manual(support.robotis.com) and edit below "#define"d variables yourself. // Be sure that Dynamixel PRO properties are already set as %% ID : 1 / Baudnum : 3 (Baudrate : 1000000 [1M]) // #ifdef __linux__ #include #include #include #elif defined(_WIN32) || defined(_WIN64) #include #endif #include #include "dynamixel_sdk.h" // Uses DYNAMIXEL SDK library // Protocol version #define PROTOCOL_VERSION 2.0 // See which protocol version is used in the Dynamixel // Default setting #define DXL_ID 1 // Dynamixel ID: 1 #define BAUDRATE 1000000 #define DEVICENAME "/dev/ttyUSB0" // Check which port is being used on your controller // ex) Windows: "COM1" Linux: "/dev/ttyUSB0" int getch() { #ifdef __linux__ struct termios oldt, newt; int ch; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); return ch; #elif defined(_WIN32) || defined(_WIN64) return _getch(); #endif } int kbhit(void) { #ifdef __linux__ struct termios oldt, newt; int ch; int oldf; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); oldf = fcntl(STDIN_FILENO, F_GETFL, 0); fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); fcntl(STDIN_FILENO, F_SETFL, oldf); if (ch != EOF) { ungetc(ch, stdin); return 1; } return 0; #elif defined(_WIN32) || defined(_WIN64) return _kbhit(); #endif } int main() { // Initialize PortHandler instance // Set the port path // Get methods and members of PortHandlerLinux or PortHandlerWindows dynamixel::PortHandler *portHandler = dynamixel::PortHandler::getPortHandler(DEVICENAME); // Initialize PacketHandler instance // Set the protocol version // Get methods and members of Protocol1PacketHandler or Protocol2PacketHandler dynamixel::PacketHandler *packetHandler = dynamixel::PacketHandler::getPacketHandler(PROTOCOL_VERSION); int dxl_comm_result = COMM_TX_FAIL; // Communication result uint8_t dxl_error = 0; // Dynamixel error // Open port if (portHandler->openPort()) { printf("Succeeded to open the port!\n"); } else { printf("Failed to open the port!\n"); printf("Press any key to terminate...\n"); getch(); return 0; } // Set port baudrate if (portHandler->setBaudRate(BAUDRATE)) { printf("Succeeded to change the baudrate!\n"); } else { printf("Failed to change the baudrate!\n"); printf("Press any key to terminate...\n"); getch(); return 0; } // Trigger printf("Press any key to reboot\n"); getch(); printf("See the Dynamixel LED flickering\n"); // Try reboot // Dynamixel LED will flicker while it reboots dxl_comm_result = packetHandler->reboot(portHandler, DXL_ID, &dxl_error); if (dxl_comm_result != COMM_SUCCESS) { packetHandler->printTxRxResult(dxl_comm_result); } else if (dxl_error != 0) { packetHandler->printRxPacketError(dxl_error); } printf("[ID:%03d] reboot Succeeded\n", DXL_ID); // Close port portHandler->closePort(); return 0; } ``` -------------------------------- ### Build and Run Example with CMake Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/c Compile and execute an example project using the unified CMake build system. ```bash $ cd DynamixelSDK/c/example/protocol2.0 $ sudo cmake -B build $ sudo cmake --build build $ cd build $ ./broadcast_ping ``` -------------------------------- ### Environment Setup and Build Source: https://docs.robotis.com/docs/systems/hx5_d20/resources/technical_story/tactile_feedback_grasping Commands to clone the repository and enter the required Docker container environment. ```bash # 1. Clone RobotisHand Repository cd ~ git clone https://github.com/ROBOTIS-GIT/robotis_hand.git # 2. Enter Docker Container cd ~/robotis_hand/docker ./container.sh start ./container.sh enter ``` -------------------------------- ### Build and Install the SDK Source: https://docs.robotis.com/docs/software/dynamixel_sdk/library_setup/cpp Commands to configure, build, and manage the installation of the SDK library files. ```bash $ cd DynamixelSDK/c++ $ sudo cmake -B cmake_build $ sudo cmake --build cmake_build --target install $ sudo cmake --build cmake_build --target uninstall # Uninstall the library files from the system ```