diff --git a/_data/navigation.yml b/_data/navigation.yml index 4e7a404ff..3f3cbd6ce 100644 --- a/_data/navigation.yml +++ b/_data/navigation.yml @@ -532,6 +532,9 @@ main: - title: "DYNAMIXEL" titlekr: "다이나믹셀" children: + - title: "DYNAMIXEL Easy SDK" + titlekr: "다이나믹셀 Easy SDK" + url: /software/dynamixel/dynamixel_easy_sdk/getting_started/ - title: "DYNAMIXEL SDK" titlekr: "다이나믹셀 SDK" url: /software/dynamixel/dynamixel_sdk/overview/ @@ -29628,6 +29631,43 @@ robotis_manipulator_libs: - title: "Step4 Use it" url: /software/robotis_manipulator_libs/#step4-use-it +#DYNAMIXEL EASY SDK sidebar +dynamixel_easy_sdk: + - title: "Getting Started" + url: /software/dynamixel/dynamixel_easy_sdk/getting_started/#requirements + children: + - title: "Requirements" + url: /software/dynamixel/dynamixel_easy_sdk/getting_started/#requirements + - title: "Download and Build SDK" + url: /software/dynamixel/dynamixel_easy_sdk/getting_started/#download-and-build-sdk + - title: "Hardware Setup" + url: /software/dynamixel/dynamixel_easy_sdk/getting_started/#hardware-setup + - title: "Move Motor to target position" + url: /software/dynamixel/dynamixel_easy_sdk/getting_started/#move-motor-to-target-position + - title: "Introduction" + url: /software/dynamixel/dynamixel_easy_sdk/introduction/#dynamixel-easy-sdk-introduction + - title: "Single Motor Control Tutorial" + url: /software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial + children: + - title: "Moving DYNAMIXEL" + url: /software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step1/#dynamixel-easy-sdk-tutorial-step1 + - title: "Read Data from DYNAMIXEL" + url: /software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step2/#dynamixel-easy-sdk-tutorial-step2 + - title: "Leader and Follower" + url: /software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step3/#dynamixel-easy-sdk-tutorial-step3 + - title: "OMX Teleoperation" + url: /software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step4/#dynamixel-easy-sdk-tutorial-step4 + - title: "Group Motor Control Tutorial" + url: /software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial + children: + - title: "Simultaneous Control" + url: /software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step5/#dynamixel-easy-sdk-tutorial-step5 + - title: "Simultaneous Reading" + url: /software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step6/#dynamixel-easy-sdk-tutorial-step6 + - title: "OMX Teleoperation" + url: /software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step7/#dynamixel-easy-sdk-tutorial-step7 + - title: "API Reference" + url: /software/dynamixel/dynamixel_easy_sdk/api_reference/#api-reference #DYNAMIXEL SDK sidebar dynamixel_sdk: @@ -29646,7 +29686,6 @@ dynamixel_sdk: url: /software/dynamixel/dynamixel_sdk/overview/#supported-operating-systems - title: "Supported Languages" url: /software/dynamixel/dynamixel_sdk/overview/#supported-languages -## - title: "Quick Start Guide" url: /software/dynamixel/dynamixel_sdk/quick_start_guide/#quick-start-guide children: @@ -29657,40 +29696,20 @@ dynamixel_sdk: - title: "Library Setup" url: /software/dynamixel/dynamixel_sdk/library_setup/#library-setup children: - - title: "C Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/c_windows/#c-windows - - title: "C Linux" - url: /software/dynamixel/dynamixel_sdk/library_setup/c_linux/#c-linux - - title: "C macOS" - url: /software/dynamixel/dynamixel_sdk/library_setup/c_macos/#c-macos - - title: "CPP Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/cpp_windows/#cpp-windows - - title: "CPP Linux" - url: /software/dynamixel/dynamixel_sdk/library_setup/cpp_linux/#library-setup-cpp-linux - - title: "CPP macOS" - url: /software/dynamixel/dynamixel_sdk/library_setup/cpp_macos/#cpp-macos - - title: "Csharp Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/csharp_windows/#csharp-windows - - title: "Python Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/python_windows/#python-windows - - title: "Python Linux" - url: /software/dynamixel/dynamixel_sdk/library_setup/python_linux/#python-linux - - title: "Python macOS" - url: /software/dynamixel/dynamixel_sdk/library_setup/python_macos/#python-macos - - title: "Java Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/java_windows/#java-windows - - title: "Java Linux" - url: /software/dynamixel/dynamixel_sdk/library_setup/java_linux/#java-linux - - title: "Java macOS" - url: /software/dynamixel/dynamixel_sdk/library_setup/java_macos/#java-macos - - title: "MATLAB Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/matlab_windows/#matlab-windows - - title: "MATLAB Linux" - url: /software/dynamixel/dynamixel_sdk/library_setup/matlab_linux/#matlab-linux - - title: "MATLAB macOS" - url: /software/dynamixel/dynamixel_sdk/library_setup/matlab_macos/#matlab-macos - - title: "LabVIEW Windows" - url: /software/dynamixel/dynamixel_sdk/library_setup/labview_windows/#labview-windows + - title: "C" + url: /software/dynamixel/dynamixel_sdk/library_setup/c/#library-setup-c-linux + - title: "CPP" + url: /software/dynamixel/dynamixel_sdk/library_setup/cpp/#library-setup-cpp-linux + - title: "Python" + url: /software/dynamixel/dynamixel_sdk/library_setup/python/#library-setup-python-linux + - title: "Csharp" + url: /software/dynamixel/dynamixel_sdk/library_setup/csharp/#library-setup-csharp-windows + - title: "Java" + url: /software/dynamixel/dynamixel_sdk/library_setup/java/#library-setup-java-linux + - title: "MATLAB" + url: /software/dynamixel/dynamixel_sdk/library_setup/matlab/#library-setup-matlab-linux + - title: "LabVIEW" + url: /software/dynamixel/dynamixel_sdk/library_setup/labview/#library-setup-labview-windows - title: Basic Read/Write tutorial url: /software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/ children: diff --git a/_includes/en/software/dynamixel_sdk/library_setup/c_linux.md b/_includes/en/software/dynamixel_sdk/library_setup/c_linux.md new file mode 100644 index 000000000..58ed3e84b --- /dev/null +++ b/_includes/en/software/dynamixel_sdk/library_setup/c_linux.md @@ -0,0 +1,114 @@ +{::options parse_block_html="true" /} + +
+

Library Setup <C Linux>

+
+ + +This tutorial is written assuming you are using the latest version of Ubuntu. Commands may not be the same for alternative distributions of Linux. + +# [Install requirements](#install-requirements) + +- The DYNAMIXEL SDK requires GNU gcc ver. 5.4.0 20160609 or higher +- To check the version of your gcc compiler +``` bash +$ gcc -v +``` + +- Download the requirements +``` bash +$ sudo apt-get install gcc +$ sudo apt-get install build-essential +$ sudo apt-get install gcc-multilib g++-multilib # For cross-compiling +``` + +# [Build the SDK](#build-the-SDK) +- Check your system architecture +``` bash +$ uname -m +``` + +- Enter the appropriate build folder depending on your system and build the SDK +``` bash +$ cd DynamixelSDK/c/build/linux64 # for 64-bit systems +$ sudo make install +``` +- make sure to enter the correct folder according to your system architecture. + - `linux64` for 64-bit systems + - `linux32` for 32-bit systems + - `linux_sbc` for ARM-based SBCs like Raspberry Pi + +- If the build completes successfully, you should see the .so file generated inside the build folder. +``` bash +$ ls +libdxl_x86_c.so Makefile +``` + +- Grant permission to access the port +``` bash +$ sudo chmod 666 /dev/ttyUSB0 +``` + +
+- Common `make` commands for building the SDK +``` bash +$ make # Compile the source code and generate binaries +$ make install # Install the library files to the system +$ make clean # Remove all build files and reset the build environment +$ make uninstall # Remove files installed by 'make install' from the system +$ make reinstall # Reinstall by cleaning, rebuilding, and installing again +``` +{: .notice--success} + +# [Building and Running the Sample Code](#building-and-running-the-sample-code) + +The DYNAMIXEL SDK example code for C uses a .so (Linux Shared Object) library built in C. +The previous instructions walk you through building the latest library files in `[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so` built by its own source code. + +* Go to the Makefile's directory using `cd`: + + ``` bash + $ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux32 + ``` + + OR + + ``` bash + $ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux64 + ``` + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc4.png) + +* Build the executable file: + + ``` bash + $ make + ``` + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc1.png) + +* If there is an error, `$ make clean` then `$ make` again. + +* To delete the executable file, `$ make clean`. + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc2.png) + +* Access the port you will be using to communicate with DYNAMIXEL: + + ``` bash + $ sudo chmod a+rw /dev/ttyUSB0 + ``` + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc3.png) + +* Run the executable file: + + ``` bash + $ ./read_write + ``` + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc5.png) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos.md b/_includes/en/software/dynamixel_sdk/library_setup/c_macos.md similarity index 100% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos.md rename to _includes/en/software/dynamixel_sdk/library_setup/c_macos.md diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos_dummy.md b/_includes/en/software/dynamixel_sdk/library_setup/c_macos_dummy.md similarity index 66% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos_dummy.md rename to _includes/en/software/dynamixel_sdk/library_setup/c_macos_dummy.md index aff32e45c..d68e3e439 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos_dummy.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/c_macos_dummy.md @@ -1,24 +1,20 @@ ---- -layout: archive -lang: en -ref: c_macos -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
+ -## [C macOS](#c-macos) +{::options parse_block_html="true" /} + +
+

Library Setup <C macOS>

+
+ {% include en/maintenance_is_in_progress.md %} diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_windows.md b/_includes/en/software/dynamixel_sdk/library_setup/c_windows.md similarity index 60% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_windows.md rename to _includes/en/software/dynamixel_sdk/library_setup/c_windows.md index fa2ab75a5..c920378e0 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_windows.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/c_windows.md @@ -1,44 +1,35 @@ ---- -layout: archive -lang: en -ref: c_windows -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_windows/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- +{::options parse_block_html="true" /} - +
+

Library Setup <C Windows>

+
+ -# [Library Setup](#library-setup) - -## [C Windows](#c-windows) - -### [Compiler and Builder](#compiler-and-builder) - -* [Download Visual Studio Community for Windows Desktop](https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) +# [Install requirements](#install-requirements) +- [Download Visual Studio Community for Windows Desktop](https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/vs.png) -### [Building the Library](#building-the-library) +# [Build the SDK](#build-the-SDK) -* Open the project solution file (.sln) located in the `[DynamixelSDK folder]/c/build/win32` directory OR `[DynamixelSDK folder]/c/build/win64` directory). +- Open the project solution file (.sln) located in the `[DynamixelSDK folder]/c/build/win32` directory OR `[DynamixelSDK folder]/c/build/win64` directory). ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/library_file/1.png) -* In the Solution Explorer, right click on the project and select Properties. +- In the Solution Explorer, right click on the project and select Properties. ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/library_file/2.png) -* Under General Configuration Properties, confirm that the paths and file extensions are set to the following: +- Under General Configuration Properties, confirm that the paths and file extensions are set to the following: - * Output Directory: `$(SolutionDir)output\` - * Intermediate Directory: `$(Configuration)\` - * Platform Toolset: `Visual Studio 20XX (v000)` - * Configuration Type: `Dynamic Library (.dll)`. + - Output Directory: `$(SolutionDir)output\` + - Intermediate Directory: `$(Configuration)\` + - Platform Toolset: `Visual Studio 20XX (v000)` + - Configuration Type: `Dynamic Library (.dll)`. {% capture notice_01 %} **WARNING**: @@ -49,66 +40,66 @@ If the library file needs to be built in a lower or higher version of Visual Stu ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/library_file/3.png) -* Confirm that the Additional Include Directories path under the General C/C++ Configuration Properties tree is as follows: +- Confirm that the Additional Include Directories path under the General C/C++ Configuration Properties tree is as follows: `..\..\..\include\dynamixel_sdk` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/library_file/4.png) -* Right click on the project and select Build to build the library. +- Right click on the project and select Build to build the library. ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/library_file/5.png) -* The built library file will be saved to `[DynamixelSDK folder]/c/build/[winXX]/output/dxl_xYY_c.dll`. +- The built library file will be saved to `[DynamixelSDK folder]/c/build/[winXX]/output/dxl_xYY_c.dll`. -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) The DYNAMIXEL SDK sample code for C uses the library files (.dll for Windows) compiled from the C language source. By following the instructions above, The compiled .dll files are output to `[DynamixelSDK folder]/c/build/[winXX]/output/dxl_xYY_c.dll` after being built from the included source code. -* Run the .sln file located in the `[DynamixelSDK folder]/c/example/protocol2.0/read_write/win32` folder if you have a 32-bit platform OR the `[DynamixelSDK folder]/c/example/protocol2.0/read_write/win64` folder if you have a 64-bit platform. +- Run the .sln file located in the `[DynamixelSDK folder]/c/example/protocol2.0/read_write/win32` folder if you have a 32-bit platform OR the `[DynamixelSDK folder]/c/example/protocol2.0/read_write/win64` folder if you have a 64-bit platform. ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/1.png) -* Right click on the project and select Properties. +- Right click on the project and select Properties. ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/2.png) -* In the resulting Property Pages window, under Configuration Properties --> General, check that the directories and file extensions are set as follows: +- In the resulting Property Pages window, under Configuration Properties --> General, check that the directories and file extensions are set as follows: - * Output Directory: `$(SolutionDir)$(Configuration)\` - * Intermediate Directory: `$(Configuration)\` - * Target Extension: `.exe` - * Configuration Type: `Application (.exe)` + - Output Directory: `$(SolutionDir)$(Configuration)\` + - Intermediate Directory: `$(Configuration)\` + - Target Extension: `.exe` + - Configuration Type: `Application (.exe)` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/3.png) -* Under Configuration Properties --> Debugging add the following path to your Environment: +- Under Configuration Properties --> Debugging add the following path to your Environment: - win32: `PATH=%PATH%;..\..\..\..\..\build\win32\output;` - win64: `PATH=%PATH%;..\..\..\..\..\build\win64\output;` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/4.png) -* Under Configuration Properties --> VC++ Directories, add the following path to Library Directories: +- Under Configuration Properties --> VC++ Directories, add the following path to Library Directories: - win32: `..\..\..\..\..\build\win32\output;` - win64: `..\..\..\..\..\build\win64\output;` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/5.png) -* Under Configuration Properties --> C/C++ --> General, add the following path to Additional Include Directories: +- Under Configuration Properties --> C/C++ --> General, add the following path to Additional Include Directories: `..\..\..\..\..\include\dynamixel_sdk` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/6.png) -* Under Configuration Properties --> Linker --> Input, add the following file to Additional Dependencies: +- Under Configuration Properties --> Linker --> Input, add the following file to Additional Dependencies: - win32: `dxl_x86_c.lib;` - win64: `dxl_x64_c.lib;` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/7.png) -* Click on the Local Windows Debugger button to run the program. +- Click on the Local Windows Debugger button to run the program. ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/windows/sample_code/8.png) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux.md b/_includes/en/software/dynamixel_sdk/library_setup/cpp_linux.md similarity index 85% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux.md rename to _includes/en/software/dynamixel_sdk/library_setup/cpp_linux.md index 21dad9db5..4b33cc468 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/cpp_linux.md @@ -1,20 +1,7 @@ ---- -layout: archive -lang: en -ref: cpp_linux -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - {::options parse_block_html="true" /}
-

Library Setup

+

Library Setup <C++ Linux>

-
+ -## [CPP macOS](#cpp-macos) +{::options parse_block_html="true" /} + +
+

Library Setup <C++ macOS>

+
+ {% include en/maintenance_is_in_progress.md %} diff --git a/_includes/en/software/dynamixel_sdk/library_setup/cpp_windows.md b/_includes/en/software/dynamixel_sdk/library_setup/cpp_windows.md new file mode 100644 index 000000000..39902481e --- /dev/null +++ b/_includes/en/software/dynamixel_sdk/library_setup/cpp_windows.md @@ -0,0 +1,68 @@ +{::options parse_block_html="true" /} + +
+

Library Setup <C++ Windows>

