Skip to content

ghiouar/ofxDynamixel

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

OfxDynamixel

OpenFrameworks addon for controlling and interacting Dynamixel Robotis Actuator from Robotis.

Description

OfxDynamixel is an openframeworks (Ofx) addon that allows you to control Dynamixel Robotis Actuator. OfxDynamixel is built on top of C++ to meet the requirements of openframeworks. This addon uses DynamixelSDK library which can be found at https://github.com/ROBOTIS-GIT/DynamixelSDK. The ROBOTIS Dynamixel SDK is a software development library that provides Dynamixel control functions for packet communication. The API is designed for Dynamixel actuators and Dynamixel-based platforms.

The ofxDynamixel addon allows to do all the necessary basic operations on a Dynamixel servomotor. The classes provided allow easy communication with Dynamxiel and are easy to use. OfxDynamixel allows to read and modify the data of the control table. The Dynamixel servomotors are controlled by modifying these data as for example the position, led satet, Id ...

Three main classes have been developed:

  • The class ofConnection Create a connection with the Dynamixel actuators by using the methods of the DynamixelSDK library. You must provide port name , boudrate, and the protocol version.

  • The class ofContorolTable This class allows to read and modify the information contained in the Dynamixel control table such as ID, position, speed, temperature, etc.

  • The class ofDynamixel OfDynamixel is the main class that groups the previous two classes. This class also provides methods for checking the operation of the servo motors by ping, resetting, stopping, and restarting the servo motors. It also allows the Dynamixel actuators to be positioned at a given position and speed.

Features

ofxDynamixel offers the following features :

  • Create a communication with dynamixel.
  • Read and update the registers of the control table.
  • Ping, reboot, reset, stop the dynamixels.
  • Move to a position with a moving speed.

Installation

ofxDynamixel offers the following features :

  1. Clone or download this repository into your openFrameworks/addons directory.
  2. Create a new openframworks project using project generator or openFrameworks plugin for visual studio.
  3. Choose ofxDynamixel in "Addons" for project generator or in "Community addons" for visual studio plugin.
  4. Add ofDynamixel to your project by adding #include "ofDynamixel.h" to the top of your ofApp.h file.

Ofx Dynamixel requires Dynamixel SDK to work properly, you must configure the project to integrate the Dynamixel SDK library :

  1. Open project properties.
  2. Add path in Debugging-Environment tab as shown below
PATH=%PATH%;..\..\..\..\..\build\win32\output;
  1. Add path in VC++-Library Directories tab
..\..\..\libs\DynamixelSDK\build\win32\output\
  1. Add path in C/C++-Common-Additional include directory tab
..\..\..\libs\DynamixelSDK\include\
  1. Add file name in Linker-Input-Additional dependency tab
dxl_x86_cpp.lib;

Dependencies

This addon does not depend on any other addon to work properly.

Compatibility

This addon is compatible with version 0.9.8 of OpenFrameworks (of v0.9.8_vs_release)

Example of use

#include "ofConnexion.h";
#include "ofDynamixel.h";

#define PROTOCOL_VERSION      1.0
#define ID                    1
#define BAUDRATE              57142
#define DEVICENAME            "COM4"    

void ofApp::setup() {
    ofConnexion * portConnexion = new ofConnexion(DEVICENAME, PROTOCOL_VERSION, BAUDRATE);
    
		bool succes = portConnexion->open();
		if (succes)
		{	
			printf("Port is opened!\n");
			succes = portConnexion->setBaudRate(BAUDRATE);
			if (succes)
			{
				printf("baudrate is changed!\n");
			} else {
				printf("Failed to change the baudrate!\n");
			} 
		} else {
			printf("Failed to open the port!\n");
		}

		if (succes) {
		    ofDynamixel * dynamixel = new ofDynamixel(ID, portConnexion, 15, 700);
		    
			// Read the information of the control table
			printf("ID : %d\n", dynamixel->getControlTable()->getID());
			printf("Model number : %d\n", dynamixel->getControlTable()->modelNumber());
			printf("Firmware version : %d\n", dynamixel->getControlTable()->firmwareVersion());
			printf("BaudRate : %d\n", dynamixel->getControlTable()->baudRate());
		
			// Change the information of the control table
			dynamixel->getControlTable()->setGoalPosition(512);
			dynamixel->getControlTable()->setLed(1);
		}
		
}

License

The code in this repository is available under the MIT License. Copyright (c) [June 2017] [A. Ghiouar], See license.md

Version history

Version 1.0 (June, 20 2017):

This first version gives us the posiibilty to easily communicate with dynamixels in a openframworks project. All basic operations such as the verification, modification and reading of the data of the dynamixels can be performed without incident.

Known issues

At present, the example focuses only with a set of 4 dynamixels. An update is coming.

If you notice any issues, please report them here.

About

OpenFrameworks addon for controlling and interacting Dynamixel Robotis Actuator from Robotis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published