User Tools

Site Tools


dynamixel:sw_prelim

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dynamixel:sw_prelim [2018/06/25 12:56] typosdynamixel:sw_prelim [2024/09/23 13:33] (current) typos
Line 1: Line 1:
-====== Dynamixel Motors: Preliminaries  ======+====== Dynamixel Motors: Matlab API  ======
 --------------------------------------------- ---------------------------------------------
  
-This page reviews some preliminaries prior to using a laptop/PC to communicate with and command Dynamixel motors. It assumes that [[dynamixel:hw_setup | hardware setup ]] instructions have been completed.+Here, we walk through set up and example scripts to communicate with connected Dynamixel motors, using Matlab
  
 +**Prerequisite:** This assumes instructions in [[dynamixel:hardware | hardware setup ]] have been completed.
  
 +===== Clone Repositories  =====
 +Clone the [[ https://github.gatech.edu/ivabots/dynamixel | **dynamixel** ]] repository maintained on Georgia Tech GitHub Enterprise: git@github.gatech.edu:ivabots/dynamixel.git
  
 +**Note:** Walk-through instructions to set up and clone Git repositories can be found [[git:get_started | here ]].
  
 +===== Dynamixel Matlab API  =====
 +Within the repository, a ''Dynamixel_IO'' Matlab class has been created to facilitate convenient communication with and operation of the motors: code/matlab/Dynamixel_IO/Dynamixel_IO.m
  
 +Take some time to explore the class definition and high-level methods available. 
  
 +**Disclaimer(s)**: 
 +  - The ''Dynamixel_IO'' Matlab class only supports Dynamixel motors using 10-bit encoders (e.g. AX and RX line of motors). A variant (not yet committed to the repository) has been created to support most functions associated to motors that use 12-bit encoders (e.g. MX line of motors) and is available upon request.  
 +  - The ''Dynamixel_IO'' class relies on pre-compiled lower-level libraries to communicate with the motors. It presumes the libraries are located in a specific relative path. If you clone the **dynamixel** repo and use the ''Dynamixel_IO'' class from the repository location, there should be no problem. If you move the Dynamixel_IO.m file out of the cloned repository location and use it elsewhere, however, it may not be able to find dependency libraries expected to reside within in the repository.
 +  - Pre-compiled libraries are available only for Linux (32- & 64-bit) and Windows (32- and 64-bit). This API doesn't currently support Mac OSX. Additionally, if run on Windows 64-bit, the user may be required to install a compiler that Matlab supports (e.g. for running MEX compilations)
 +  - This API will eventually be updated to use ROBOTIS' latest software interface. 
  
-[[dynamixel:hw_setup | Previous: Hardware Setup ]] -- [[: | Next: ]]+===== Test Script and Exercise  ===== 
 +Within the **dynamixel** repo, navigate to: code/matlab/Dynamixel_IO/test_cases. 
 + 
 +Open and view the following test script which will command a (user-specified) motor ID to a desired position : test_case_command_single_motor.m 
 + 
 +**Some notes**: 
 +  - Find your port number: A serial-to-USB device (e.g. ROBOTIS U2D2 or a red FTDI breakout board) should be connected to the PC via USB. On Linux, you should find a device file for it within '/dev'. Use the terminal command ''ls /dev/ttyUSB*'' to view a list of device files that may correspond to this device. The number after 'ttyUSB' is your port number. Use that as the 1st argument to ''dxl.connect( ... );'' in the test script. 
 +  - **Motor ID:** You will need to know the ID of the motor you'd like to command using this script. Enter that value in the line, ''motor_id = 17;'', replacing ''17'' with your motor's ID. 
 +  - **Command a position:** In the line, ''dest_pos = pi/6;'', replace ''pi/6'' with a motor position (radians) you'd like the motor to travel to. Each Dynamixel motor product line has a set of specifications that document the minimum/maximum range of motion. As an example, the AX-12 specifications can be found on its [[ https://emanual.robotis.com/docs/en/dxl/ax/ax-12a/ | e-manual page ]]. Every motor model has its own e-manual (Google the motor model name + "Dynamixel e-manual").  
 +  - **Run the script:** Once you're done, hit the 'Play' button and follow any instructions in the prompt. If everything works out, you should see the desired motor move to the specified position. 
 + 
 +**Exercise(s)**:  
 +  - You've commanded a single motor to a single angular position. Can you now modify the Matlab script to command the motor to smoothly travel a sinusoidal trajectory (eg. with user-adjustable frequency, amplitude and phase offset) over time? Demonstrate this trajectory (with your choice of frequency, amplitude, phase, etc.) over 5 sine periods. 
 +  - Now that you've commanded a time-varying trajectory for a single motor. Command 2 different trajectories for 2 motors! Make sure that both motors are following different sinusoidal trajectories - eg. they both can execute a sinusoidal trajectory over time, but each one should follow a sine wave defined by different parameters (eg. different frequency, amplitude and/or phase offset). 
 + 
 + 
 +--------- 
 +;#; 
 +[[dynamixel:hardware | Previous: Hardware Setup ]] -- [[dynamixel:main | Main (Dynamixel) ]] -- [[dynamixel:ros | Next: ROS ]] 
 +;#;
dynamixel/sw_prelim.1529945783.txt.gz · Last modified: 2024/08/20 21:38 (external edit)