+
+ + +This section provides instructions on building the SDK. + +# [Install requirements](#install-requirements) +- In this section, we used visual studio as the IDE for building the SDK. + + [Download Visual Studio Community for Windows Desktop](https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio.png) + +# [Build the SDK](#build-the-SDK) +**NOTE**: This instruction assumes a 64-bit Windows system. If you are using 32-bit Windows, simply follow the same steps using the 32-bit version instead. +{: .notice} +- Open the project solution file (`dxl_x64_cpp.sln`) located in the `[DynamixelSDK folder]/c++/build/win64` directory. + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio1.png) + +- If below dialog appears, select `OK`. This will adjust the toolset settings depending on your version of Visual Studio and Windows. + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/upgradetoolset.png) + + +- In the Solution Explorer on the right side, right-click the dxl_x64_cpp solution and select Build. + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildprocess.png) + +
+ +- **The SDK build is complete.** +- **If the build was successful, the compiled library file will be saved at :** `[DynamixelSDK folder]/c++/build/[win64]/output/dxl_x64_cpp.dll` + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildoutput.png) + +
+ +![](/assets/images/icon_unfold.png) **Check Build Properties** + + +- You can check or change the build properties through right-clicking on the project in the Solution Explorer and selecting Properties. + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties1.png) + +- Build properties is shown as below + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties2.png) + - Output Directory: `$(SolutionDir)output\` + - Intermediate Directory: `$(Configuration)\` + - Platform Toolset: `Visual Studio 20XX (v000)` + - Configuration Type: `Dynamic Library (.dll)` + + ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties3.png) + - Additional Include Directories: `..\..\..\include\dynamixel_sdk` +
+ +{% capture notice_01 %} +**WARNING**: +If the library file needs to be built in a lower or higher version of Visual Studio, change the `Platform Toolset` into the needed value. (ex: To use the DynamixelSDK c ver. library file in the MATLAB 2010 or LabVIEW 2010, the `Platform Toolset` should be changed to `Visual Studio 2009` lower.) +{% endcapture %} +
{{ notice_01 | markdownify }}
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_windows.md b/_includes/en/software/dynamixel_sdk/library_setup/csharp_windows.md similarity index 66% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_windows.md rename to _includes/en/software/dynamixel_sdk/library_setup/csharp_windows.md index 10a6272fa..9903d37ce 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_windows.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/csharp_windows.md @@ -1,40 +1,29 @@ ---- -layout: archive -lang: en -ref: csharp_windows -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_windows/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [CSharp Windows](#csharp-windows) +{::options parse_block_html="true" /} + +
+

Library Setup <CSharp Windows>

+
+ For C# source code is only provided for Windows. -### [Compiler and Builder](#compiler-and-builder) +# [Compiler and Builder](#compiler-and-builder) * [Download Visual Studio Community for Windows Desktop](https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/csharp/vs.png) -#### [Function References](#function-references) +# [Function References](#function-references) * The function reference file is located in `[DynamixelSDK folder]/c#/dynamixel_functions_csharp/[winXX]/dynamixel.cs` ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/csharp/windows/library_file/1.png) -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) The DYNAMIXEL SDK sample code for C# uses the library files (.dll for Windows) compiled from the C# language source. diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_linux.md b/_includes/en/software/dynamixel_sdk/library_setup/java_linux.md similarity index 84% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_linux.md rename to _includes/en/software/dynamixel_sdk/library_setup/java_linux.md index 26fd5cc1a..a80aa9a8a 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_linux.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/java_linux.md @@ -1,34 +1,25 @@ ---- -layout: archive -lang: en -ref: java_linux -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_linux/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [Java Linux](#java-linux) - -### [Compiler and Builder](#compiler-and-builder) +{::options parse_block_html="true" /} +
+

Library Setup <Java Linux>

+
+ + +# [Install requirements](#install-requirements) + + +## [Compiler and Builder](#compiler-and-builder) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/eclipse.png) * [Download the Eclipse IDE for Java (`Linux 32-bit` or `Linux 64-bit`)](http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/neonr) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/library_file/a1.png) -### [Required Packages](#required-packages) +## [Required Packages](#required-packages) * [Download Java Development Kit (JDK) (`Linux 32-bit` or `Linux 64-bit`)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) @@ -42,7 +33,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/library_file/b3.png) -### [Java Native Access(JNA)](#java-native-accessjna) +## [Java Native Access(JNA)](#java-native-accessjna) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/jna.jpg) @@ -54,7 +45,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/library_file/b5.png) -### [Function Reference](#function-reference) +# [Function Reference](#function-reference) * The function reference file is located in `[DynamixelSDK folder]/java/dynamixel_functions_java/x86 or x64/Dynamixel.java` @@ -64,13 +55,13 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/library_file/1.png) -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) The DYNAMIXEL SDK example code for Java uses the library files(.so for Linux) built in C language. Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so` which should be built by its own source code. -#### Make Java Project +## Make Java Project * Set workspace @@ -88,7 +79,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/sample_code/4.png) -#### Import function reference +## Import function reference * Click `Link Additional Source to Project` @@ -108,7 +99,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/sample_code/8.png) -#### Import DynamixelSDK library +## Import DynamixelSDK library * Click `Link Additional Source to Project` @@ -127,7 +118,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/sample_code/13.png) -#### Import JNA +## Import JNA * Go to Libraries on the screen. @@ -146,7 +137,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/linux/sample_code/17.png) -#### Run example +# Run example * Make the port be able to be used diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos.md b/_includes/en/software/dynamixel_sdk/library_setup/java_macos.md similarity index 100% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos.md rename to _includes/en/software/dynamixel_sdk/library_setup/java_macos.md diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos_dummy.md b/_includes/en/software/dynamixel_sdk/library_setup/java_macos_dummy.md similarity index 65% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos_dummy.md rename to _includes/en/software/dynamixel_sdk/library_setup/java_macos_dummy.md index 5965b43e1..5c3d45d6f 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos_dummy.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/java_macos_dummy.md @@ -1,25 +1,21 @@ ---- -layout: archive -lang: en -ref: java_macos -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
+{::options parse_block_html="true" /} + +
+

Library Setup <Java macOS>

+
+ + + -## [Java macOS](#java-macos) - {% include en/maintenance_is_in_progress.md %} - -## [Java Windows](#java-windows) - -### [Compiler and Builder](#compiler-and-builder) +{::options parse_block_html="true" /} + +
+

Library Setup <Java Windows>

+
+ + +# [Install requirements](#install-requirements) + +## [Compiler and Builder](#compiler-and-builder) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/eclipse.png) @@ -28,7 +19,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/library_file/a1.png) -### [Required Packages](#required-packages) +## [Required Packages](#required-packages) * [Download Java Development Kit (JDK) (`Windows 32-bit` or `Windows 64-bit`)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) @@ -42,7 +33,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/library_file/b3.png) -### [Java Native Access(JNA)](#java-native-accessjna) +## [Java Native Access(JNA)](#java-native-accessjna) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/jna.jpg) @@ -54,7 +45,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/library_file/b5.png) -## [Function Reference](#function-reference) +# [Function Reference](#function-reference) * The function reference file is located in `[DynamixelSDK folder]/java/dynamixel_functions_java/x86 or x64/Dynamixel.java` @@ -62,13 +53,13 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/library_file/1.png) -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) The DYNAMIXEL SDK example code for Java uses the library files(.dll for Windows) built in C language. Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/c/build/[winXX]/output/dxl_xYY_c.dll` which were built by its own source code. -#### Make Java Project +## Make Java Project * Set workspace @@ -86,7 +77,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/sample_code/5.png) -#### Import function reference +## Import function reference * Open `Configure Build Path` @@ -109,7 +100,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/sample_code/10.png) -##### Import DynamixelSDK library +## Import DynamixelSDK library * Click `Link Additional Source to Project` @@ -128,7 +119,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/sample_code/14.png) -#### Import JNA +## Import JNA * Go to `Libraries` tap and Click `Add External JARs`. @@ -142,7 +133,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/java/windows/sample_code/17.png) -#### Run example +# Run example * Put `ReadWrite.java` source into the folder `src` on the screen diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/labview_windows.md b/_includes/en/software/dynamixel_sdk/library_setup/labview_windows.md similarity index 83% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/labview_windows.md rename to _includes/en/software/dynamixel_sdk/library_setup/labview_windows.md index ab9751e7f..e6d8c246e 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/labview_windows.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/labview_windows.md @@ -1,26 +1,15 @@ ---- -layout: archive -lang: en -ref: labview_windows -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/labview_windows/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [LabVIEW Windows](#labview-windows) - -### [Compiler and Builder](#compiler-and-builder) +{::options parse_block_html="true" /} + +
+

Library Setup <LabVIEW Windows>

+
+ + +# [Compiler and Builder](#compiler-and-builder) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/labview/labview_logo.png) @@ -28,7 +17,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/labview/windows/library_file/a1.png) -### [Building the Library](#building-the-library) +# [Building the Library](#building-the-library) Note that if following procedure imports the DYNAMIXEL SDK c ver. 32bit library, the built library for LabVIEW only can be used by LabVIEW 32bit. Choose the platform target to either 32bit or 64bit, at first. @@ -86,7 +75,7 @@ Besides, when some error that are related with `.dll file version is higher than ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/labview/windows/library_file/b12.png) -### [Function Reference](#function-reference) +# [Function Reference](#function-reference) * The function reference file is located in `[DynamixelSDK folder]/labview/dxl_x86_c.lvlib/dxl_x86_c.lvlib` @@ -96,7 +85,7 @@ Besides, when some error that are related with `.dll file version is higher than ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/labview/windows/library_file/1.png) -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) DYNAMIXEL SDK example code for LabVIEW uses the library files(.dll for Windows) built in C language. diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_linux.md b/_includes/en/software/dynamixel_sdk/library_setup/matlab_linux.md similarity index 79% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_linux.md rename to _includes/en/software/dynamixel_sdk/library_setup/matlab_linux.md index e0f586f5b..a312b264c 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_linux.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/matlab_linux.md @@ -1,26 +1,15 @@ ---- -layout: archive -lang: en -ref: matlab_linux -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_linux/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [Matlab Linux](#matlab-linux) - -### [Compiler and Builder](#compiler-and-builder) +{::options parse_block_html="true" /} + +
+

Library Setup <Matlab Linux>

+
+ + +# [Compiler and Builder](#compiler-and-builder) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/matlab.png) @@ -30,7 +19,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/linux/library_file/a2.png) -### [Function Reference](#function-reference) +# [Function Reference](#function-reference) * The function reference file is located in `[DynamixelSDK folder]/matlab/m_basic_function/` @@ -40,13 +29,13 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/linux/library_file/1.png) -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) DYNAMIXEL SDK example code for Python uses the library files(.so for Linux) built in C language. Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so` which should be built by its own source code. -#### Import libraries +# Import libraries * Click `Set Path` @@ -70,7 +59,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/linux/sample_code/5.png) -#### Import function reference +# Import function reference * Click `Add with Subfolders...` @@ -85,7 +74,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/linux/sample_code/8.png) -#### Run example +# Run example * Make the port be able to be used diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos.md b/_includes/en/software/dynamixel_sdk/library_setup/matlab_macos.md similarity index 100% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos.md rename to _includes/en/software/dynamixel_sdk/library_setup/matlab_macos.md diff --git a/_includes/en/software/dynamixel_sdk/library_setup/matlab_macos_dummy.md b/_includes/en/software/dynamixel_sdk/library_setup/matlab_macos_dummy.md new file mode 100644 index 000000000..a4ba4ef21 --- /dev/null +++ b/_includes/en/software/dynamixel_sdk/library_setup/matlab_macos_dummy.md @@ -0,0 +1,24 @@ +{::options parse_block_html="true" /} + +
+

Library Setup <Matlab macOS>

