Skip to content

Commit

Permalink
Add license headers and license document. Truncate history here.
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Jan 22, 2015
0 parents commit 138a9d8
Show file tree
Hide file tree
Showing 118 changed files with 40,717 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
@@ -0,0 +1,22 @@
# Build artifacts
*.o

# Binaries
build/*
gui/build/*

# Scons temporary files
.scon*

# Doxygen
doc/html

# QtCreator temporary project files
SmartServoFramework.config
SmartServoFramework.creator*
SmartServoFramework.files
SmartServoFramework.includes

# Qmake temporary project files (gui)
gui/SmartServoGui.pro.*
gui/Makefile
2,354 changes: 2,354 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

165 changes: 165 additions & 0 deletions LICENSE
@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.

"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.

An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.

A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".

The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:

a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or

b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the object code with a copy of the GNU GPL and this license
document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:

a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.

c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.

1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.

e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:

a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.

b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
87 changes: 87 additions & 0 deletions README
@@ -0,0 +1,87 @@
SmartServoFramework 0.9
=======================

## Introduction

This is a C++ multiplatform framework used to drive "smart servos" device like Dynamixel or HerkuleX actuators.
Linux, Mac OS and Windows operating systems are supported. All you need to begin moving stuff around is at least one servo, a serial port adapter and a C++/11 compiler!

> Dynamixel devices from [Robotis](http://www.robotis.com/) and HerkuleX devices from [Dongbu Robot](http://www.dongburobot.com/) are high-performance networked actuators for robots available in wide range of sizes and strengths.
> They provide adjustable torque, speed, and response, various feedback like position, load, voltage and temperature...

## Prerequisite

### Compiler

You need a C++/11 capable compiler. That includes:

* GCC >= 4.6
* Clang >= 3.0
* XCode >= 4.6
* MSVC >= 2012

### Serial link

This framework can use any combination of RS-232 ports, USB to TTL adapters, RS-485 adapters... but the servo devices needs the right link!

First make sure that you can access your serial port:
If you are running Windows you will need to install the [FTDI driver for the USB2Dynamixel device](http://www.robotis.com/xe/download_en/646927) or the official [FTDI driver](http://www.ftdichip.com/FTDrivers.htm).
You may also need other drivers depending on your adapter (like the [CP210x](http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx)).
If you are running Linux, your user account will need to be in the _'dialout'_ and/or _'uucp'_ groups to access serial port:
> $ sudo useradd -G dialout,uucp $USER

Latency over the serial port will limit the number of instructions you can send each second even more than bandwidth limitations.
To minimize traffic on your serial port (if using FTDI chips):
- Make sure you have set the "Status Return Level" to '1' to minimize the number of response packets (if you do not need them), or even '2' to disable them all.
- If you are using Dynamixel devices, you may want to reduce the "Return Delay Time" value to a minimum, from the default of '250' to something like '5'.
- You can also use [these tips](https://projectgus.com/2011/10/notes-on-ftdi-latency-with-arduino/) to reduce latency on serial ports!

#### Serial link (Dynamixel servos)

* USB2Dynamixel: Official device that can manage regular RS232, RS485 and TTL communications.
* USB2AX: Unofficial device designed to manage TTL communication only.
* "Home made" TTL half-duplex device: (LINK?)

> Note: Regular "full-duplex TTL" converters will NOT do the trick for "half-duplex TTL" Dynamixel servos (AX series, MX "T" series, XL-320).

#### Serial link (HerkuleX servos)

You need a serial port with a regular TTL converter to use HerkuleX devices.

## Framework

This framework can be used with any Dynamixel or HerkuleX devices. Please note that the Dynamixel PRO serie has never been tested (because I have no testing devices).

* **Simple API:** Use this mode to get or set a value to a servo by sending a simple instruction and waiting for the answer.
* **Controller API:** Setup a controller and attach servo instances to it. Manipulate servo objects and let the controller sync its values with the actual servo hardware in a background thread with a fixed frequency.

### Documentation

You can dynamically generate an API documentation from the source code using Doxygen. The documentation will be generated inside the "doc" directory.
If you are running a Linux system you can easily generate the documentation from a terminal:
> $ cd SmartServoFramework/
> $ doxygen Doxyfile

### Example softwares

Various examples programs are available:

* ex_basic_test: Very simple example that move the servo at ID 0 with the 'UP' and 'DOWN' keys.
* ex_simple: Control four servos with your keyboard using the 'Simple API'.
* ex_simple_threaded: Control four servos with your keyboard using the 'Simple API', with servos actions and keyboard handled in two separate threads.
* ex_controller: Control four servos with your keyboard using the 'Controller API'.
* ex_sinus_control: Control a servo with sinusoid curve for both speed and position.
* ex_advance_scanner: Scan serial ports for Dynamixel servos, for all IDs and all (but configurable) serial port speeds.

### GUI software

SmartServoGui is a fully featured Qt GUI application that helps you discover devices on available serial links, get an overview of all of their registers, and easily changes their settings!

## Licensing

SmartServoFramework is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
[Consult the licence on the FSF website](http://www.gnu.org/licenses/lgpl-3.0.txt).

Copyright (c) 2014, INRIA, All rights reserved.
Emeric Grange <emeric.grange@gmail.com>
Dominique Vaufreydaz <dominique.vaufreydaz@inria.fr>
106 changes: 106 additions & 0 deletions SConstruct
@@ -0,0 +1,106 @@
# SmartServoFramwork build system
# Emeric Grange <emeric.grange@inria.fr>

# http://www.scons.org/
# http://www.scons.org/wiki/IDEIntegration

import sys
import subprocess
from distutils.version import StrictVersion


# Initialize the environment
###############################################################################

if ARGUMENTS.get('debug', 0):
print "> DEBUG build"
env = Environment(CCFLAGS = ' -g ')
else:
env = Environment(CCFLAGS = ' -O2 ')


# Multiplatform build
###############################################################################

if sys.platform.startswith('linux') == True:

print '> LINUX platform'
CC_VERSION = subprocess.check_output([env['CC'], "-dumpversion"]).strip('\n')
if env['CC'] == 'gcc':
print '> Gcc ' + CC_VERSION + ' compiler'
if StrictVersion(CC_VERSION) < StrictVersion('4.6'):
print 'You need at least GCC 4.6+ to use C++11 features!'
exit(0)
elif StrictVersion(CC_VERSION) < StrictVersion('4.8'):
# GCC 4.6 needs a different flag to enable C++11
env.Append(CCFLAGS = "-std=c++0x -pthread -Wno-unused-parameters ")
else:
env.Append(CCFLAGS = "-std=c++11 -pthread -Wno-unused-parameters ")
elif env['CC'] == 'clang':
print '> Clang ' + CC_VERSION + ' compiler'
env.Append(CCFLAGS = "-std=c++11 -Wno-unused-parameters ")
else:
print '> WARNING > Unknown compiler > ' + env['CC']
exit(0)

# Additional libraries
libraries = ['pthread']
libraries_paths = ['']

elif sys.platform.startswith('win') == True:

print '> WINDOWS platform'
if env['CC'] == 'MVS':
print '> Visual Studio compiler'
env.Append(CCFLAGS = "-std=c++11 ")
env.Append(tools = "msvc")
elif env['CC'] == 'gcc':
print '> MinGW compiler'
env.Append(CCFLAGS = "-std=c++11 -pthread -winpthreads -Wno-unused-parameters ")
else:
print '> WARNING > Unknown compiler > ' + env['CC']

# Additional libraries
libraries = ['']
libraries_paths = ['']

elif sys.platform == 'darwin':

print '> MAC OS platform'
if env['CC'] == 'gcc':
print '> Gcc compiler'
env.Append(CCFLAGS = "-std=c++11 -pthread -stdlib=libstdc++ ")
elif env['CC'] == 'clang':
print '> Clang compiler'
env.Append(CCFLAGS = "-std=c++11 -stdlib=libc++ ")
else:
print '> WARNING > Unknown compiler > ' + env['CC']

# Additional libraries
libraries = ['']
libraries_paths = ['']

else:
print '> WARNING > Unknown operating system > ' + sys.platform


# Source files
###############################################################################

src_framework = [env.Object("src/SerialPort.cpp"), env.Object("src/SerialPortLinux.cpp"), env.Object("src/SerialPortMacOS.cpp"), env.Object("src/SerialPortWindows.cpp"),
env.Object("src/ControlTables.cpp"), env.Object("src/Utils.cpp"), env.Object("src/ControllerAPI.cpp"),env.Object("src/Servo.cpp"),
env.Object("src/Dynamixel.cpp"), env.Object("src/DynamixelTools.cpp"), env.Object("src/DynamixelSimpleAPI.cpp"), env.Object("src/DynamixelController.cpp"),
env.Object("src/ServoDynamixel.cpp"), env.Object("src/ServoAX.cpp"), env.Object("src/ServoEX.cpp"), env.Object("src/ServoMX.cpp"), env.Object("src/ServoXL.cpp"),
env.Object("src/HerkuleX.cpp"), env.Object("src/HerkuleXTools.cpp"), env.Object("src/HerkuleXSimpleAPI.cpp"), env.Object("src/HerkuleXController.cpp"),
env.Object("src/ServoHerkuleX.cpp"), env.Object("src/ServoDRS.cpp")]


# Build examples
###############################################################################

env.Program(target = 'build/ex_basic_test', source = ["examples/ex_basic_test.cpp", src_framework])
env.Program(target = 'build/ex_simple', source = ["examples/ex_simple.cpp"] + src_framework)
env.Program(target = 'build/ex_simple_threaded', source = ["examples/ex_simple_threaded.cpp"] + src_framework, LIBS = libraries, LIBPATH = libraries_paths)
env.Program(target = 'build/ex_controller', source = ["examples/ex_controller.cpp"] + src_framework, LIBS = libraries, LIBPATH = libraries_paths)
env.Program(target = 'build/ex_sinus_control', source = ["examples/ex_sinus_control.cpp"] + src_framework, LIBS = libraries + ["opencv_core", "opencv_highgui"], LIBPATH = libraries_paths)
env.Program(target = 'build/ex_advance_scanner', source = ["examples/ex_advance_scanner.cpp"] + src_framework, LIBS = libraries, LIBPATH = libraries_paths)
Empty file added build/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions doc/doxygen.html
@@ -0,0 +1,5 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" CONTENT="0;URL=html/index.html">
</HEAD>
</HTML>

0 comments on commit 138a9d8

Please sign in to comment.