Motion - Motion Tracker Servo API
You are here: Foswiki>Motion Web>MotionTracking>MotionTrackerServoAPI (02 Jul 2008, AngelCarpintero)Edit Attach
-- RifRaf - 02 Jul 2008

Serial Servo motor interface API

*Subject: API for controlling a serial servo motor
*Version: 0.1
*Status: initial
*Author: RifRaf
*Date: 02-07-08

Introduction

This is the API for servo motors controller connected to a standard serial port.
The protocol is designed to allow the control of multiple (up to 256) independand motors.

API

This API builds on the MotionTrackerStepperAPI to provide extra commands for hobby servo motors.

The interface works at a fixed baudrate of 9600bps. Each command will consist of three bytes. After each command the interface will return a status byte. Where needed counting will start at zero.

Build-up of a command:
  • byte0 will contain the motor number. Usually zero.
  • byte1 will contain the command. A list of valid commands is given later on in this document.
  • byte2 will contain additional data for this command.


Build-up of the status byte:
  • bit0 will signal if the servo motor turns left.
  • bit1 will signal if the servo motor turns right.
  • bit2 indicates that the motor is at the mixx position.
  • bit3 indicates that the motor is at the maxx position.
  • bit4 - bit7 these bits are not used and shall be zero.


These are the valid commands:
  • 0 STATUS
    Nothing will happen, just the status byte will be returned. The data byte will be ignored.
  • 1 LEFT_N
    The servo motor will make N steps to the left unless it reachs minx position.
    The data byte will contain N.
  • 2 RIGHT_N
    The servo motor will make N steps to the right unless it reachs maxx position.
    The data byte will contain N.
  • 3 LEFT
    The servo motor will continuously turn left until it reaches minx position.
    The data byte is ignored.
  • 4 RIGHT
    The servo motor will continuously turn right until it reaches maxx position.
    The data byte is ignored.
  • 5 SWEEP
    The servo will start making a sweeping movement.
    The data byte is ignored.
  • 6 STOP
    The motor will stop moving.
    The data byte is ignored.
  • 7 SPEED
    This command controls the speed of the motor, 0 is the slowest, 255 the fastest.
  • 8 ABSOLUTE
    The Servo will move to the absolute position defined by the data byte.
  • 9 POSITION
    The Servo will get to the absolute position defined by the data byte.

Note that motion does not use all of these commands, implementing a subset of these commands will also work.
Topic revision: r3 - 02 Jul 2008, AngelCarpintero
Copyright © 1999-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.