+
+ + +{% include en/maintenance_is_in_progress.md %} + + diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_windows.md b/_includes/en/software/dynamixel_sdk/library_setup/matlab_windows.md similarity index 77% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_windows.md rename to _includes/en/software/dynamixel_sdk/library_setup/matlab_windows.md index 64644a15c..1d9287bd6 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_windows.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/matlab_windows.md @@ -1,26 +1,15 @@ ---- -layout: archive -lang: en -ref: matlab_windows -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_windows/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [Matlab Windows](#matlab-windows) - -### [Compiler and Builder](#compiler-and-builder) +{::options parse_block_html="true" /} + +
+

Library Setup <Matlab Windows>

+
+ + +# [Compiler and Builder](#compiler-and-builder) ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/matlab.png) @@ -30,7 +19,7 @@ sidebar: ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/windows/library_file/a2.png) -### [Function Reference](#function-reference) +# [Function Reference](#function-reference) {% capture notice_01 %} **WARNING**: When some error that are related with `.dll file version is higher than the MATLAB's version` is appeared, the `.dll` file should be rebuilt in lower version Visual Studio. @@ -47,13 +36,13 @@ When some error that are related with `.dll file version is higher than the MATL ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/windows/library_file/1.png) -### [Building and Running the Sample Code](#building-and-running-the-sample-code) +# [Building and Running the Sample Code](#building-and-running-the-sample-code) DYNAMIXEL SDK example code for MATLAB uses the library files(.dll for Windows) built in C language. Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/c/build/[winXX]/output/dxl_xYY_c.dll` which were built by its own source code. -#### Import libraries +# Import libraries * Click `Set Path` @@ -76,7 +65,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/windows/sample_code/5.png) -#### Import function reference +# Import function reference * Click `Add with Subfolders...` @@ -91,7 +80,7 @@ Each released DYNAMIXEL SDK have latest library files in `[DynamixelSDK folder]/ ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/matlab/windows/sample_code/8.png) -#### Run example +# Run example * Click `Browse for folder` diff --git a/_includes/en/software/dynamixel_sdk/library_setup/python_linux.md b/_includes/en/software/dynamixel_sdk/library_setup/python_linux.md new file mode 100644 index 000000000..632c974ab --- /dev/null +++ b/_includes/en/software/dynamixel_sdk/library_setup/python_linux.md @@ -0,0 +1,44 @@ +{::options parse_block_html="true" /} + +
+

Library Setup <Python Linux>

+
+ + +# [Install requirements](#install-requirements) + +- Install python3 and pip3. +```bash +$ sudo apt update +$ sudo apt install python3 python3-pip python3-serial +``` + +- You can also install in web browser using the following link: + [Download Python3 for Linux](https://www.python.org/downloads/) + +# [Build and Install the SDK](#build-and-install-the-SDK) + +- If you downloaded the SDK as source code, you should install it using pip3 (excluding those who installed via pip3 install). +```bash +$ cd DynamixelSDK/python +$ pip install . +``` + +- You can check whether pip recognizes the SDK by running the following command: +```bash +$ pip show dynamixel_sdk +Name: dynamixel-sdk +Version: *.*.* +Summary: UNKNOWN +Home-page: UNKNOWN +Author: +Author-email: +License: UNKNOWN +Location: location your sdk installed in # ex. /home/robotis/.local/lib/python3.10/site-packages OR /opt/ros/humble/local/lib/python3.10/dist-packages +Requires: +Required-by: +``` diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos.md b/_includes/en/software/dynamixel_sdk/library_setup/python_macos.md similarity index 100% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos.md rename to _includes/en/software/dynamixel_sdk/library_setup/python_macos.md diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos_dummy.md b/_includes/en/software/dynamixel_sdk/library_setup/python_macos_dummy.md similarity index 64% rename from docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos_dummy.md rename to _includes/en/software/dynamixel_sdk/library_setup/python_macos_dummy.md index 5cea2f526..e37703575 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos_dummy.md +++ b/_includes/en/software/dynamixel_sdk/library_setup/python_macos_dummy.md @@ -1,24 +1,20 @@ ---- -layout: archive -lang: en -ref: python_macos -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
+ -## [Python macOS](#python-macos) +{::options parse_block_html="true" /} + +
+

Library Setup <Python macOS>

+
+ {% include en/maintenance_is_in_progress.md %} diff --git a/_includes/en/software/dynamixel_sdk/library_setup/python_windows.md b/_includes/en/software/dynamixel_sdk/library_setup/python_windows.md new file mode 100644 index 000000000..f6623b8d6 --- /dev/null +++ b/_includes/en/software/dynamixel_sdk/library_setup/python_windows.md @@ -0,0 +1,38 @@ +{::options parse_block_html="true" /} + +
+

Library Setup <Python Windows>

+
+ + +# [Install requirements](#install-requirements) + +- [Install Python3 for WINDOWS](https://www.python.org/downloads/) + +# [Build and Install the SDK](#build-and-install-the-SDK) + +- Open the `{$Dynamixel_SDK}/python` folder. +- Right click on the folder and select `Open in terminal`. +- Build and install Dynamixel_SDK through below command. +```bash +$ pip install . +``` + +- You can check whether pip recognizes the SDK by running the following command: +```bash +$ pip show dynamixel_sdk +Name: dynamixel-sdk +Version: *.*.* +Summary: ~ +Home-page: ~ +Author: ~ +Author-email: ~ +License: ~ +Location: ~ +Requires: +Required-by: +``` diff --git a/assets/images/sw/dynamixel_easy_sdk/getting_started/hw_setup.jpg b/assets/images/sw/dynamixel_easy_sdk/getting_started/hw_setup.jpg new file mode 100644 index 000000000..b727b82ec Binary files /dev/null and b/assets/images/sw/dynamixel_easy_sdk/getting_started/hw_setup.jpg differ diff --git a/assets/images/sw/dynamixel_easy_sdk/getting_started/move_motor.gif b/assets/images/sw/dynamixel_easy_sdk/getting_started/move_motor.gif new file mode 100644 index 000000000..f015d75b8 Binary files /dev/null and b/assets/images/sw/dynamixel_easy_sdk/getting_started/move_motor.gif differ diff --git a/assets/images/sw/dynamixel_easy_sdk/getting_started/openrb_tutorial_kit.jpg b/assets/images/sw/dynamixel_easy_sdk/getting_started/openrb_tutorial_kit.jpg new file mode 100644 index 000000000..72ac35697 Binary files /dev/null and b/assets/images/sw/dynamixel_easy_sdk/getting_started/openrb_tutorial_kit.jpg differ diff --git a/assets/images/sw/dynamixel_easy_sdk/tutorials/dxl_step3.gif b/assets/images/sw/dynamixel_easy_sdk/tutorials/dxl_step3.gif new file mode 100644 index 000000000..0ff78a199 Binary files /dev/null and b/assets/images/sw/dynamixel_easy_sdk/tutorials/dxl_step3.gif differ diff --git a/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_group_control.gif b/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_group_control.gif new file mode 100644 index 000000000..ef315ad45 Binary files /dev/null and b/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_group_control.gif differ diff --git a/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_single_motor_control.gif b/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_single_motor_control.gif new file mode 100644 index 000000000..df543ab58 Binary files /dev/null and b/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_single_motor_control.gif differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildandrun.png b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildandrun.png new file mode 100755 index 000000000..47b2cb3ba Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildandrun.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties.png b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties.png new file mode 100755 index 000000000..fece1f219 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties2.png b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties2.png new file mode 100755 index 000000000..9d501f9f9 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties2.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/makeproject.png b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/makeproject.png new file mode 100644 index 000000000..4ab0e99a2 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/makeproject.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/runbutton.png b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/runbutton.png new file mode 100755 index 000000000..78a7ff15e Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/runbutton.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/vscodepython.png b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/vscodepython.png new file mode 100755 index 000000000..7610ff0ea Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/vscodepython.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/vs.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/vs.png deleted file mode 100644 index 93c44f4b0..000000000 Binary files a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/vs.png and /dev/null differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/1.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/1.png deleted file mode 100644 index e48c3b7de..000000000 Binary files a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/1.png and /dev/null differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/2.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/2.png deleted file mode 100644 index fba1cb44b..000000000 Binary files a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/2.png and /dev/null differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/3.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/3.png deleted file mode 100644 index 380f55320..000000000 Binary files a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/3.png and /dev/null differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/4.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/4.png deleted file mode 100644 index 5031c829d..000000000 Binary files a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/4.png and /dev/null differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/5.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/5.png deleted file mode 100644 index 72cbbe537..000000000 Binary files a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/5.png and /dev/null differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildoutput.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildoutput.png new file mode 100755 index 000000000..58fb0d7dc Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildoutput.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildprocess.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildprocess.png new file mode 100755 index 000000000..463ea4cd2 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildprocess.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties1.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties1.png new file mode 100755 index 000000000..2db0c327c Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties1.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties2.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties2.png new file mode 100755 index 000000000..74c470f00 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties2.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties3.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties3.png new file mode 100755 index 000000000..2eda2ce44 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/buildproperties3.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/upgradetoolset.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/upgradetoolset.png new file mode 100755 index 000000000..26a38b4e6 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/upgradetoolset.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio.png new file mode 100755 index 000000000..7093dc195 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio.png differ diff --git a/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio1.png b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio1.png new file mode 100755 index 000000000..12f017a49 Binary files /dev/null and b/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/visualstudio1.png differ diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/api_reference.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/api_reference.md new file mode 100644 index 000000000..498645376 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/api_reference.md @@ -0,0 +1,190 @@ +--- +layout: archive +lang: en +ref: api_reference +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/api_reference/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Dynamixel Easy SDK Reference

+
+ + +- This section provides a reference for the main classes and methods available in the Dynamixel API. + - [Connector Class](#connector-class) + - [Motor Class](#motor-class) + - [Enum Class](#enum-class) + - [Group Executor](#group-executor) + - [Dynamixel Error](#dynamixel-error) + - [Result Class](#result-class) + - [DxlError Enum](#dxlerror-enum) + +# [Connector Class](#connector-class) + +**Connector Class** + +| Return Type | Method | Description | +| ----------------------------------- | -----------------------------------------------------------------------------------------| ----------------------------------------------------------------------| +| — | Connector(const std::string & port_name, int baud_rate) | Initializes the connector. | +| std::unique_ptr | createMotor(uint8_t id) | Returns a `Motor` instance for the specified ID. | +| std::vector> | createAllMotors(int start_id = 0, int end_id = 252) | Returns a vector of all `Motor` instances within the given ID range. | +| std::unique_ptr | createGroupExecutor() | Closes the communication port. | +| PortHandler * | getPortHandler() const | Returns the underlying PortHandler instance. | +| PacketHandler * | getPacketHandler() const | Returns the underlying PacketHandler instance. | + +# [Motor Class](#motor-class) + +**Motor Class** + +| Return Type | Method | Description | +| :-------------------------- | :----------------------------------------------------| :------------------------------------------------------------ | +| Result | enableTorque() | Enables the motor torque. | +| Result | disableTorque() | Disables the motor torque. | +| Result | setGoalPosition(uint32_t position) | Sets the target position for the motor. | +| Result | setGoalVelocity(uint32_t velocity) | Sets the target velocity for the motor. | +| Result | setGoalCurrent(int16_t current) | Sets the target current for the motor. | +| Result | setGoalPWM(int16_t pwm) | Sets the target PWM value for the motor. | +| Result | LEDOn() | Turns on the motor LED. | +| Result | LEDOff() | Turns off the motor LED. | +| Result | ping() | Pings the motor and returns its model number. | +| Result | isTorqueOn() | Returns whether the torque is currently enabled. | +| Result | isLEDOn() | Returns whether the LED is currently on. | +| Result | getPresentPosition() | Reads the current position of the motor. | +| Result | getPresentVelocity() | Reads the current velocity of the motor. | +| Result | getMaxPositionLimit() | Reads the maximum position limit from the motor. | +| Result | getMinPositionLimit() | Reads the minimum position limit from the motor. | +| Result | getVelocityLimit() | Reads the velocity limit of the motor. | +| Result | getCurrentLimit() | Reads the current limit of the motor. | +| Result | getPWMLimit() | Reads the PWM limit of the motor. | +| Result | changeID(uint8_t new_id) | Changes the motor ID to a new value. | +| Result | changeBaudRate(int new_baud_rate) | Changes the motor communication baud rate. | +| Result | setOperatingMode(OperatingMode mode) | Sets the motor to the specified operating mode. | +| Result | setProfileConfiguration(ProfileConfiguration config) | Configures the motor for time-based profile mode. | +| Result | setDirection(Direction direction) | Sets the motor rotation direction to the specified direction. | +| Result | setPositionPGain(uint16_t p_gain) | Sets the proportional gain for position control. | +| Result | setPositionIGain(uint16_t i_gain) | Sets the integral gain for position control. | +| Result | setPositionDGain(uint16_t d_gain) | Sets the derivative gain for position control. | +| Result | setVelocityPGain(uint16_t p_gain) | Sets the proportional gain for velocity control. | +| Result | setVelocityIGain(uint16_t i_gain) | Sets the integral gain for velocity control. | +| Result | setHomingOffset(int32_t offset) | Sets the homing offset for the motor. | +| Result | setMaxPositionLimit(uint32_t limit) | Sets the maximum position limit for the motor. | +| Result | setMinPositionLimit(uint32_t limit) | Sets the minimum position limit for the motor. | +| Result | setVelocityLimit(uint32_t limit) | Sets the velocity limit for the motor. | +| Result | setCurrentLimit(uint16_t limit) | Sets the current limit for the motor. | +| Result | setPWMLimit(uint16_t limit) | Sets the PWM limit for the motor. | +| Result | reboot() | Reboots the motor. | +| Result | factoryResetAll() | Resets the motor to factory defaults (all settings). | +| Result | factoryResetExceptID() | Resets all settings except the motor ID. | +| Result | factoryResetExceptIDAndBaudRate() | Resets all settings except ID and baud rate. | +| Result | stageEnableTorque() | Stages a command to enable torque for group execution. | +| Result | stageDisableTorque() | Stages a command to disable torque for group execution. | +| Result | stageSetGoalPosition(uint32_t position) | Stages a command to set the goal position for group execution.| +| Result | stageSetGoalVelocity(uint32_t velocity) | Stages a command to set the goal velocity for group execution.| +| Result | stageLEDOn() | Stages a command to turn on the LED for group execution. | +| Result | stageLEDOff() | Stages a command to turn off the LED for group execution. | +| Result | stageIsTorqueOn() | Stages a command to read the torque status for group execution.| +| Result | stageIsLEDOn() | Stages a command to read the LED status for group execution. | +| Result | stageGetPresentPosition() | Stages a command to read the present position for group execution.| +| Result | stageGetPresentVelocity() | Stages a command to read the present velocity for group execution.| +| uint8_t | getID() const | Returns the motor ID. | +| uint16_t | getModelNumber() const | Returns the motor model number. | +| std::string | getModelName() const | Returns the motor model name. | + +## [Enum Class](#enum-class) + +**Motor::OperatingMode** + +|Operating Mode|value| +|:-------------|:----| +|Position | 3 | +|Velocity | 1 | +|Current | 0 | + +**Motor::ProfileConfiguration** + +|Profile Configuration|value| +|:--------------------|:----| +|Time-based | 1 | +|Velocity-based | 0 | + +**Motor::Direction** + +|Direction|value| +|:--------|:----| +|NORMAL | 0 | +|REVERSE | 1 | + +# [Group Executor](#group-executor) + +**GroupExecutor Class** + +| Return Type | Method | Description | +| :--------------------------| :----------------------------------------------| :----------------------------------------------- | +| void | addCmd(StagedCommand cmd) | Adds a command to the group excutor. | +| void | addCmd(Result result) | Adds a command to the group excutor. | +| Result | executeWrite() | Executes the write operations staged in the list. It automatically determines whether to use Bulk or Sync Write based on the command list and sends the corresponding packet.| +| Result, DxlError>> | executeRead() | Executes the read operations staged in the list. It automatically determines whether to use Bulk or Sync Read based on the command list and sends the corresponding packet.| +| void | clearStagedWriteCommands() | Clears all staged write commands. | +| void | clearStagedReadCommands() | Clears all staged read commands. | +| std::vector | getStagedWriteCommands() | Returns the list of staged write commands. | +| std::vector | getStagedReadCommands() | Returns the list of staged read commands. | + +# [Dynamixel Error](#dynamixel-error) + +## [Result Class](#result-class) + +**Result Class** + +| Return Type | Function | Description | +| :--------------------------| :------------------------------------------| :----------------------------------------------- | +| T | value() const | Returns the contained value. | +| E | error() const | Returns the contained error. | +| bool | isSuccess() const | Returns true if the result is Success, false if Failure.| + +## [DxlError Enum](#dxlerror-enum) + +**DxlError Enum** + +| DxlError | Value |Description | +| :------------------------- | :---- |:----------------------------------------------- | +| SDK_COMM_SUCCESS | 0 |tx or rx packet communication success | +| SDK_COMM_PORT_BUSY | -1000 |Port is busy (in use) | +| SDK_COMM_TX_FAIL | -1001 |Failed transmit instruction packet | +| SDK_COMM_RX_FAIL | -1002 |Failed get status packet | +| SDK_COMM_TX_ERROR | -2000 |Incorrect instruction packet | +| SDK_COMM_RX_WAITING | -3000 |Now receiving status packet | +| SDK_COMM_RX_TIMEOUT | -3001 |There is no status packet | +| SDK_COMM_RX_CORRUPT | -3002 |Incorrect status packet | +| SDK_COMM_NOT_AVAILABLE | -9000 | | +| SDK_ERRNUM_RESULT_FAIL | 1 |Failed to process the instruction packet | +| SDK_ERRNUM_INSTRUCTION | 2 |Invalid instruction | +| SDK_ERRNUM_CRC | 3 |CRC error | +| SDK_ERRNUM_DATA_RANGE | 4 |Data out of range | +| SDK_ERRNUM_DATA_LENGTH | 5 |Invalid data length | +| SDK_ERRNUM_DATA_LIMIT | 6 |Data limit exceeded | +| SDK_ERRNUM_ACCESS | 7 |Access denied | +| API_FUNCTION_NOT_SUPPORTED | 11 |The Dynamixel API does not support this motor model| +| EASY_SDK_MOTOR_TORQUE_OFF | 12 |Motor torque is off | +| EASY_SDK_OPERATING_MODE_MISMATCH | 13 |Operating mode is mismatched | +| API_ADD_PARAM_FAIL | 21 |Failed to add parameter | +| API_COMMAND_IS_EMPTY | 22 |Command list is empty | +| API_DUPLICATE_ID | 23 |Duplicate ID in staged commands | +| API_FAIL_TO_GET_DATA | 24 |Failed to get data from motor | + +**Global Function** + +| Return Type | Function | Description | +| :--------------------------| :-------------------------------------------| :----------------------------------------------- | +| std::string | getErrorMessage(DxlError error) | Returns DxlError as a human-readable string. | diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/getting_started.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/getting_started.md new file mode 100644 index 000000000..1612b2936 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/getting_started.md @@ -0,0 +1,82 @@ +--- +layout: archive +lang: en +ref: getting_started +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/getting_started/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Getting Started DYNAMIXEL Easy SDK with OpenRB-150 tutorial Kit

+
+ +- In this chapter, you will use the **Dynamixel Easy SDK** with the **OpenRB-150 Tutorial Kit** to make the motor move. + + +# [Requirements](#requirements) +- OpenRB-150 Tutorial Kit [[US](https://www.robotis.us/openrb-150-starter-kit/)] [[KR](https://www.robotis.com/shop/item.php?it_id=902-0184-000)] +![](/assets/images/sw/dynamixel_easy_sdk/getting_started/openrb_tutorial_kit.jpg) + +# [Download and Build SDK](#download-and-build-sdk) +- Download the latest version of the Dynamixel Easy SDK from the [GitHub repository](https://github.com/ROBOTIS-GIT/DynamixelSDK.git) +```bash +git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git +``` +- Build the SDK by following the instructions below +```bash +cd DynamixelSDK/c++/build/linux64 +sudo make install +``` +- Successful output log: +```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 +``` + +# [Hardware Setup](#connect-openrb-150-tutorial-kit) +- Connect the OpenRB-150 to the Dynamixel using a TTL cable, and connect it to your computer using a USB-C cable. +![](/assets/images/sw/dynamixel_easy_sdk/getting_started/hw_setup.jpg) + +# [Move Motor to target position](#move-motor-to-targetposition) +- Create a new C++ source file named `move_motor.cpp` and open it in your favorite code editor. +```bash +touch move_motor.cpp +``` + +- Copy and paste the following code into the `move_motor.cpp` file. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + + int main(){ + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr motor1 = connector.createMotor(1); + int target_position = 2000; + motor1->enableTorque(); + motor1->setGoalPosition(target_position); +} +``` +- Build the `move_motor.cpp` file and execute the compiled binary. +```bash +g++ -o move_motor move_motor.cpp -ldxl_x64_cpp +./move_motor +``` +![](/assets/images/sw/dynamixel_easy_sdk/getting_started/move_motor.gif) diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial.md new file mode 100644 index 000000000..9c618cafb --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial.md @@ -0,0 +1,28 @@ +--- +layout: archive +lang: en +ref: group_motor_tutorial +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Dynamixel Easy SDK Group Motor Tutorials

+
+ + +- In this Chapter, we will guide you through the process of writing code using the Dynamixel Easy SDK. This tutorial assumes that you have already installed the SDK. + - [Step 5: Moving Multiple DYNAMIXELs Simultaneously](/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step5/#make-cpp-file) + - [Step 6: Read Data from Multiple DYNAMIXELs Simultaneously](/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step6/#make-cpp-file) + - [Step 7: Leader and Follower Example](/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step7/#make-cpp-file) diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step5.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step5.md new file mode 100644 index 000000000..fdbd26774 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step5.md @@ -0,0 +1,229 @@ +--- +layout: archive +lang: en +ref: group_motor_tutorial_step5 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step5/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 5: Simultaneous Control of Multiple DYNAMIXELs

+
+ + +- This tutorial shows you how to move multiple Dynamixels simultaneously using the Dynamixel Easy SDK. + +**NOTE**: This tutorial explains how to write code using the Dynamixel Easy SDK. It assumes that you have already installed the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step5.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr group_executor = connector.createGroupExecutor(); + std::unique_ptr motor1 = connector.createMotor(1); + std::unique_ptr motor2 = connector.createMotor(2); + + motor1->disableTorque(); + motor2->disableTorque(); + motor1->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + motor2->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + motor1->enableTorque(); + motor2->enableTorque(); + + int target_position = 500; + group_executor->addCmd(motor1->stageSetGoalPosition(target_position)); + group_executor->addCmd(motor2->stageSetGoalPosition(target_position)); + group_executor->executeWrite(); + group_executor->clearStagedWriteCommands(); +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object with port name, baud rate, and protocol version to manage the communication.(Only protocol 2.0 is supported) +```cpp + int main(){ + dynamixel::Connector connector("/dev/ttyACM0", 57600); +``` +- Create a `GroupExecutor` object using the `createGroupExecutor` method of the `Connector` class. +- This object is used to execute multiple commands simultaneously. +```cpp + std::unique_ptr group_executor = connector.createGroupExecutor(); +``` +- Create a `Motor` object for each Dynamixel servo you want to control, using the `createMotor` method of the `Connector` class. +- This method takes the motor ID as an argument and returns a unique pointer to a `Motor` instance. (shared_ptr is also available) +```cpp + std::unique_ptr motor1 = connector.createMotor(1); + std::unique_ptr motor2 = connector.createMotor(2); +``` +- This process throws a `DxlRuntimeError` if the object creation fails. + +## [Set Operating Mode to Position Control Mode](#set-operating-mode-to-position-control-mode) +- Use the methods provided by the `Motor` class to control the Dynamixel servo. +- Set the operating mode to position control mode. +```cpp + motor1->disableTorque(); + motor2->disableTorque(); + motor1->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + motor2->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + motor1->enableTorque(); + motor2->enableTorque(); +``` + +## [Move Motor to Goal Position](#move-motor-to-goal-position) +- Add commands to set the goal position of each motor using the `stageSetGoalPosition` method of the `Motor` class. +```cpp + int target_position = 500; + group_executor->addCmd(motor1->stageSetGoalPosition(target_position)); + group_executor->addCmd(motor2->stageSetGoalPosition(target_position)); +``` +- Execute all the staged commands simultaneously using the `execute` method of the `GroupExecutor` class. +```cpp + group_executor->executeWrite(); +``` +- This will send the commands to both motors at the same time, causing them to move to the specified goal position simultaneously. +- This method decides the communication packet type automatically between Sync and Bulk based on the staged commands. +- Clear the staged commands after execution using the `clearStagedWriteCommands` method of the `GroupExecutor` class. +```cpp + group_executor->clearStagedWriteCommands(); +``` + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates errors. +- This object lets you safely check for any communication or device errors before proceeding. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. + + **Example** + ``` cpp + auto result_void = group_executor->executeWrite(); // type of 'result_void' variable is Result + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + ``` + +- stage functions return **Result** type. +- You can either pass this value directly to the addCmd() function, or perform error checking first and then pass the resulting command value. + **Example** + ``` cpp + auto result_cmd = motor1->stageSetGoalPosition(target_position); // type of 'result_cmd' variable is Result + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ tutorial_step5.cpp -o tutorial_step5 -l dxl_x64_cpp +$ ./tutorial_step5 +``` + +# [Full Source Code With Error Handling](#full-source-code-with-error-handling) +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr group_executor = connector.createGroupExecutor(); + std::unique_ptr motor1 = connector.createMotor(1); + std::unique_ptr motor2 = connector.createMotor(2); + + auto result_void = motor1->disableTorque(); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + result_void = motor2->disableTorque(); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + result_void = motor1->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + result_void = motor2->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + result_void = motor1->enableTorque(); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + result_void = motor2->enableTorque(); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + int target_position = 500; + auto result_cmd = motor1->stageSetGoalPosition(target_position); + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + + result_cmd = motor2->stageSetGoalPosition(target_position); + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + + result_void = group_executor->executeWrite(); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + group_executor->clearStagedWriteCommands(); +} +``` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step6.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step6.md new file mode 100644 index 000000000..1db490c76 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step6.md @@ -0,0 +1,205 @@ +--- +layout: archive +lang: en +ref: group_motor_tutorial_step6 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step6/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 6: Simultaneous Reading of Multiple DYNAMIXELs

+
+ + +- This tutorial shows you how to read data from multiple Dynamixels simultaneously using the Dynamixel Easy SDK. + +**NOTE**: This tutorial explains how to write code using the Dynamixel Easy SDK. It assumes that you have already installed the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step6.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr group_executor = connector.createGroupExecutor(); + std::unique_ptr motor1 = connector.createMotor(1); + std::unique_ptr motor2 = connector.createMotor(2); + + group_executor->addCmd(motor1->stageGetPresentPosition()); + group_executor->addCmd(motor2->stageGetPresentPosition()); + auto result = group_executor->executeRead(); + group_executor->clearStagedReadCommands(); + + int motor1_position = result.value()[0].value(); + int motor2_position = result.value()[1].value(); + std::cout << "Motor1 Present Position: " << motor1_position << std::endl; + std::cout << "Motor2 Present Position: " << motor2_position << std::endl; +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object with port name, baud rate, and protocol version to manage the communication.(Only protocol 2.0 is supported) +```cpp + int main(){ + dynamixel::Connector connector("/dev/ttyACM0", 57600); +``` +- Create a `GroupExecutor` object using the `createGroupExecutor` method of the `Connector` class. +- This object is used to execute multiple commands simultaneously. +```cpp + std::unique_ptr group_executor = connector.createGroupExecutor(); +``` +- Create a `Motor` object for each Dynamixel servo you want to control, using the `createMotor` method of the `Connector` class. +- This method takes the motor ID as an argument and returns a unique pointer to a `Motor` instance. (shared_ptr is also available) +```cpp + std::unique_ptr motor1 = connector.createMotor(1); + std::unique_ptr motor2 = connector.createMotor(2); +``` +- This process throws a `DxlRuntimeError` if the object creation fails. + +## [Read Data from Multiple Motors Simultaneously](#read-data-from-multiple-motors-simultaneously) +- Add commands to read the present position of each motor using the `stageGetPresentPosition` method of the `Motor` class. +```cpp + group_executor->addCmd(motor1->stageGetPresentPosition()); + group_executor->addCmd(motor2->stageGetPresentPosition()); +``` +- Execute all the staged commands simultaneously using the `executeRead` method of the `GroupExecutor` class. +```cpp + auto result = group_executor->executeRead(); +``` +- Clear the staged read commands after execution using the `clearStagedReadCommands` method of the `GroupExecutor` class. +```cpp + group_executor->clearStagedReadCommands(); +``` + +- This will send the commands to both motors at the same time and read the present position of each motor. +- The return type of this method is `Result>, Error>`. +- You can get the actual position values using the `value()` method of the `Result` object. +```cpp + int motor1_position = result.value()[0].value(); + int motor2_position = result.value()[1].value(); + std::cout << "Motor1 Present Position: " << motor1_position << std::endl; + std::cout << "Motor2 Present Position: " << motor2_position << std::endl; +``` +- This method decides the communication packet type automatically between Sync and Bulk based on the staged commands. + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates errors. +- This object lets you safely check for any communication or device errors before proceeding. +- executeRead() method returns **Result>, Error>** type. So you need to check for errors twice. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. + + **Example** + ``` cpp + auto result = group_executor->executeRead(); // type of 'result_void' variable is Result + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + std::vector positions; + for (const auto& result : result.value()) { + if (!result.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result.error()) << std::endl; + return 1; + } + positions.push_back(result.value()); + } + ``` + +- stage functions return **Result** type. +- You can either pass this value directly to the addCmd() function, or perform error checking first and then pass the resulting command value. + **Example** + ``` cpp + auto result_cmd = motor1->stageGetPresentPosition(); // type of 'result_cmd' variable is Result + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ tutorial_step6.cpp -o tutorial_step6 -l dxl_x64_cpp +$ ./tutorial_step6 +``` + +# [Full Source Code With Error Handling](#full-source-code-with-error-handling) +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyUSB0", 57600); + std::unique_ptr group_executor = connector.createGroupExecutor(); + std::unique_ptr motor1 = connector.createMotor(1); + std::unique_ptr motor2 = connector.createMotor(2); + + auto result_cmd = motor1->stageGetPresentPosition(); + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + + result_cmd = motor2->stageGetPresentPosition(); + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + + auto result = group_executor->executeRead(); + if (!result.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result.error()) << std::endl; + return 1; + } + group_executor->clearStagedReadCommands(); + + std::vector positions; + for (const auto& result : result.value()) { + if (!result.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result.error()) << std::endl; + return 1; + } + positions.push_back(result.value()); + } + std::cout << "Motor1 Present Position: " << positions[0] << std::endl; + std::cout << "Motor2 Present Position: " << positions[1] << std::endl; +} +``` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step7.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step7.md new file mode 100644 index 000000000..ff2ef4627 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step7.md @@ -0,0 +1,233 @@ +--- +layout: archive +lang: en +ref: group_motor_tutorial_step7 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/group_motor_tutorial_step7/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 7: OMX Teleoperation Example

+
+ + +![](/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_group_control.gif) +- This tutorial shows you example that OMX teleoperates Dynamixel using the Dynamixel Easy SDK. +- Unlike single motor control, commands are executed all at once, allowing all motors to be controlled with a single packet. This enables a faster control cycle. +- With an OMX leader and follower, you can create your own teleoperation system in just a few lines of code. + +**NOTE**: This tutorial explains how to write code using the Dynamixel Easy SDK. It assumes that you have already installed the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step7.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector_leader("/dev/ttyACM1", 1000000); + dynamixel::Connector connector_follower("/dev/ttyACM0", 1000000); + std::unique_ptr group_executor_leader = connector_leader.createGroupExecutor(); + std::unique_ptr group_executor_follower = connector_follower.createGroupExecutor(); + + std::unique_ptr leader_motor1 = connector_leader.createMotor(1); + std::unique_ptr leader_motor2 = connector_leader.createMotor(2); + std::unique_ptr leader_motor3 = connector_leader.createMotor(3); + std::unique_ptr leader_motor4 = connector_leader.createMotor(4); + std::unique_ptr leader_motor5 = connector_leader.createMotor(5); + std::unique_ptr leader_motor_gripper = connector_leader.createMotor(6); + + std::unique_ptr follower_motor1 = connector_follower.createMotor(11); + std::unique_ptr follower_motor2 = connector_follower.createMotor(12); + std::unique_ptr follower_motor3 = connector_follower.createMotor(13); + std::unique_ptr follower_motor4 = connector_follower.createMotor(14); + std::unique_ptr follower_motor5 = connector_follower.createMotor(15); + std::unique_ptr follower_motor_gripper = connector_follower.createMotor(16); + + follower_motor1->enableTorque(); + follower_motor2->enableTorque(); + follower_motor3->enableTorque(); + follower_motor4->enableTorque(); + follower_motor5->enableTorque(); + follower_motor_gripper->enableTorque(); + + while(true){ + group_executor_leader->addCmd(leader_motor1->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor2->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor3->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor4->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor5->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor_gripper->stageGetPresentPosition()); + + auto result = group_executor_leader->executeRead(); + group_executor_leader->clearStagedReadCommands(); + int leader_motor1_position = result.value()[0].value(); + int leader_motor2_position = result.value()[1].value(); + int leader_motor3_position = result.value()[2].value(); + int leader_motor4_position = result.value()[3].value(); + int leader_motor5_position = result.value()[4].value(); + int leader_motor_gripper_position = result.value()[5].value(); + + group_executor_follower->addCmd(follower_motor1->stageSetGoalPosition(leader_motor1_position)); + group_executor_follower->addCmd(follower_motor2->stageSetGoalPosition(leader_motor2_position)); + group_executor_follower->addCmd(follower_motor3->stageSetGoalPosition(leader_motor3_position)); + group_executor_follower->addCmd(follower_motor4->stageSetGoalPosition(leader_motor4_position)); + group_executor_follower->addCmd(follower_motor5->stageSetGoalPosition(leader_motor5_position)); + group_executor_follower->addCmd(follower_motor_gripper->stageSetGoalPosition(leader_motor_gripper_position)); + auto result_void = group_executor_follower->executeWrite(); + group_executor_follower->clearStagedWriteCommands(); + } +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object. +- In OMX, two separate OpenRB adapters are used for the leader and follower motors, so create two `Connector` objects with different port names. +- On OMX, the default baud rate is 1,000,000. +- Port names may vary depending on your system configuration. +```cpp + int main(){ + dynamixel::Connector connector_leader("/dev/ttyACM1", 1000000); + dynamixel::Connector connector_follower("/dev/ttyACM0", 1000000); +``` +- Create each `GroupExecutor` objects using the `createGroupExecutor` method of the `Connector` class. +- This object is used to execute multiple commands simultaneously. +```cpp + std::unique_ptr group_executor_leader = connector_leader.createGroupExecutor(); + std::unique_ptr group_executor_follower = connector_follower.createGroupExecutor(); +``` +- Create a `Motor` objects for each Dynamixels, using the `createMotor` method of the `Connector` class. +- In OMX, the leader motors have IDs 1 to 6, and the follower motors have IDs 11 to 16. +```cpp + std::unique_ptr leader_motor1 = connector_leader.createMotor(1); + std::unique_ptr leader_motor2 = connector_leader.createMotor(2); + std::unique_ptr leader_motor3 = connector_leader.createMotor(3); + std::unique_ptr leader_motor4 = connector_leader.createMotor(4); + std::unique_ptr leader_motor5 = connector_leader.createMotor(5); + std::unique_ptr leader_motor_gripper = connector_leader.createMotor(6); + + std::unique_ptr follower_motor1 = connector_follower.createMotor(11); + std::unique_ptr follower_motor2 = connector_follower.createMotor(12); + std::unique_ptr follower_motor3 = connector_follower.createMotor(13); + std::unique_ptr follower_motor4 = connector_follower.createMotor(14); + std::unique_ptr follower_motor5 = connector_follower.createMotor(15); + std::unique_ptr follower_motor_gripper = connector_follower.createMotor(16); +``` + +## [Enable Follower Torque](#enable-follower-torque) +- Enable the torque of the follower motors for teleoperation. +```cpp + follower_motor1->enableTorque(); + follower_motor2->enableTorque(); + follower_motor3->enableTorque(); + follower_motor4->enableTorque(); + follower_motor5->enableTorque(); + follower_motor_gripper->enableTorque(); +``` + +## [Leader and Follower Control Loop](#leader-and-follower-control-loop) +- In a loop, read the present position of the leader motors simultaneously using the `stageGetPresentPosition` method and set the goal position of the follower motors simultaneously to the same value using the `stageSetGoalPosition` method. +```cpp + while(true){ + group_executor_leader->addCmd(leader_motor1->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor2->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor3->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor4->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor5->stageGetPresentPosition()); + group_executor_leader->addCmd(leader_motor_gripper->stageGetPresentPosition()); + + auto result = group_executor_leader->executeRead(); + group_executor_leader->clearStagedReadCommands(); + int leader_motor1_position = result.value()[0].value(); + int leader_motor2_position = result.value()[1].value(); + int leader_motor3_position = result.value()[2].value(); + int leader_motor4_position = result.value()[3].value(); + int leader_motor5_position = result.value()[4].value(); + int leader_motor_gripper_position = result.value()[5].value(); + + group_executor_follower->addCmd(follower_motor1->stageSetGoalPosition(leader_motor1_position)); + group_executor_follower->addCmd(follower_motor2->stageSetGoalPosition(leader_motor2_position)); + group_executor_follower->addCmd(follower_motor3->stageSetGoalPosition(leader_motor3_position)); + group_executor_follower->addCmd(follower_motor4->stageSetGoalPosition(leader_motor4_position)); + group_executor_follower->addCmd(follower_motor5->stageSetGoalPosition(leader_motor5_position)); + group_executor_follower->addCmd(follower_motor_gripper->stageSetGoalPosition(leader_motor_gripper_position)); + auto result_void = group_executor_follower->executeWrite(); + group_executor_follower->clearStagedWriteCommands(); + } +} +``` + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates errors. +- This object lets you safely check for any communication or device errors before proceeding. +- executeRead() method returns **Result>, Error>** type. So you need to check for errors twice. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. + + **Example** + ``` cpp + auto result = group_executor->executeRead(); // type of 'result_void' variable is Result + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + std::vector positions; + for (const auto& result : result.value()) { + if (!result.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result.error()) << std::endl; + return 1; + } + positions.push_back(result.value()); + } + ``` + +- stage functions return **Result** type. +- You can either pass this value directly to the addCmd() function, or perform error checking first and then pass the resulting command value. + **Example** + ``` cpp + auto result_cmd = motor1->stageGetPresentPosition(); // type of 'result_cmd' variable is Result + if (!result_cmd.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_cmd.error()) << std::endl; + return 1; + } + group_executor->addCmd(result_cmd.value()); + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ tutorial_step7.cpp -o tutorial_step7 -l dxl_x64_cpp +$ ./tutorial_step7 +``` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/introduction.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/introduction.md new file mode 100644 index 000000000..da011676c --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/introduction.md @@ -0,0 +1,47 @@ +--- +layout: archive +lang: en +ref: introduction +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/introduction/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Dynamixel Easy SDK Introduction

+
+ + + + +# [Overview](#overview) +- The **Dynamixel_Easy_SDK** is a library that wraps the low-level Dynamixel SDK in a **motor-object-oriented design**, making it easier for first-time users to work with Dynamixel. +- Its primary goal is to provide a more **intuitive** and **easier-to-use** interface for controlling Dynamixel motors. + +# [Features](#features) +**Object-Oriented Design**: + - Each Dynamixel motor is managed as a distinct Motor object. By mapping the physical motor to a software object on a 1:1 basis, users can intuitively control a specific motor. + +**Intuitive Abstraction**: + - The **Dynamixel Easy SDK** provides functions with clear and descriptive names, allowing users to control motors without needing to understand the underlying protocol. For example, calling `motor1.torque_enable()` directly conveys its purpose, making the **Dynamixel Easy SDK** easy to learn and use. + +**Automatic Model Recognition**: + - The **Dynamixel Easy SDK** can automatically detect the connected Dynamixel model and load its corresponding control table, eliminating the need for manual configuration and simplifying development. + +**Error Handling**: + - Instead of returning a raw int, the **Dynamixel Easy SDK** now uses a result object that encapsulates both communication errors and Dynamixel-specific errors. This allows developers to handle all error cases in a unified way, making error logging code more concise and improving readability. + +# [Supported Environments](#supported-environments) +- **Programming Languages**: `C++ (17 standard or later)` +- **Operating Systems**: `Linux 64-bit` +- **Protocols**: `2.0` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial.md new file mode 100644 index 000000000..4733e1d1b --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial.md @@ -0,0 +1,30 @@ +--- +layout: archive +lang: en +ref: single_motor_tutorial +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Dynamixel Easy SDK Single Motor Tutorials

+
+ + + +- In this Chapter, we will guide you through the process of writing code using the Dynamixel API. This tutorial assumes that you have already installed the SDK. + - [Step 1: Moving Dynamixel](/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step1/#make-cpp-file) + - [Step 2: Read Data from Dynamixel ](/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step2/#make-cpp-file) + - [Step 3: Leader and Follower](/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step3/#make-cpp-file) + - [Step 4: OMX Teleoperation](/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step4/#make-cpp-file) diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step1.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step1.md new file mode 100644 index 000000000..7a2f67167 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step1.md @@ -0,0 +1,153 @@ +--- +layout: archive +lang: en +ref: single_motor_tutorial_step1 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step1/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 1: Moving Dynamixel

+
+ + +- This tutorial shows you how to move a single Dynamixel using the Dynamixel Easy SDK. + +**NOTE**: It assumes that you have already installed and built the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step1.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr motor1 = connector.createMotor(1); + + motor1->disableTorque(); + motor1->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + motor1->enableTorque(); + + int target_position = 500; + motor1->setGoalPosition(target_position); +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object with port name, baud rate, and protocol version to manage the communication.(Only protocol 2.0 is supported) +```cpp + int main(){ + dynamixel::Connector connector("/dev/ttyACM0", 57600); +``` +- Create a `Motor` object for each Dynamixel servo you want to control, using the `createMotor` method of the `Connector` class. +- This method takes the motor ID as an argument and returns a unique pointer to a `Motor` instance. (shared_ptr is also available) +```cpp + std::unique_ptr motor1 = connector.createMotor(1); +``` +- This process throws a `DxlRuntimeError` if the object creation fails. + +## [Set Operating Mode to Position Control Mode](#set-operating-mode-to-position-control-mode) +- Use the methods provided by the `Motor` class to control the Dynamixel servo. +- Set the operating mode to position control mode. +```cpp + motor1->disableTorque(); + motor1->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + motor1->enableTorque(); +``` + +## [Move Motor to Goal Position](#move-motor-to-goal-position) +- Move the motor to the goal position that you want. +```cpp + int target_position = 500; + motor1->setGoalPosition(target_position); +``` + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates errors. +- This object lets you safely check for any communication or device errors before proceeding. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. + + **Example** + ``` cpp + auto result_void = motor1->disableTorque(); // type of 'result_void' variable is Result + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ tutorial_step1.cpp -o tutorial_step1 -l dxl_x64_cpp +$ ./tutorial_step1 +``` + +# [Full Source Code With Error Handling](#full-source-code-with-error-handling) +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + dynamixel::Connector connector("/dev/ttyUSB0", 57600); + std::unique_ptr motor1 = connector.createMotor(1); + + auto result_void = motor1->disableTorque(); // type of 'result_void' variable is Result + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + result_void = motor1->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + result_void = motor1->enableTorque(); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } + + int target_position = 500; + result_void = motor1->setGoalPosition(target_position); + if (!result_void.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_void.error()) << std::endl; + return 1; + } +} +``` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step2.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step2.md new file mode 100644 index 000000000..411bf9964 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step2.md @@ -0,0 +1,129 @@ +--- +layout: archive +lang: en +ref: single_motor_tutorial_step2 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step2/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 2: Read Data from DYNAMIXEL

+
+ + +- This tutorial shows you how to read data from a Dynamixel using the Dynamixel Easy SDK. + +**NOTE**: It assumes that you have already installed and built the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step2.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr motor1 = connector.createMotor(1); + + auto result_int32_t = motor1->getPresentPosition(); + int present_position = result_int32_t.value(); + std::cout << "Present Position: " << present_position << std::endl; +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object with port name, baud rate, and protocol version to manage the communication.(Only protocol 2.0 is supported) +```cpp + int main(){ + dynamixel::Connector connector("/dev/ttyACM0", 57600); +``` +- Create a `Motor` object for each Dynamixel servo you want to control, using the `createMotor` method of the `Connector` class. +- This method takes the motor ID as an argument and returns a unique pointer to a `Motor` instance. (shared_ptr is also available) +```cpp + std::unique_ptr motor1 = connector.createMotor(1); +``` +- This process throws a `DxlRuntimeError` if the object creation fails. + +## [Get Present Position](#get-present-position) +- You can read the present position of the motor using the `getPresentPosition` method. +- Return type of this method is `Result`. You can get the actual position value using the `value()` method of the `Result` object. +```cpp + auto result_int32_t = motor1->getPresentPosition(); + int present_position = result_int32_t.value(); + std::cout << "Present Position: " << present_position << std::endl; +``` + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates values and errors. +- This object lets you safely check for any communication or device errors before proceeding. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. +- If you use `value()` when error occurred without checking for errors, it may throw an exception. + + **Example** + ``` cpp + auto result_int32_t = motor1->getPresentPosition(); + if (!result_int32_t.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_int32_t.error()) << std::endl; + return 1; + } + int present_position = result_int32_t.value(); + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ tutorial_step2.cpp -o tutorial_step2 -l dxl_x64_cpp +$ ./tutorial_step2 +``` + +# [Full Source Code With Error Handling](#full-source-code-with-error-handling) +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + dynamixel::Connector connector("/dev/ttyUSB0", 2.0, 57600); + std::unique_ptr motor1 = connector.createMotor(1); + + auto result_int32_t = motor1->getPresentPosition(); + if (!result_int32_t.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_int32_t.error()) << std::endl; + return 1; + } + int present_position = result_int32_t.value(); + std::cout << "Present Position: " << present_position << std::endl; + } +} +``` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step3.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step3.md new file mode 100644 index 000000000..5ceb9ab55 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step3.md @@ -0,0 +1,183 @@ +--- +layout: archive +lang: en +ref: single_motor_tutorial_step3 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step3/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 3: Leader and Follower Example

+
+ + +![](/assets/images/sw/dynamixel_easy_sdk/tutorials/dxl_step3.gif) +- This tutorial shows you how to read data from one Dynamixel and write the read value to another Dynamixel using the Dynamixel Easy SDK. + +**NOTE**: It assumes that you have already installed and built the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step3.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + + dynamixel::Connector connector("/dev/ttyACM0", 57600); + std::unique_ptr leader_motor = connector.createMotor(1); + std::unique_ptr follower_motor = connector.createMotor(2); + int min_position = leader_motor->getMinPositionLimit().value() + 100; + int max_position = leader_motor->getMaxPositionLimit().value() - 100; + + leader_motor->disableTorque(); + follower_motor->disableTorque(); + follower_motor->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + follower_motor->enableTorque(); + + while (true) { + int present_position = leader_motor->getPresentPosition().value(); + std::cout << "Leader Motor Present Position: " << present_position << std::endl; + + if (present_position < min_position) { + leader_motor->enableTorque(); + leader_motor->setGoalPosition(min_position); + while(true){ + present_position = leader_motor->getPresentPosition().value(); + if(present_position >= min_position) break; + } + leader_motor->disableTorque(); + } else if (present_position > max_position) { + leader_motor->enableTorque(); + leader_motor->setGoalPosition(max_position); + while(true){ + present_position = leader_motor->getPresentPosition().value(); + if(present_position <= max_position) break; + } + leader_motor->disableTorque(); + } + follower_motor->setGoalPosition(present_position); + } +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object with port name, baud rate, and protocol version to manage the communication.(Only protocol 2.0 is supported) +```cpp + int main(){ + dynamixel::Connector connector("/dev/ttyACM0", 57600); +``` +- Create a `Motor` object for each Dynamixel servo you want to control, using the `createMotor` method of the `Connector` class. +- This method takes the motor ID as an argument and returns a unique pointer to a `Motor` instance. (shared_ptr is also available) +- Create motor objects while carefully distinguishing between the leader and follower IDs. +```cpp + std::unique_ptr leader_motor = connector.createMotor(1); + std::unique_ptr follower_motor = connector.createMotor(2); +``` +- This process throws a `DxlRuntimeError` if the object creation fails. + +## [Set Position Limits](#set-position-limits) +- Get the position limits of the leader motor using the `getMinPositionLimit` and `getMaxPositionLimit` methods. +```cpp + int min_position = leader_motor->getMinPositionLimit().value() + 100; + int max_position = leader_motor->getMaxPositionLimit().value() - 100; +``` + +## [Set Operating Mode to Position Control Mode](#set-operating-mode-to-position-control-mode) +- Use the methods provided by the `Motor` class to control the Dynamixel servo. +- Set the operating mode of follower motor to position control mode. +```cpp + leader_motor->disableTorque(); + follower_motor->disableTorque(); + follower_motor->setOperatingMode(dynamixel::Motor::OperatingMode::POSITION); + follower_motor->enableTorque(); +``` + +## [Leader and Follower Control Loop](#leader-and-follower-control-loop) +- In a loop, read the present position of the leader motor using the `getPresentPosition` method. +```cpp + while (true) { + int present_position = leader_motor->getPresentPosition().value(); + std::cout << "Leader Motor Present Position: " << present_position << std::endl; +``` +- If the leader motor's position exceeds the defined range, move it back within the range. +```cpp + if (present_position < min_position) { + leader_motor->enableTorque(); + leader_motor->setGoalPosition(min_position); + while(true){ + present_position = leader_motor->getPresentPosition().value(); + if(present_position >= min_position) break; + } + leader_motor->disableTorque(); + } else if (present_position > max_position) { + leader_motor->enableTorque(); + leader_motor->setGoalPosition(max_position); + while(true){ + present_position = leader_motor->getPresentPosition().value(); + if(present_position <= max_position) break; + } + leader_motor->disableTorque(); + } +``` +- Set the goal position of the follower motor to the present position of the leader motor. +```cpp + follower_motor->setGoalPosition(present_position); + } + } +``` + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates values and errors. +- This object lets you safely check for any communication or device errors before proceeding. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. +- If you use `value()` when error occurred without checking for errors, it may throw an exception. + + **Example** + ``` cpp + auto result_uint32 = leader_motor->getMinPositionLimit(); + if (!result_uint32.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_uint32.error()) << std::endl; + return 1; + } + int min_position = result_uint32.value(); + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ tutorial_step3.cpp -o tutorial_step3 -l dxl_x64_cpp +$ ./tutorial_step3 +``` diff --git a/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step4.md b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step4.md new file mode 100644 index 000000000..6a3cd677e --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step4.md @@ -0,0 +1,182 @@ +--- +layout: archive +lang: en +ref: single_motor_tutorial_step4 +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_easy_sdk/single_motor_tutorial_step4/ +sidebar: + title: DYNAMIXEL Easy SDK + nav: "dynamixel_easy_sdk" +--- + +{::options parse_block_html="true" /} + +
+

Step 4: OMX Teleoperation Example

+
+ + +![](/assets/images/sw/dynamixel_easy_sdk/tutorials/omx_teleoperation_single_motor_control.gif) +- This tutorial shows an example of OMX teleoperation using the Dynamixel Easy SDK. +- With an OMX leader and follower, you can create your own teleoperation system in just a few lines of code. + +**NOTE**: It assumes that you have already installed and built the SDK. +{:.notice--warning} + +# [Make cpp file](#make-cpp-file) +- Create a new C++ source file Open it with your editor. +```bash +$ touch tutorial_step4.cpp +``` + +# [Check the Port Names](#check-the-port-names) +- Before running the code, check the port name of the connected Dynamixel. +- For General + - OpenRB-150: `ttyACM0: USB ACM device` + - U2D2: `FTDI USB Serial Device converter now attached to ttyUSB0` +```bash +$ sudo dmesg | grep tty +``` + +# [Source Code Description](#source-code-description) + +```cpp +#include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" + +int main(){ + dynamixel::Connector connector_leader("/dev/ttyACM1", 1000000); + dynamixel::Connector connector_follower("/dev/ttyACM0", 1000000); + + std::unique_ptr leader_motor1 = connector_leader.createMotor(1); + std::unique_ptr leader_motor2 = connector_leader.createMotor(2); + std::unique_ptr leader_motor3 = connector_leader.createMotor(3); + std::unique_ptr leader_motor4 = connector_leader.createMotor(4); + std::unique_ptr leader_motor5 = connector_leader.createMotor(5); + std::unique_ptr leader_motor_gripper = connector_leader.createMotor(6); + + std::unique_ptr follower_motor1 = connector_follower.createMotor(11); + std::unique_ptr follower_motor2 = connector_follower.createMotor(12); + std::unique_ptr follower_motor3 = connector_follower.createMotor(13); + std::unique_ptr follower_motor4 = connector_follower.createMotor(14); + std::unique_ptr follower_motor5 = connector_follower.createMotor(15); + std::unique_ptr follower_motor_gripper = connector_follower.createMotor(16); + + follower_motor1->enableTorque(); + follower_motor2->enableTorque(); + follower_motor3->enableTorque(); + follower_motor4->enableTorque(); + follower_motor5->enableTorque(); + follower_motor_gripper->enableTorque(); + + while (true) { + int present_position1 = leader_motor1->getPresentPosition().value(); + int present_position2 = leader_motor2->getPresentPosition().value(); + int present_position3 = leader_motor3->getPresentPosition().value(); + int present_position4 = leader_motor4->getPresentPosition().value(); + int present_position5 = leader_motor5->getPresentPosition().value(); + int present_position_gripper = leader_motor_gripper->getPresentPosition().value(); + + follower_motor1->setGoalPosition(present_position1); + follower_motor2->setGoalPosition(present_position2); + follower_motor3->setGoalPosition(present_position3); + follower_motor4->setGoalPosition(present_position4); + follower_motor5->setGoalPosition(present_position5); + follower_motor_gripper->setGoalPosition(present_position_gripper); + } +} +``` + +## [Add Header Files](#add-header-files) +- Add `dynamixel_easy_sdk/dynamixel_easy_sdk.hpp` to the top of your CPP file. This class is included in the Dynamixel SDK package. +```cpp + #include "dynamixel_easy_sdk/dynamixel_easy_sdk.hpp" +``` + +## [Create Connector and Motor Object](#create-connector-and-motor-object) +- Create a `Connector` object. +- In OMX, two separate OpenRB adapters are used for the leader and follower motors, so create two `Connector` objects with different port names. +- On OMX, the default baud rate is 1,000,000. +- Port names may vary depending on your system configuration. +```cpp + int main(){ + dynamixel::Connector connector_leader("/dev/ttyACM1", 1000000); + dynamixel::Connector connector_follower("/dev/ttyACM0", 1000000); +``` +- Create a `Motor` objects for each Dynamixels, using the `createMotor` method of the `Connector` class. +- In OMX, the leader motors have IDs 1 to 6, and the follower motors have IDs 11 to 16. +```cpp + std::unique_ptr leader_motor1 = connector_leader.createMotor(1); + std::unique_ptr leader_motor2 = connector_leader.createMotor(2); + std::unique_ptr leader_motor3 = connector_leader.createMotor(3); + std::unique_ptr leader_motor4 = connector_leader.createMotor(4); + std::unique_ptr leader_motor5 = connector_leader.createMotor(5); + std::unique_ptr leader_motor_gripper = connector_leader.createMotor(6); + + std::unique_ptr follower_motor1 = connector_follower.createMotor(11); + std::unique_ptr follower_motor2 = connector_follower.createMotor(12); + std::unique_ptr follower_motor3 = connector_follower.createMotor(13); + std::unique_ptr follower_motor4 = connector_follower.createMotor(14); + std::unique_ptr follower_motor5 = connector_follower.createMotor(15); + std::unique_ptr follower_motor_gripper = connector_follower.createMotor(16); +``` + +## [Enable Follower Torque](#enable-follower-torque) +- Enable the torque of the follower motors for teleoperation. +```cpp + follower_motor1->enableTorque(); + follower_motor2->enableTorque(); + follower_motor3->enableTorque(); + follower_motor4->enableTorque(); + follower_motor5->enableTorque(); + follower_motor_gripper->enableTorque(); +``` + +## [Leader and Follower Control Loop](#leader-and-follower-control-loop) +- In a loop, read the present position of the leader motors using the `getPresentPosition` method and set the goal position of the follower motors to the same value using the `setGoalPosition` method. +```cpp + while (true) { + int present_position1 = leader_motor1->getPresentPosition().value(); + int present_position2 = leader_motor2->getPresentPosition().value(); + int present_position3 = leader_motor3->getPresentPosition().value(); + int present_position4 = leader_motor4->getPresentPosition().value(); + int present_position5 = leader_motor5->getPresentPosition().value(); + int present_position_gripper = leader_motor_gripper->getPresentPosition().value(); + + follower_motor1->setGoalPosition(present_position1); + follower_motor2->setGoalPosition(present_position2); + follower_motor3->setGoalPosition(present_position3); + follower_motor4->setGoalPosition(present_position4); + follower_motor5->setGoalPosition(present_position5); + follower_motor_gripper->setGoalPosition(present_position_gripper); + } + } +``` + +# [Error Handling](#error-handling) +- To ensure your code is robust, every method that sends a command to the motor returns a **Result** object that encapsulates values and errors. +- This object lets you safely check for any communication or device errors before proceeding. +- You can check for communication errors and device(dynamixel) errors using the **Result** object. +- If you use `value()` when error occurred without checking for errors, it may throw an exception. + + **Example** + ``` cpp + auto result_int32 = leader_motor->getPresentPosition(); + if (!result_int32.isSuccess()) { + std::cerr << dynamixel::getErrorMessage(result_int32.error()) << std::endl; + return 1; + } + int present_position = result_int32.value(); + ``` + +# [Compile and Run](#compile-and-run) +- You can compile and run the code using the following commands +```bash +$ g++ dxl_tutorial_4.cpp -o dxl_tutorial_4 -l dxl_x64_cpp +$ ./dxl_tutorial_4 +``` diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkread.md index a09995e16..3e0d318e2 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkwrite.md index 96c238055..11c6f678d 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncread.md index 44cc90755..51d34aae5 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncwrite.md index f4ddc49b1..5d52c82fa 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_packethandler.md index fce7c4e71..20ad61292 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_porthandler.md index 3eb083e84..5d848a9fb 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - + # [API Reference](#api-reference) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkread.md index 674bc230f..bd65a4f15 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkwrite.md index 140e7b983..55d210f67 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncread.md index efcc56ee4..fba39640b 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncwrite.md index b754e6cab..8ac74d1d6 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_packethandler.md index 4e75194ae..794af5399 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_porthandler.md index 041167e40..f14c3bc36 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/cpp/cpp_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkread.md index ac462af06..c590f9c94 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkwrite.md index 1dfcbe8b5..eb14a3c5f 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncread.md index 800869e8e..f7c31e5a6 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncwrite.md index 54d4a02d5..ca7df940d 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_packethandler.md index 150857671..c25c76869 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_porthandler.md index 12b075548..47bf3ace7 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/csharp/csharp_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkread.md index 5673e3984..0294a4780 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkwrite.md index 333aec4b9..72b1245e2 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncread.md index 66fa730f4..9dd103627 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncwrite.md index f1a1fa513..5b278e968 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_packethandler.md index 8b33f0bd3..15ea77d7e 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_porthandler.md index f4886c3c0..0926ad6c5 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/java/java_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkread.md index cda56f832..52a006cba 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkwrite.md index f96ccce28..836d48932 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncread.md index 46fe5a37d..b0dc8273b 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncwrite.md index c2cc1bf1a..b9caf2b37 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_packethandler.md index 3d5f50df8..1da5e6735 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_porthandler.md index 1e21232f9..5ea30a7e7 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/labview/labview_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkread.md index 2070c87a7..e1a8d70c6 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkwrite.md index ca0837782..e1e9424a2 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncread.md index 5aad264f2..4e78ca335 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncwrite.md index 157fae7b5..67da3937f 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_packethandler.md index 865217ff7..e36adff49 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_porthandler.md index cc3298d6d..241ac947a 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/matlab/matlab_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkread.md index e11795ed1..1266a54f5 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkwrite.md index 528f35f45..f805bd32c 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupbulkwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncread.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncread.md index fea547108..fb034a629 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncread.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncread.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncwrite.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncwrite.md index 19139e245..a20cc3eca 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncwrite.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_groupsyncwrite.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_packethandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_packethandler.md index 910ac55ac..05a491ac6 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_packethandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_packethandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_porthandler.md b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_porthandler.md index 30c640110..bac7df6c3 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_porthandler.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/api_reference/python/python_porthandler.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_cpp.md b/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_cpp.md index 068dcce76..f387cc700 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_cpp.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_cpp.md @@ -6,6 +6,9 @@ read_time: true share: true author_profile: false permalink: /docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_cpp/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows sidebar: title: DYNAMIXEL SDK nav: "dynamixel_sdk" @@ -27,34 +30,57 @@ This section provides examples of how to write code in C++ to read and write dat **NOTE**: This tutorial is based on **XL-430-W250** DYNAMIXEL motors and uses **Protocol 2.0**. {: .notice--warning} -# [Read/Write Example](#read-write-example) +# [Make cpp file](#make-cpp-file) + +
-## [Make cpp file](#make-cpp-file) - Create a CPP file and open it in a text editor. In this case, we use visual studio code, but you can use any text editor you prefer. ```bash $ mkdir -p my_dxl_project/src $ cd my_dxl_project/src $ code my_read_write.cpp ``` +
+ +
+ +- Open Visual Studio and create a new project as a Console Application. + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/makeproject.png) + +
-## [Source Code](#source-code) +# [Source Code Description](#source-code-description) -### [Add Header Files](#add-header-files) +## [Add Header Files](#add-header-files) - Add `dynamixel_sdk/dynamixel_sdk.h` to the top of your CPP file. This header file includes all necessary functions and classes from the DYNAMIXEL SDK. ```cpp #include "dynamixel_sdk/dynamixel_sdk.h" #include ``` -### [Initialize Handler Objects](#make-objects) +## [Initialize Handler Objects](#make-objects) + +
+ - Make main function and initialize the `PortHandler` and `PacketHandler`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `/dev/ttyUSB0` as the port name and `2.0` as the protocol version. ```cpp int main(){ dynamixel::PortHandler *portHandler = dynamixel::PortHandler::getPortHandler("/dev/ttyUSB0"); // your dxl port name dynamixel::PacketHandler *packetHandler = dynamixel::PacketHandler::getPacketHandler(2.0); //protocol version ``` +
+ +
-### [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) +- Make main function and initialize the `PortHandler` and `PacketHandler`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `COM3` as the port name and `2.0` as the protocol version. +```cpp + int main(){ + dynamixel::PortHandler *portHandler = dynamixel::PortHandler::getPortHandler("COM3"); // your dxl port name + dynamixel::PacketHandler *packetHandler = dynamixel::PacketHandler::getPacketHandler(2.0); //protocol version +``` +
+ +## [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) - Open the port and set the baud rate. The example below uses `57600` as the baud rate. ```cpp portHandler->openPort(); @@ -83,7 +109,7 @@ $ code my_read_write.cpp ``` -### [Write data to enable torque](#write-data-to-enable-torque) +## [Write data to enable torque](#write-data-to-enable-torque) - Turn on the torque of the DYNAMIXEL. ```cpp uint8_t dxl_id = 1; @@ -119,7 +145,7 @@ The `dxl_comm_result`, `dxl_error` variable should be declared beforehand. ``` -### [Get User Input](#get-user-input-and-write-data) +## [Get User Input](#get-user-input-and-write-data) - Get user input for the target position. ```cpp int target_position; @@ -134,7 +160,7 @@ The `dxl_comm_result`, `dxl_error` variable should be declared beforehand. } ``` -### [Write data to set target position](#write-data-to-set-target-position) +## [Write data to set target position](#write-data-to-set-target-position) - Write the target position to the DYNAMIXEL. ```cpp uint16_t goal_position_address = 116; @@ -162,7 +188,7 @@ The `dxl_comm_result`, `dxl_error` variable should be declared beforehand. ``` -### [Read data from DYNAMIXEL](#read-data-from-dynamixel) +## [Read data from DYNAMIXEL](#read-data-from-dynamixel) - Read the current position from the DYNAMIXEL. ```cpp uint16_t present_position_address = 132; @@ -170,7 +196,7 @@ The `dxl_comm_result`, `dxl_error` variable should be declared beforehand. do { packetHandler->read4ByteTxRx(portHandler, dxl_id, present_position_address, &present_position); std::cout << "Current Position: " << present_position << std::endl; - } while (abs(target_position - present_position) > 10); + } while (abs(static_cast(target_position - present_position)) > 10); } ```
@@ -205,18 +231,45 @@ The `dxl_comm_result`, `dxl_error` variable should be declared beforehand. } ``` -## [Compile and Run](#compile-and-run) +# [Compile and Run](#compile-and-run) + +
+ - Compile the code using g++. ```bash $ g++ my_read_write.cpp -o my_read_write -ldxl_x64_cpp $ ./my_read_write ``` +
-- You will see the following output if the build is successful. -```bash -``` +
+ +- Set build properties. + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties.png) + - `C/C++ → Additional Include Directories` : `{$Dynamixel_SDK_PATH\c++\include}` + - `Debugging → Environment` : `PATH=%PATH%;{$Dynamixel_SDK_PATH\c++\build\win64\output}` (if you use 32bit architecture, use `{$Dynamixel_SDK_PATH\c++\build\win32\output}`) + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties2.png) + - `Linker` → `Additional Library Directories` : `{$Dynamixel_SDK_PATH\c++\build\win64\output}` (if you use 32bit architecture, use `{$Dynamixel_SDK_PATH\c++\build\win32\output}`) + - `Linker` → `Input` → `Additional Dependencies` : `dxl_x64_cpp.lib` + +
+ +- **Build properties setup is complete. You can now build and run the project.** + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildandrun.png) +- **After building, you can find the executable file( .exe ) in the output directory :** `{$YOUR_SLN_DIR\x64\}` + + +**WARNING**: If you execute the .exe file directly(not through the IDE), you might encounter a `missing DLL` error. To fix this, ensure that `dxl_x64_cpp.dll` is either in your system PATH or in the same directory as the application. +{: .notice--warning} +
# [Full Source Code](#full-source-code) + +
+ ```cpp #include "dynamixel_sdk/dynamixel_sdk.h" #include @@ -282,7 +335,86 @@ int main(){ std::cout << packetHandler->getRxPacketError(dxl_error) << std::endl; } std::cout << "Current Position: " << present_position << std::endl; - } while (abs(target_position - present_position) > 10); + } while (abs(static_cast(target_position - present_position)) > 10); + } + + data = 0; + packetHandler->write1ByteTxRx(portHandler, dxl_id, 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); + 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_id = 1; + uint16_t torque_on_address = 64; + uint8_t data = 1; + uint8_t dxl_error = 0; + int dxl_comm_result = COMM_TX_FAIL; + + dxl_comm_result = packetHandler->write1ByteTxRx(portHandler, dxl_id, 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"; + } + + int target_position; + while(true){ + std::cout << "Enter target position (0 ~ 4095): "; + std::cin >> target_position; + if(target_position == -1){ + break; // Exit on -1 input + } else if(target_position < 0 || target_position > 4095){ + std::cout << "Position must be between 0 and 4095." << std::endl; + continue; + } + + uint16_t goal_position_address = 116; + dxl_comm_result = packetHandler->write4ByteTxRx(portHandler, dxl_id, goal_position_address, uint32_t(target_position), &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; + } + + uint16_t present_position_address = 132; + uint32_t present_position; + do { + dxl_comm_result = packetHandler->read4ByteTxRx(portHandler, dxl_id, present_position_address, &present_position, &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; + } + std::cout << "Current Position: " << present_position << std::endl; + } while (abs(static_cast(target_position - present_position)) > 10); } data = 0; @@ -292,3 +424,4 @@ int main(){ return 0; } ``` +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_python.md b/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_python.md index 3f903b605..c5633438c 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_python.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_python.md @@ -6,6 +6,9 @@ read_time: true share: true author_profile: false permalink: /docs/en/software/dynamixel/dynamixel_sdk/basic_read_write_tutorial/basic_read_write_tutorial_python/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows sidebar: title: DYNAMIXEL SDK nav: "dynamixel_sdk" @@ -27,19 +30,28 @@ This section provides examples of how to write code in Python to read and write **NOTE**: This tutorial is based on **XL-430-W250** DYNAMIXEL motors and uses **Protocol 2.0**. {: .notice--warning} -# [Read/Write Example](#read-write-example) +
-## [Make python file](#make-python-file) +# [Make python file](#make-python-file) - Create a python file and open it in a text editor. In this case, we use visual studio code, but you can use any text editor you prefer. ```bash $ mkdir -p my_dxl_project/python $ cd my_dxl_project/python $ code my_read_write.py ``` +
-## [Source Code](#source-code) +
-### [Add Header Files](#add-header-files) +# [Make python file](#make-python-file) +- Open the Visual Studio Code and create a python file in your workspace. + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/vscodepython.png) +
+ +# [Source Code Description](#source-code-description) + +## [Add Header Files](#add-header-files) - Add `#!/usr/bin/env python3` and import `dynamixel_sdk` to the top of your py file. This includes all necessary functions and classes from the DYNAMIXEL SDK. ```python #!/usr/bin/env python3 @@ -47,14 +59,27 @@ $ code my_read_write.py from dynamixel_sdk import * ``` -### [Initialize Handler Objects](#make-objects) +## [Initialize Handler Objects](#make-objects) + +
+ - Initialize the `PortHandler` and `PacketHandler`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `/dev/ttyUSB0` as the port name and `2.0` as the protocol version. ```python portHandler = PortHandler("/dev/ttyUSB0") # your dxl port name packetHandler = PacketHandler(2.0) # protocol version ``` +
+ +
-### [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) +- Initialize the `PortHandler` and `PacketHandler`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `COM3` as the port name and `2.0` as the protocol version. +```python + portHandler = PortHandler("COM3") # your dxl port name + packetHandler = PacketHandler(2.0) # protocol version +``` +
+ +## [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) - Open the port and set the baud rate. The example below uses `57600` as the baud rate. ```python portHandler.openPort() @@ -81,7 +106,7 @@ else: ```
-### [Write data to enable torque](#write-data-to-enable-torque) +## [Write data to enable torque](#write-data-to-enable-torque) - Turn on the torque of the DYNAMIXEL. ```python dxl_id = 1 @@ -109,7 +134,7 @@ else: ``` -### [Get User Input](#get-user-input-and-write-data) +## [Get User Input](#get-user-input-and-write-data) - Get user input for the target position. ```python while True: @@ -126,7 +151,7 @@ else: continue ``` -### [Write data to set target position](#write-data-to-set-target-position) +## [Write data to set target position](#write-data-to-set-target-position) - Write the target position to the DYNAMIXEL. ```python goal_position_address = 116 @@ -147,7 +172,7 @@ else: ``` -### [Read data from DYNAMIXEL](#read-data-from-dynamixel) +## [Read data from DYNAMIXEL](#read-data-from-dynamixel) - Read the current position from the DYNAMIXEL. ```python while True: @@ -180,13 +205,25 @@ else: portHandler.closePort() ``` -## [Run the Code](#run-the-code) +# [Run the Code](#run-the-code) +
+ - Run the code using python3. ```bash $ python3 my_read_write.py ``` +
+
+ +- Run the code through Visual Studio Code. + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/runbutton.png) +
# [Full Source Code](#full-source-code) + +
+ ```python #!/usr/bin/env python3 @@ -255,3 +292,75 @@ data = 0 packetHandler.write1ByteTxRx(portHandler, dxl_id, torque_on_address, data) portHandler.closePort() ``` +
+
+ +```python +#!/usr/bin/env python3 + +from dynamixel_sdk import * + + +portHandler = PortHandler("COM3") +packetHandler = PacketHandler(2.0) + +if portHandler.openPort(): + print("Succeeded to open the port!") +else: + print("Failed to open the port!") + exit() + +if portHandler.setBaudRate(57600): + print("Succeeded to change the baudrate!") +else: + print("Failed to change the baudrate!") + exit() + +dxl_id = 1 +torque_on_address = 64 +data = 1 +dxl_comm_result, dxl_error = packetHandler.write1ByteTxRx(portHandler, dxl_id, torque_on_address, data) +if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) +elif dxl_error != 0: + print("%s" % packetHandler.getRxPacketError(dxl_error)) +else: + print("Dynamixel has been successfully connected") + +while True: + try: + target_position = int(input("Enter target position (0 ~ 4095, -1 to exit): ")) + except ValueError: + print("Please enter an integer.") + continue + + if target_position == -1: + break + elif target_position < 0 or target_position > 4095: + print("Position must be between 0 and 4095.") + continue + + goal_position_address = 116 + dxl_comm_result, dxl_error = packetHandler.write4ByteTxRx(portHandler, dxl_id, goal_position_address, target_position) + if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) + elif dxl_error != 0: + print("%s" % packetHandler.getRxPacketError(dxl_error)) + + while True: + present_position_address = 132 + present_position, dxl_comm_result, dxl_error = packetHandler.read4ByteTxRx(portHandler, dxl_id, present_position_address) + if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) + elif dxl_error != 0: + print("%s" % packetHandler.getRxPacketError(dxl_error)) + print(f"Current Position: {present_position}") + + if abs(target_position - present_position) <= 10: + break + +data = 0 +packetHandler.write1ByteTxRx(portHandler, dxl_id, torque_on_address, data) +portHandler.closePort() +``` +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_cpp.md b/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_cpp.md index 9d6b2e394..2eb42e000 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_cpp.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_cpp.md @@ -6,6 +6,9 @@ read_time: true share: true author_profile: false permalink: /docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_cpp/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows sidebar: title: DYNAMIXEL SDK nav: "dynamixel_sdk" @@ -22,34 +25,45 @@ sidebar: } -This section provides examples of how to write code in C++ to bulk_read and bulk_write data to DYNAMIXEL motors. - **NOTE**: This tutorial is based on **XL-430-W250** DYNAMIXEL motors and uses **Protocol 2.0**. {: .notice--warning} -# [Bulk_Read/Write Example](#bulk-read-write-example) +This section provides examples of how to write code in C++ to bulk_read and bulk_write data to DYNAMIXEL motors. **Bulk Read/Write** enables simultaneous control of multiple motors. Unlike **Sync Read/Write**, which can only access the same address across multiple motors, **Bulk Read/Write** can access different addresses on multiple motors in a single instruction. In this example, we need two motors to operate simultaneously. -## [Make cpp file](#make-cpp-file) +# [Make cpp file](#make-cpp-file) + +
+ - Create a CPP file and open it in a text editor. In this case, we use visual studio code, but you can use any text editor you prefer. ```bash $ mkdir -p my_dxl_project/src $ cd my_dxl_project/src $ code my_bulk_read_write.cpp ``` +
-## [Source Code](#source-code) +
-### [Add Header Files](#add-header-files) +- Open Visual Studio and create a new project as a Console Application. + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/makeproject.png) +
+ +# [Source Code Description](#source-code-description) + +## [Add Header Files](#add-header-files) - Add `dynamixel_sdk/dynamixel_sdk.h` to the top of your CPP file. This header file includes all necessary functions and classes from the DYNAMIXEL SDK. ```cpp #include "dynamixel_sdk/dynamixel_sdk.h" #include ``` -### [Initialize Handler Objects](#make-objects) +## [Initialize Handler Objects](#make-objects) + +
+ - Make main function and initialize the `PortHandler`,`PacketHandler`,`GroupBulkWrite` and `GroupBulkRead`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `/dev/ttyUSB0` as the port name and `2.0` as the protocol version. ```cpp int main(){ @@ -58,8 +72,21 @@ $ code my_bulk_read_write.cpp dynamixel::GroupBulkWrite groupBulkWrite(portHandler, packetHandler); dynamixel::GroupBulkRead groupBulkRead(portHandler, packetHandler); ``` +
+ +
+ +- Make main function and initialize the `PortHandler`,`PacketHandler`,`GroupBulkWrite` and `GroupBulkRead`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `COM3` as the port name and `2.0` as the protocol version. +```cpp + int main(){ + dynamixel::PortHandler *portHandler = dynamixel::PortHandler::getPortHandler("COM3"); // your dxl port name + dynamixel::PacketHandler *packetHandler = dynamixel::PacketHandler::getPacketHandler(2.0); //protocol version + dynamixel::GroupBulkWrite groupBulkWrite(portHandler, packetHandler); + dynamixel::GroupBulkRead groupBulkRead(portHandler, packetHandler); +``` +
-### [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) +## [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) - Open the port and set the baud rate. The example below uses `57600` as the baud rate. ```cpp portHandler->openPort(); @@ -88,7 +115,7 @@ $ code my_bulk_read_write.cpp ``` -### [Write data to enable torque](#write-data-to-enable-torque) +## [Write data to enable torque](#write-data-to-enable-torque) - Turn on the torque of the DYNAMIXEL. ```cpp uint8_t dxl_id1 = 1; @@ -134,7 +161,7 @@ The `dxl_comm_result`, `dxl_error` variable should be declared beforehand. ``` -### [Add Parameters to GroupBulkRead](#add-parameters-to-groupbulkread) +## [Add Parameters to GroupBulkRead](#add-parameters-to-groupbulkread) - Add the DYNAMIXEL IDs and addresses to access to the `GroupBulkRead`. ```cpp uint16_t present_position_address = 132; @@ -170,7 +197,7 @@ The `dxl_addparam_result` variable should be declared beforehand. ``` -### [Get User Input and Set Data](#get-user-input-and-write-data) +## [Get User Input and Set Data](#get-user-input-and-write-data) - Get user input for the target position. ```cpp int target_position = 0; @@ -201,7 +228,7 @@ The `dxl_addparam_result` variable should be declared beforehand. } ``` -### [Add parameter to GroupBulkWrite and Write Data](#add-parameters-to-groupbulkwrite) +## [Add parameter to GroupBulkWrite and Write Data](#add-parameters-to-groupbulkwrite) - Add parameter to the `GroupBulkWrite` and tranfer the data to the DYNAMIXEL. ```cpp uint16_t goal_position_address = 116; @@ -241,7 +268,7 @@ The `dxl_addparam_result`, `dxl_comm_result` variables should be declared before ``` -### [Read data from DYNAMIXEL](#read-data-from-dynamixel) +## [Read data from DYNAMIXEL](#read-data-from-dynamixel) - Read the current position and LED data from the DYNAMIXEL until it reaches the target position. ```cpp int dxl1_present_position; @@ -298,14 +325,44 @@ You can also check if the data is available in the `GroupBulkRead` by using the ``` -## [Compile and Run](#compile-and-run) +# [Compile and Run](#compile-and-run) + +
+ - Compile the code using g++. ```bash $ g++ my_bulk_read_write.cpp -o my_bulk_read_write -ldxl_x64_cpp $ ./my_bulk_read_write ``` +
+ +
+ +- Set build properties. + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties.png) + - `C/C++ → Additional Include Directories` : `{$Dynamixel_SDK_PATH\c++\include}` + - `Debugging → Environment` : `PATH=%PATH%;{$Dynamixel_SDK_PATH\c++\build\win64\output}` (if you use 32bit architecture, use `{$Dynamixel_SDK_PATH\c++\build\win32\output}`) + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildproperties2.png) + - `Linker` → `Additional Library Directories` : `{$Dynamixel_SDK_PATH\c++\build\win64\output}` (if you use 32bit architecture, use `{$Dynamixel_SDK_PATH\c++\build\win32\output}`) + - `Linker` → `Input` → `Additional Dependencies` : `dxl_x64_cpp.lib` + +
+ +- **Build properties setup is complete. You can now build and run the project.** + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/buildandrun.png) +- **After building, you can find the executable file( .exe ) in the output directory :** `{$YOUR_SLN_DIR\x64\}` + +**WARNING**: If you execute the .exe file directly(not through the IDE), you might encounter a `missing DLL` error. To fix this, ensure that `dxl_x64_cpp.dll` is either in your system PATH or in the same directory as the application. +{: .notice--warning} +
# [Full Source Code](#full-source-code) + +
+ ```cpp #include "dynamixel_sdk/dynamixel_sdk.h" #include @@ -447,3 +504,149 @@ int main(){ 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; + } + + uint8_t param_goal_position[4]; + param_goal_position[0] = DXL_LOBYTE(DXL_LOWORD(target_position)); + param_goal_position[1] = DXL_HIBYTE(DXL_LOWORD(target_position)); + param_goal_position[2] = DXL_LOBYTE(DXL_HIWORD(target_position)); + param_goal_position[3] = DXL_HIBYTE(DXL_HIWORD(target_position)); + + uint8_t led_data = 0; + if (dxl2_led_value_read == 0){ + led_data = 1; + } else { + led_data = 0; + } + + uint16_t goal_position_address = 116; + dxl_addparam_result = groupBulkWrite.addParam(dxl_id1, goal_position_address, data_length_4byte, param_goal_position); + if (!dxl_addparam_result) { + std::cout <<"[ID:" << (int)dxl_id1 <<"]groupBulkWrite addparam failed" << std::endl; + return 0; + } + + 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; +} +``` +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_python.md b/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_python.md index 55d8ec428..0bd553b75 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_python.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_python.md @@ -6,6 +6,9 @@ read_time: true share: true author_profile: false permalink: /docs/en/software/dynamixel/dynamixel_sdk/bulk_read_write_tutorial/bulk_read_write_tutorial_python/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows sidebar: title: DYNAMIXEL SDK nav: "dynamixel_sdk" @@ -22,27 +25,36 @@ sidebar: } -This section provides examples of how to write code in python to bulk_read and bulk_write data to DYNAMIXEL motors. - **NOTE**: This tutorial is based on **XL-430-W250** DYNAMIXEL motors and uses **Protocol 2.0**. {: .notice--warning} -# [Bulk_Read/Write Example](#bulk-read-write-example) +This section provides examples of how to write code in python to bulk_read and bulk_write data to DYNAMIXEL motors. **Bulk Read/Write** enables simultaneous control of multiple motors. Unlike **Sync Read/Write**, which can only access the same address across multiple motors, **Bulk Read/Write** can access different addresses on multiple motors in a single instruction. In this example, we need two motors to operate simultaneously. -## [Make python file](#make-python-file) +
+ +# [Make python file](#make-python-file) - Create a python file and open it in a text editor. In this case, we use visual studio code, but you can use any text editor you prefer. ```bash $ mkdir -p my_dxl_project/python $ cd my_dxl_project/python $ code my_bulk_read_write.py ``` +
+ +
+ +# [Make python file](#make-python-file) +- Open the Visual Studio Code and create a python file in your workspace. + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/vscodepython.png) +
-## [Source Code](#source-code) +# [Source Code Description](#source-code-description) -### [Add Header Files](#add-header-files) +## [Add Header Files](#add-header-files) - Add `#!/usr/bin/env python3` and import `dynamixel_sdk` to the top of your py file. This includes all necessary functions and classes from the DYNAMIXEL SDK. ```python #!/usr/bin/env python3 @@ -50,7 +62,10 @@ $ code my_bulk_read_write.py from dynamixel_sdk import * ``` -### [Initialize Handler Objects](#make-objects) +## [Initialize Handler Objects](#make-objects) + +
+ - Initialize the `PortHandler`,`PacketHandler`,`GroupBulkWrite` and `GroupBulkRead`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `/dev/ttyUSB0` as the port name and `2.0` as the protocol version. ```python portHandler = PortHandler('/dev/ttyUSB0') @@ -61,9 +76,23 @@ $ code my_bulk_read_write.py groupBulkWrite = GroupBulkWrite(portHandler, packetHandler) groupBulkRead = GroupBulkRead(portHandler, packetHandler) ``` +
+ +
+- Initialize the `PortHandler`,`PacketHandler`,`GroupBulkWrite` and `GroupBulkRead`. Set the `port name` and `protocol version` according to your DYNAMIXEL setup. The example below uses `COM3` as the port name and `2.0` as the protocol version. +```python + portHandler = PortHandler('COM3') + packetHandler = PacketHandler(2.0) -### [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) + goal_position_address = 116 + present_position_address = 132 + groupBulkWrite = GroupBulkWrite(portHandler, packetHandler) + groupBulkRead = GroupBulkRead(portHandler, packetHandler) +``` +
+ +## [Open Port and Set Baud Rate](#open-port-and-set-baud-rate) - Open the port and set the baud rate. The example below uses `57600` as the baud rate. ```python portHandler.openPort() @@ -90,7 +119,7 @@ else: ``` -### [Write data to enable torque](#write-data-to-enable-torque) +## [Write data to enable torque](#write-data-to-enable-torque) - Turn on the torque of the DYNAMIXEL. ```python dxl_id1 = 1 @@ -128,7 +157,7 @@ else: ``` -### [Add parameters to GroupBulkRead](#add-parameters-to-groupbulkread) +## [Add parameters to GroupBulkRead](#add-parameters-to-groupbulkread) - Add the DYNAMIXEL IDs to the `GroupBulkRead`. ```python present_position_address = 132 @@ -158,7 +187,7 @@ if dxl_addparam_result != True: -### [Get User Input and Set Data](#get-user-input-and-write-data) +## [Get User Input and Set Data](#get-user-input-and-write-data) - Get user input for the target position. ```python dxl2_led_value_read = 0 @@ -190,7 +219,7 @@ if dxl_addparam_result != True: led_data = [0] ``` -### [Add parameters to GroupBulkWrite](#add-parameters-to-groupbulkwrite) +## [Add parameters to GroupBulkWrite](#add-parameters-to-groupbulkwrite) - Add parameter to the `GroupBulkWrite` and tranfer the data to the DYNAMIXEL. Also set the LED data to toggle the LED on the second DYNAMIXEL. ```python groupBulkWrite.addParam(dxl_id1, goal_position_address, data_length_4byte, param_goal_position) @@ -221,7 +250,7 @@ if dxl_addparam_result != True: ``` -### [Read data to get current position](#read-data-to-get-current-position) +## [Read data to get current position](#read-data-to-get-current-position) - Read the current position from the DYNAMIXEL until it reaches the target position. ```python while True: @@ -259,13 +288,27 @@ You can also check if the data is available in the `GroupBulkRead` by using the ``` -## [Run the Code](#run-the-code) +# [Run the Code](#run-the-code) + +
+ - Run the code using python3. ```bash $ python3 my_bulk_read_write.py ``` +
+ +
+ +- Run the code through Visual Studio Code. + + ![](/assets/images/sw/sdk/dynamixel_sdk/basic_read_write_tutorial/runbutton.png) +
# [Full Source Code](#full-source-code) + +
+ ```python #!/usr/bin/env python3 @@ -388,3 +431,130 @@ while True: break portHandler.closePort() ``` +
+ +
+ +```python +#!/usr/bin/env python3 + +from dynamixel_sdk import * + + +portHandler = PortHandler('COM3') +packetHandler = PacketHandler(2.0) + +goal_position_address = 116 +present_position_address = 132 +groupBulkWrite = GroupBulkWrite(portHandler, packetHandler) +groupBulkRead = GroupBulkRead(portHandler, packetHandler) + +if portHandler.openPort(): + print("Succeeded to open the port!") +else: + print("Failed to open the port!") + exit() + +if portHandler.setBaudRate(57600): + print("Succeeded to change the baudrate!") +else: + print("Failed to change the baudrate!") + exit() + +dxl_id1 = 1 +dxl_id2 = 2 +torque_on_address = 64 +data = 1 +dxl_comm_result, dxl_error = packetHandler.write1ByteTxRx(portHandler, dxl_id1, torque_on_address, data) +if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) +elif dxl_error != 0: + print("%s" % packetHandler.getRxPacketError(dxl_error)) +else: + print("Dynamixel#1 has been successfully connected") + +dxl_comm_result, dxl_error = packetHandler.write1ByteTxRx(portHandler, dxl_id2, torque_on_address, data) +if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) +elif dxl_error != 0: + print("%s" % packetHandler.getRxPacketError(dxl_error)) +else: + print("Dynamixel#2 has been successfully connected") + +present_position_address = 132 +data_length_4byte = 4 +dxl_addparam_result = groupBulkRead.addParam(dxl_id1, present_position_address, data_length_4byte) +if dxl_addparam_result != True: + print("[ID:%03d] groupBulkRead addparam failed" % dxl_id1) + exit() + +led_address = 65 +data_length_1byte = 1 +dxl_addparam_result = groupBulkRead.addParam(dxl_id2, led_address, data_length_1byte) +if dxl_addparam_result != True: + print("[ID:%03d] groupBulkRead addparam failed" % dxl_id2) + exit() + +dxl2_led_value_read = 0 +while True: + try: + target_position = int(input("Enter target position (0 ~ 4095, -1 to exit): ")) + except ValueError: + print("Please enter an integer.") + continue + + if target_position == -1: + break + elif target_position < 0 or target_position > 4095: + print("Position must be between 0 and 4095.") + continue + + param_goal_position = [ + DXL_LOBYTE(DXL_LOWORD(target_position)), + DXL_HIBYTE(DXL_LOWORD(target_position)), + DXL_LOBYTE(DXL_HIWORD(target_position)), + DXL_HIBYTE(DXL_HIWORD(target_position)) + ] + + if (dxl2_led_value_read == 0): + led_data = [1] + else: + led_data = [0] + + + dxl_addparam_result = groupBulkWrite.addParam(dxl_id1, goal_position_address, data_length_4byte, param_goal_position) + if not dxl_addparam_result: + print("[ID:%03d] groupBulkWrite addparam failed" % dxl_id1) + exit() + + dxl_addparam_result = groupBulkWrite.addParam(dxl_id2, led_address, data_length_1byte, led_data) + if not dxl_addparam_result: + print("[ID:%03d] groupBulkWrite addparam failed" % dxl_id2) + exit() + + dxl_comm_result = groupBulkWrite.txPacket() + if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) + groupBulkWrite.clearParam() + + while True: + dxl_comm_result = groupBulkRead.txRxPacket() + if dxl_comm_result != COMM_SUCCESS: + print("%s" % packetHandler.getTxRxResult(dxl_comm_result)) + dxl_getdata_result = groupBulkRead.isAvailable(dxl_id1, present_position_address, data_length_4byte) + if dxl_getdata_result != True: + print("[ID:%03d] groupBulkRead getdata failed" % dxl_id1) + quit() + + dxl_getdata_result = groupBulkRead.isAvailable(dxl_id2, led_address, data_length_1byte) + if dxl_getdata_result != True: + print("[ID:%03d] groupBulkRead getdata failed" % dxl_id2) + quit() + 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) + print("[ID:%03d] Present Position : %d \t [ID:%03d] LED Value: %d" % (dxl_id1, dxl1_present_position, dxl_id2, dxl2_led_value_read)) + if abs(target_position - dxl1_present_position) <= 10: + break +portHandler.closePort() +``` +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup.md index 5c97f4801..07783ef40 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup.md @@ -25,21 +25,9 @@ page_number: 4 - Library Setup is the process of building the SDK library. - - [C Windows](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_windows) - - [C Linux](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_linux) - - [C macOS](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_macos) - - [C++ Windows](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_windows) - - [C++ Linux](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux/#library-setup-cpp-linux) - - [C++ macOS](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_macos) - - [Python Windows](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_windows) - - [Python Linux](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_linux) - - [Python macOS](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_macos) - - [Java Windows](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_windows) - - [Java Linux](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_linux) - - [Java macOS](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java_macos) - - [C# Windows](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_windows) - - [C# Linux](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_linux) - - [C# macOS](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp_macos) - - [MATLAB Windows](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_windows) - - [MATLAB Linux](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_linux) - - [MATLAB macOS](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos) + - [C](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c/#library-setup-c-linux) + - [C++](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp/#library-setup-cpp-linux) + - [Python](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python/#library-setup-python-linux) + - [Java](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/java/#library-setup-java-linux) + - [C#](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp/#library-setup-csharp-windows) + - [MATLAB](/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab/#library-setup-matlab-windows) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_linux.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_linux.md deleted file mode 100644 index f4cbe8e65..000000000 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_linux.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -layout: archive -lang: en -ref: c_linux -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/c_linux/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [C Linux](#c-linux) - -This tutorial is written assuming you are using the latest version of Ubuntu. Commands may not be the same for alternative distributions of Linux. - -### [Compiler and Builder](#compiler-and-builder) - -#### [Compiler](#compiler) - -* The DYNAMIXEL SKD requires GNU gcc ver. 5.4.0 20160609 or higher -* To check the version of your gcc compiler: - - ``` bash - $ gcc -v - ``` - -* Download the required compiler: - - ``` bash - $ sudo apt-get install gcc - ``` - -#### [Builder](#builder) - -* Build-essential pkg → make -* Download: - - ``` bash - $ sudo apt-get install build-essential - ``` - -#### [Dependent Packages](#dependent-packages) - -* Packages needed for cross-compiling -* Download: - - ``` bash - $ sudo apt-get install gcc-multilib g++-multilib - ``` - -#### [Build the Library](#build-the-library) - -* Choose which format (32bit or 64bit) of the library you will be bulding. - The Makefile is located in the following folder: `[DynamixelSDK folder]/c/build/linux32` OR `[DynamixelSDK folder]/c/build/linux64` folder for 32/64-bit platforms OR `[DynamixelSDK folder]/c/build/linux_sbc` folder for ARM SBCs. - Please note that if you intend to use the 32-bit example applications, you must build the 32-bit library. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/library_file/c6.png) - -* Go to the Makefile's directory located in `[DynamixelSDK folder]/c/build/linux32` OR `[DynamixelSDK folder]/c/build/linux64` OR `[DynamixelSDK folder]/c/build/linux_sbc` using $ `cd`. - - -* Build the library file: - - ``` bash - $ make - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/library_file/c1.png) - - -* If there is an error, try rebuilding the package after cleaning any leftover files. - - ``` bash - $ make clean && make - ``` - -* To delete the library file and object files after a successful build: - - ``` bash - $ make clean - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/library_file/c2.png) - -##### Copy (Install) the Library to the Root Directory - -* Make the library file and copy it to the root directory (to handle the serial port): - - ``` bash - $ sudo make install - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/library_file/c3.png) - -* If there is an error, you can retry the installation: - - ``` bash - $ sudo make uninstall && sudo make install - ``` - - OR - - ``` bash - $ sudo make reinstall - ``` - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/library_file/c4.png) - -* To delete the library file from the root directory: - - ``` bash - $ sudo make uninstall - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/library_file/c5.png) - - -* You will see the built library file in `[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so` - -### [Building and Running the Sample Code](#building-and-running-the-sample-code) - -The DYNAMIXEL SDK example code for C uses a .so (Linux Shared Object) library built in C. -The previous instructions walk you through building the latest library files in `[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so` built by its own source code. - -* Go to the Makefile's directory using `cd`: - - ``` bash - $ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux32 - ``` - - OR - - ``` bash - $ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux64 - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc4.png) - -* Build the executable file: - - ``` bash - $ make - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc1.png) - -* If there is an error, `$ make clean` then `$ make` again. - -* To delete the executable file, `$ make clean`. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc2.png) - -* Access the port you will be using to communicate with DYNAMIXEL: - - ``` bash - $ sudo chmod a+rw /dev/ttyUSB0 - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc3.png) - -* Run the executable file: - - ``` bash - $ ./read_write - ``` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/linux/sample_code/exc5.png) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_windows.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_windows.md deleted file mode 100644 index 3545b64ed..000000000 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_windows.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -layout: archive -lang: en -ref: cpp_windows -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_windows/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [CPP Windows](#cpp-windows) - -### [Compiler and Builder](#compiler-and-builder) - -* [Download Visual Studio Community for Windows Desktop](https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/vs.png) - -### [Building the Library](#building-the-library) - -* Run the project solution file (.sln) located in the `[DynamixelSDK folder]/c++/build/win32` directory (or the `[DynamixelSDK folder]/c++/build/win64` directory) - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/1.png) - -* In the Solution Explorer, right click on the project and select Properties. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/2.png) - -* Under General Configuration Properties, confirm that the paths and file extensions are set to the following: - - * Output Directory: `$(SolutionDir)output\` - * Intermediate Directory: `$(Configuration)\` - * Platform Toolset: `Visual Studio 20XX (v000)` - * Configuration Type: `Dynamic Library (.dll)` - -{% capture notice_01 %} -**WARNING**: -If the library file needs to be built in a lower or higher version of Visual Studio, change the `Platform Toolset` into the needed value. (ex: To use the DynamixelSDK c ver. library file in the MATLAB 2010 or LabVIEW 2010, the `Platform Toolset` should be changed to `Visual Studio 2009` lower.) -{% endcapture %} -
{{ notice_01 | markdownify }}
- - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/3.png) - -* Confirm that the Additional Include Directories path under the General C/C++ Configuration Properties tree is as follows: - - `..\..\..\include\dynamixel_sdk` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/4.png) - -* Right click on the project and select Build to build the library. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/library_file/5.png) - -* The compiled library file will be saved in `[DynamixelSDK folder]/c++/build/[winXX]/output/dxl_xYY_cpp.dll` - - -### [Building and Running the Sample Code](#building-and-running-the-sample-code) - -The DYNAMIXEL SDK example code for CPP uses the library files (.dll for Windows) built from the CPP source. - -By following the instructions above, The compiled .dll files are output to `[DynamixelSDK folder]/c/build/[winXX]/output/dxl_xYY_c.dll` after being built from the included source code. - -* Run the .sln file located in the `[DynamixelSDK folder]/cpp/example/protocol2.0/read_write/win32` folder if you have a 32-bit platform OR the `[DynamixelSDK folder]/cpp/example/protocol2.0/read_write/win64` folder if you have a 64-bit platform. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/1.png) - -* Right click on the project and select Properties. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/2.png) - -* In the resulting Property Pages window, under Configuration Properties --> General, check that the directories and file extensions are set as follows: - - * Output Directory: `$(SolutionDir)$(Configuration)\` - * Intermediate Directory: `$(Configuration)\` - * Target Extension: `.exe` - * Configuration Type: `Application (.exe)` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/3.png) - -* Add the path to the Debugging-Environment tab as shown below. - - - [win32] `PATH=%PATH%;..\..\..\..\..\build\win32\output;` - - [win64] `PATH=%PATH%;..\..\..\..\..\build\win64\output;` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/4.png) - -* Add the path path in VC++-Library Directories tab as shown below. - - - [win32] `..\..\..\..\..\build\win32\output;` - - [win64] `..\..\..\..\..\build\win64\output;` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/5.png) - -* Add the path in C/C++-Common-Additional include directory tab as shown below. - - `..\..\..\..\..\include\dynamixel_sdk` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/6.png) - -* Add the file name in Linker-Input-Additional dependency tab as shown below. - - - [win32] `dxl_x86_cpp.lib;` - - [win64] `dxl_x64_cpp.lib;` - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/7.png) - -* Click the Debugger button to run the program - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/cpp/windows/sample_code/8.png) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_c.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_c.md new file mode 100644 index 000000000..ea7384876 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_c.md @@ -0,0 +1,32 @@ +--- +layout: archive +lang: en +ref: library_setup_c +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/c/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows +tab_title3: Mac +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/c_linux.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/c_windows.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/c_macos_dummy.md %} +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_cpp.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_cpp.md new file mode 100644 index 000000000..cd406e63d --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_cpp.md @@ -0,0 +1,32 @@ +--- +layout: archive +lang: en +ref: library_setup_cpp +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows +tab_title3: Mac +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/cpp_linux.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/cpp_windows.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/cpp_macos_dummy.md %} +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_csharp.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_csharp.md new file mode 100644 index 000000000..66e34f677 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_csharp.md @@ -0,0 +1,22 @@ +--- +layout: archive +lang: en +ref: library_setup_csharp +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/csharp/ +tabs: "OS" +tab_title1: Windows +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/csharp_windows.md %} +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_java.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_java.md new file mode 100644 index 000000000..ab5a1fa26 --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_java.md @@ -0,0 +1,33 @@ +--- +layout: archive +lang: en +ref: library_setup_java +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/java/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows +tab_title3: Mac +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/java_linux.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/java_windows.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/java_macos_dummy.md %} +
+ diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_labview.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_labview.md new file mode 100644 index 000000000..07c2dd9fb --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_labview.md @@ -0,0 +1,23 @@ +--- +layout: archive +lang: en +ref: library_setup_labview +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/labview/ +tabs: "OS" +tab_title1: Windows +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/labview_windows.md %} +
+ diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_matlab.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_matlab.md new file mode 100644 index 000000000..ab733c25b --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_matlab.md @@ -0,0 +1,32 @@ +--- +layout: archive +lang: en +ref: library_setup_matlab +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows +tab_title3: Mac +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/matlab_linux.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/matlab_windows.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/matlab_macos_dummy.md %} +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_python.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_python.md new file mode 100644 index 000000000..60149867d --- /dev/null +++ b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/library_setup_python.md @@ -0,0 +1,35 @@ +--- +layout: archive +lang: en +ref: library_setup_python +read_time: true +share: true +author_profile: false +permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/python/ +tabs: "OS" +tab_title1: Linux +tab_title2: Windows +tab_title3: Mac +sidebar: + title: DYNAMIXEL SDK + nav: "dynamixel_sdk" +--- + +{::options parse_block_html="true" /} + + + +
+{% include en/software/dynamixel_sdk/library_setup/python_linux.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/python_windows.md %} +
+ +
+{% include en/software/dynamixel_sdk/library_setup/python_macos_dummy.md %} +
+ +




