lego_dynamixel_2d_plotter
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lego_dynamixel_2d_plotter [2019/04/13 13:07] – [LEGO Dynamixel 2D Plotting Arm Tutorial (IN PROGRESS)] ntorresreyes | lego_dynamixel_2d_plotter [2019/04/26 20:11] (current) – removed ntorresreyes | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Dynamixel Control with NXT (IN PROGRESS) ====== | ||
- | |||
- | **Author:** Norberto Torres-Reyes Email: torresre@unlv.nevada.edu | ||
- | \\ | ||
- | **Date:** Last modified on 04/10/19 | ||
- | \\ | ||
- | **Keywords: | ||
- | \\ | ||
- | |||
- | =====Motivation and Audience===== | ||
- | |||
- | |||
- | |||
- | This tutorial is for anyone who wishes to create a 2-link plotting robotic arm using LEGO Mindstorm, NXC software, and Dynamixel RX-28 servos. This tutorial will also reinforce theoretical knowledge about 2-link planar mechanisms, serial communication, | ||
- | |||
- | <fc blue> | ||
- | *Previous experience with LEGO Mindstorm | ||
- | \\ | ||
- | *Matlab and/or C-based programming experience | ||
- | \\ | ||
- | *Knowledge of linear algebra | ||
- | \\ | ||
- | *Some knowledge in serial communcation | ||
- | \\ | ||
- | *Experience with using servos | ||
- | </fc> | ||
- | \\ | ||
- | The rest of the tutorial is presented as follows: | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | *[[lego_dynamixel_2d_plotter# | ||
- | |||
- | |||
- | ====Parts List==== | ||
- | |||
- | LEGO NXT parts list is given in full detail in the [[lego_dynamixel_2d_plotter# | ||
- | \\ | ||
- | \\ | ||
- | **Dynamixel RX28** | ||
- | \\ | ||
- | https:// | ||
- | \\ | ||
- | PHOTO | ||
- | \\ | ||
- | **Lego BreadBoard Adapter** | ||
- | \\ | ||
- | http:// | ||
- | \\ | ||
- | PHOTO | ||
- | \\ | ||
- | **SMPS2Dynimxel** | ||
- | \\ | ||
- | http:// | ||
- | \\ | ||
- | PHOTO | ||
- | \\ | ||
- | **(Optional) HiLetgo USB Logic Analyzer** | ||
- | \\ | ||
- | https:// | ||
- | \\ | ||
- | PHOTO | ||
- | \\ | ||
- | \\ | ||
- | Other Parts Needed: | ||
- | *NXT Cable | ||
- | PHOTO | ||
- | | ||
- | PHOTO | ||
- | *USB A-to-C cable | ||
- | PHOTO | ||
- | *12V 2-Amp Power Supply | ||
- | PHOTO | ||
- | ====Theoretical Background==== | ||
- | |||
- | The theoretical background can be subdivided into three parts: | ||
- | |||
- | | ||
- | | ||
- | | ||
- | |||
- | **2-Link Arm Kinematics** | ||
- | \\ | ||
- | PHOTO | ||
- | \\ | ||
- | A concise introduction to 2-link arm kinematics can be found [[2_link_kinematics|here]]. This introduction covers the mathematical calculations required to calculate the position of the end-effector from a given set of joint angles and the joint angles required to obtain a specific end-effector position. Along with a review of homogeneous transformations, | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | **RS-485 Serial Communication** | ||
- | \\ | ||
- | \\ | ||
- | PHOTO | ||
- | \\ | ||
- | \\ | ||
- | RS-485 is an EIA/TIA standard for serial communication. This standard is an improvement on the older RS-232 which will not be discussed here. Several improvements include faster speeds, the ability to transmit data at a length of about 4000 feet (1200 meters), the ability to connect up to 32 devices, and good noise immunity. The data rates depend on the length of the cable and can range from 100 kbits/sec at 1200 meters to 10 Mbits/sec at 10 meters. | ||
- | \\ | ||
- | \\ | ||
- | PHOTO OF RS-485 BUS | ||
- | \\ | ||
- | \\ | ||
- | The good noise immunity comes from the differential signal between the two data lines. Using this method, any noise or ground level shifts can be avoided, reducing the chance of data corruption. | ||
- | \\ | ||
- | \\ | ||
- | PHOTO OF DIFFERENTIAL SIGNALS | ||
- | \\ | ||
- | \\ | ||
- | In this tutorial we will be using half-duplex communication although full-duplex can also be used. Half-duplex communication consists of sending and receiving data in only one direction at a time. Specifically, | ||
- | \\ | ||
- | \\ | ||
- | PHOTO OF UART " | ||
- | \\ | ||
- | \\ | ||
- | The signal consists of several different sets of bits. The first bit is the start bit " | ||
- | \\ | ||
- | \\ | ||
- | **Dynamixel Communication** | ||
- | \\ | ||
- | \\ | ||
- | Communication with the Dynamixel RX-28 servos require several parameters. A tutorial about NXT communication with the RX-28 servos can be found [[lego_nxt_dynamixel|here]]. The RX-28 [[http:// | ||
- | \\ | ||
- | \\ | ||
- | IMAGE | ||
- | \\ | ||
- | \\ | ||
- | ====Preliminaries==== | ||
- | **Writing Dynamixel ID's** | ||
- | \\ | ||
- | Some simple tests can first be completed with the NXT and the Dynamixel servos before running the finished program. Occasionally, | ||
- | \\ | ||
- | < | ||
- | //Norberto Torres-Reyes | ||
- | // | ||
- | //Writes ID to a Dynamixel RX-28 with NXT | ||
- | |||
- | #include " | ||
- | #define ID 90 //ID that you want to write to servo | ||
- | |||
- | |||
- | |||
- | task main() | ||
- | { | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | { | ||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | Wait(10); | ||
- | } | ||
- | |||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | } | ||
- | </ | ||
- | Each Dynamixel ID can be changed individually. The ID's can range from 0x01 to 0xFD, where 0xFE is a universal ID that will communicate to all servos at once. | ||
- | \\ | ||
- | \\ | ||
- | **Testing Rotation** | ||
- | \\ | ||
- | Each servo should also be tested for proper operation before beginning the project. The following code will rotate a servo at 100 degree intervals from 0 to 300 degrees by pushing the left and right arrow buttons. Once again, " | ||
- | < | ||
- | //Dynamixel RX-28 Servo Control | ||
- | //Created by: Norberto Torres-Reyes | ||
- | //Date: 03/30/19 | ||
- | //Version 1.0 | ||
- | // | ||
- | // | ||
- | |||
- | #include " | ||
- | #define ID 0XFE | ||
- | // | ||
- | int angleRaw = 0; //Raw 10-bit value for servo angle | ||
- | float angleRes = 1023/ | ||
- | int angleStep = 1023*100/ | ||
- | float angleVal = 0; //degree value converted from raw | ||
- | int rotateSpeed = 50; | ||
- | float offsetVal = 0; | ||
- | |||
- | task main() | ||
- | { | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | { | ||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | Wait(10); | ||
- | } | ||
- | | ||
- | //0 to 300(1023). | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | angleRaw = (angleRaw + angleStep); | ||
- | if(angleRaw >= 1023){ | ||
- | angleRaw = 1023; | ||
- | } | ||
- | servo(ID, | ||
- | angleVal = (angleRaw/ | ||
- | TextOut(0, | ||
- | Wait(200); | ||
- | } | ||
- | |||
- | if(ButtonPressed(BTNLEFT, | ||
- | | ||
- | angleRaw = (angleRaw - angleStep); | ||
- | if(angleRaw <= 0){ // | ||
- | angleRaw = 0; | ||
- | } | ||
- | servo(ID, | ||
- | angleVal = (angleRaw/ | ||
- | TextOut(0, | ||
- | Wait(200); | ||
- | } | ||
- | } | ||
- | } | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ====Build Plans==== | ||
- | |||
- | |||
- | ====NXC Code==== | ||
- | |||
- | |||
- | ====Running and Analysis==== | ||
- | |||
- | |||
- | ====Conclusions==== | ||
lego_dynamixel_2d_plotter.1555186060.txt.gz · Last modified: by ntorresreyes