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/25 22:05] – [Running, Testing and Analysis] ntorresreyes | lego_dynamixel_2d_plotter [2019/04/26 20:11] (current) – removed ntorresreyes | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== LEGO 2D Plotter with Dynamixels (IN PROGRESS) ====== | ||
- | |||
- | **Author:** Norberto Torres-Reyes Email: torresre@unlv.nevada.edu | ||
- | \\ | ||
- | **Date:** Last modified on 04/23/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# | ||
- | |||
- | |||
- | ====Parts List==== | ||
- | A few parts for controlling the Dynamixels will be needed along with some parts used to communicate between the NXT Brick and the Dynamixel. The LEGO parts list is shown in the [[lego_dynamixel_2d_plotter# | ||
- | \\ | ||
- | \\ | ||
- | **Dynamixel RX28** | ||
- | \\ | ||
- | https:// | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | **Lego BreadBoard Adapter** | ||
- | \\ | ||
- | http:// | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | **SMPS2Dynamixel** | ||
- | \\ | ||
- | http:// | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | **(Optional) HiLetgo USB Logic Analyzer** | ||
- | \\ | ||
- | https:// | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | Other Parts Needed: | ||
- | *NXT Cable | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | *USB A-to-C cable | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | *12V 2-Amp Power Supply | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | |||
- | ====Theoretical Background==== | ||
- | The theoretical background pertaining to this tutorial includes [[lego_dynamixel_control|NXT/ | ||
- | |||
- | ====Build Plans==== | ||
- | The build plans as well as the parts list are included below. | ||
- | |||
- | |||
- | ====NXC Code==== | ||
- | The code required for this project is shown below. The code is also attached in a .zip file along with the required header file to interface with the Dynamixel servos. | ||
- | |||
- | < | ||
- | //2-Link Inverse Kinematic Control | ||
- | //Norberto Torres-Reyes | ||
- | //Date: 04/25/19 | ||
- | // | ||
- | //servos for a 2-link planar mechanism. | ||
- | |||
- | |||
- | #include " | ||
- | #define ID1 91 | ||
- | #define ID2 90 | ||
- | |||
- | float TwoLinkIK(float linkLength1, | ||
- | |||
- | //Global Variables | ||
- | float theta1 = 0; | ||
- | float theta2 = 0; | ||
- | |||
- | //Program variables | ||
- | int servoOffset1 = 200; //Zero offset value for servo 1 | ||
- | int servoOffset2 = 468; //Zero offset value for servo 2 | ||
- | float posX = 16.9706; | ||
- | float posY = 0.0; | ||
- | float linkLength1 = 12.0; // | ||
- | float linkLength2 = 12.0; | ||
- | |||
- | task main() | ||
- | { | ||
- | int servoPos1 = 0 + servoOffset1; | ||
- | int servoPos2 = 0 + servoOffset2; | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | { | ||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | Wait(10); | ||
- | } | ||
- | | ||
- | | ||
- | { | ||
- | ClearScreen(); | ||
- | TwoLinkIK(linkLength1, | ||
- | servoPos1 = theta1*(180/ | ||
- | servoPos2 = theta2*(180/ | ||
- | |||
- | TextOut(0, | ||
- | TextOut(0, | ||
- | servo(ID1, | ||
- | Wait(5); | ||
- | servo(ID2, | ||
- | Wait(5); | ||
- | | ||
- | posX = posX + 0.0; // | ||
- | posY = posY + 0.0; //by a constant value or by some arbitrary function | ||
- | } | ||
- | } | ||
- | |||
- | // | ||
- | //elbow up/down position can be changed by changing signs | ||
- | |||
- | float TwoLinkIK(float linkLength1, | ||
- | { | ||
- | | ||
- | | ||
- | } | ||
- | </ | ||
- | ====Running, | ||
- | To run the code, open it using "Bricx Command Center" | ||
- | ====Conclusions==== | ||
lego_dynamixel_2d_plotter.1556255112.txt.gz · Last modified: by ntorresreyes