+




diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos_dummy.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos_dummy.md deleted file mode 100644 index bf338b014..000000000 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos_dummy.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: archive -lang: en -ref: matlab_macos -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/matlab_macos/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [Matlab macOS](#matlab-macos) - -{% include en/maintenance_is_in_progress.md %} - - diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_linux.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_linux.md deleted file mode 100644 index fe2e580cd..000000000 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_linux.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -layout: archive -lang: en -ref: python_linux -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_linux/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - -{::options parse_block_html="true" /} - -
-

Library Setup

-
- - -# [Install requirements](#install-requirements) - -- Install python3 and pip3. -```bash -$ sudo apt update -$ sudo apt install python3 python3-pip python3-serial -``` - -- You can also install in web browser using the following link: - [Download Python3 for Linux](https://www.python.org/downloads/) - -- If you downloaded SDK as source code, you should install it using pip3. -```bash -$ cd DynamixelSDK/python -$ pip install . -``` - -# [Check whether pip recognizes the SDK](#check-whether-pip-recognizes-the-sdk) - -- You can check whether pip recognizes the SDK by running the following command: -```bash -$ pip show dynamixel_sdk -Name: dynamixel-sdk -Version: *.*.* -Summary: UNKNOWN -Home-page: UNKNOWN -Author: -Author-email: -License: UNKNOWN -Location: location your sdk installed in # ex. /home/robotis/.local/lib/python3.10/site-packages OR /opt/ros/humble/local/lib/python3.10/dist-packages -Requires: -Required-by: -``` - - diff --git a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_windows.md b/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_windows.md deleted file mode 100644 index 143b86730..000000000 --- a/docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_windows.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: archive -lang: en -ref: python_windows -read_time: true -share: true -author_profile: false -permalink: /docs/en/software/dynamixel/dynamixel_sdk/library_setup/python_windows/ -sidebar: - title: DYNAMIXEL SDK - nav: "dynamixel_sdk" ---- - - -
- - - -## [Python Windows](#python-windows) - -### [Recommended Editor](#recommended-editor) - -* [Download Visual Studio Community for Windows Desktop](https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/c/vs.png) - -### [Compiler and Builder](#compiler-and-builder) - -![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/python.png) - -* [Download Python3 for Windows](https://www.python.org/downloads/), and be sure to install it to your path when prompted. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/windows/library_file/b1.png) - -### [Building the Library](#building-the-library) -* Navigate to the [`DynamixelSDK python folder`] in the Windows command prompt. (`cd [DynamixelSDK folder]\python`). - Then, run the installation by entering the following command on the command prompt from inside the folder (`pip install .`). - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/windows/library_file/py3.png) - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/windows/library_file/py4.png) - - -### [Building and Running the Sample Code](#building-and-running-the-sample-code) - -The DYNAMIXEL SDK example code for Python uses the library files installed in the previous step. - -#### Run Example - -* Open the `python` folder using your preffered development environment and modify any settings that may be needed for accurate control of the DYNAMIXEL servos you'll be using. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/windows/sample_code/py2.png) - - -* Run the `read_write.py` example to check your installation. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/windows/sample_code/py4.png) - -* Or run the script manually through the command prompt. - - ![](/assets/images/sw/sdk/dynamixel_sdk/library_setup/python/windows/sample_code/py6.png) diff --git a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_broadcast_ping_protocol_2_0.md b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_broadcast_ping_protocol_2_0.md index 31ed3283d..9f4c5aebc 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_broadcast_ping_protocol_2_0.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_broadcast_ping_protocol_2_0.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_protocol_1_0.md b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_protocol_1_0.md index 570febc44..c3cd3fc69 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_protocol_1_0.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_protocol_1_0.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_write_protocol_2_0.md b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_write_protocol_2_0.md index d676560c1..988cff89b 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_write_protocol_2_0.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_bulk_read_write_protocol_2_0.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_clear_multi_turn_protocol_2_0.md b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_clear_multi_turn_protocol_2_0.md index 24809cb5f..35e6a8ba7 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_clear_multi_turn_protocol_2_0.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_clear_multi_turn_protocol_2_0.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +
diff --git a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_dxl_monitor.md b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_dxl_monitor.md index e5b22951f..97486dcda 100644 --- a/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_dxl_monitor.md +++ b/docs/en/software/dynamixel/dynamixel_sdk/sample_code/c/c_dxl_monitor.md @@ -11,7 +11,7 @@ sidebar: nav: "dynamixel_sdk" --- - +