Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otScorpio Class Reference
[SCORPIO - A six-legged insect robotSCORPIO - A six-legged insect robot]

A six-legged insect robot driver.

#include <otScorpio.h>

Inheritance diagram for otScorpio:

otPWM

Public Types

typedef otScorpio::Side Side
 Side selection.
typedef otScorpio::Action Action
 Action selection.
typedef otScorpio::Direction Direction
 Direction select.
typedef otScorpio::Turn Turn
 Select turn direction.
typedef otScorpio::Actions Actions
 Select an ction.
enum  Side { LEFT = true, RIGHT = false }
enum  Action { ANGLE, LEVEL }
enum  Direction { FORWARD = -1, BACKWARD = 1 }
enum  Turn { T_LEFT = true, T_RIGHT = false }
enum  Actions { ACT_NO, ACT_MOVE, ACT_TURN }

Public Member Functions

 otScorpio ()
bool init (U8 timerId, U8 addr=0x40)
void setDelay (U16 val)
void setServoId (Side side, Action action, U16 id, U16 value)
void setLevelOffset (Side side, U16 id, S16 value)
void setAngleOffset (Side side, U16 id, S16 value)
int getServoAngle (Side side, int id)
int getServoLevel (Side side, int id)
void setAngle (Side side, int id, int value)
void setLevel (Side side, int id, int value)
void setLevel (U16 left1, U16 right1, U16 left2, U16 right2, U16 left3, U16 right3)
void setAngle (S16 left1, S16 right1, S16 left2, S16 right2, S16 left3, S16 right3)
void clearAngle ()
void setLevel (U16 value)
void move (Direction direction, int lvl, int delay)
void turn (Turn direction, int ang, int lvl, int delay)
void setAction (Actions action, S16 param0=0, int ang=30, int lvl=20)
bool completed (bool loop=true)
void abort ()
void process ()

Member Typedef Documentation

typedef otScorpio::Action otScorpio.Action
 

typedef otScorpio::Actions otScorpio.Actions
 

typedef otScorpio::Direction otScorpio.Direction
 

typedef otScorpio::Side otScorpio.Side
 

typedef otScorpio::Turn otScorpio.Turn
 


Member Enumeration Documentation

enum otScorpio::Action
 

Enumeration values:
ANGLE  Select angle action.
LEVEL  Select level action.

enum otScorpio::Actions
 

Enumeration values:
ACT_NO  Action disabled.
ACT_MOVE  Move (walk) action.
ACT_TURN  Turn action.

enum otScorpio::Direction
 

Enumeration values:
FORWARD  Select forward direction.
BACKWARD  Select backward direction.

enum otScorpio::Side
 

Enumeration values:
LEFT  Select left side.
RIGHT  Select right side.

enum otScorpio::Turn
 

Enumeration values:
T_LEFT  Turn to left.
T_RIGHT  Turn to right.


Constructor & Destructor Documentation

otScorpio.otScorpio  ) 
 

Create the class.


Member Function Documentation

void otScorpio.abort  ) 
 

Abort immediately current action.

void otScorpio.clearAngle  ) 
 

Set to 0 degree all angle servos

bool otScorpio.completed bool  loop = true  ) 
 

Check if the requested action is done

Parameters:
loop If true is a blocking method, it wait the action to be complete
Returns:
True on complete

int otScorpio.getServoAngle Side  side,
int  id
 

Read current angle

Parameters:
side Specify in wich side is located the servo see Side
id Specify wich leg, values 1 to 3
Returns:
Angle as degree

int otScorpio.getServoLevel Side  side,
int  id
 

Read current level

Parameters:
side Specify in wich side is located the servo see Side
id Specify wich leg, values 1 to 3
Returns:
Level as mm

bool otScorpio.init U8  timerId,
U8  addr = 0x40
 

Init the class

Parameters:
timerId Timer identifier used for sync
addr PWM peripheral address
Returns:
True on success

Reimplemented from otPWM.

void otScorpio.move Direction  direction,
int  lvl,
int  delay
 

Move action. This a blocking method return only on completed action.

Parameters:
direction Move direction see Direction
lvl Level (mm) used in this movement
delay Delay as ms used action sync

void otScorpio.process  ) 
 

Process request action

void otScorpio.setAction Actions  action,
S16  param0 = 0,
int  ang = 30,
int  lvl = 20
 

Set a specific action that will be performed by continuous calls to the process method

Parameters:
action Requested action see Actions
param0 Optional parameter for specified action
ang Swing angle used for specified action, as degree
lvl Used level for specified action as mm

void otScorpio.setAngle S16  left1,
S16  right1,
S16  left2,
S16  right2,
S16  left3,
S16  right3
 

Broadcast angle set

Parameters:
left1 Angle as degree on LEFT side servo 1
right1 Angle as degree on RIGHT side servo 1
left2 Angle as degree on LEFT side servo 2
right2 Angle as degree on RIGHT side servo 2
left3 Angle as degree on LEFT side servo 3
right3 Angle as degree on RIGHT side servo 3
 setAngle(ang,   0,
            0, ang,
          ang,   0);

void otScorpio.setAngle Side  side,
int  id,
int  value
 

Place a specified servo at an angle

Parameters:
side Specify in wich side is located the servo see Side
id Specify wich leg, values 1 to 3
value Angle degree

void otScorpio.setAngleOffset Side  side,
U16  id,
S16  value
 

Specifies an offset for the specified angle servo

Parameters:
side Specify in wich side is located the servo see Side
id Specify wich leg, values 1 to 3
value Offset value as degree

void otScorpio.setDelay U16  val  ) 
 

Interleave delay for leg actions.

Parameters:
val Delay as ms

void otScorpio.setLevel U16  value  ) 
 

Set to specified value all level servos

Parameters:
value Level value as mm

void otScorpio.setLevel U16  left1,
U16  right1,
U16  left2,
U16  right2,
U16  left3,
U16  right3
 

Broadcast level set

Parameters:
left1 Level as mm on LEFT side servo 1
right1 Level as mm on RIGHT side servo 1
left2 Level as mm on LEFT side servo 2
right2 Level as mm on RIGHT side servo 2
left3 Level as mm on LEFT side servo 3
right3 Level as mm on RIGHT side servo 3
 setLevel(lvl,   0,
            0, lvl,
          lvl,   0);

void otScorpio.setLevel Side  side,
int  id,
int  value
 

Place a specified servo at an level

Parameters:
side Specify in wich side is located the servo see Side
id Specify wich leg, values 1 to 3
value Level as mm

void otScorpio.setLevelOffset Side  side,
U16  id,
S16  value
 

Specifies an offset for the specified level servo

Parameters:
side Specify in wich side is located the servo see Side
id Specify wich leg, values 1 to 3
value Offset value as mm

void otScorpio.setServoId Side  side,
Action  action,
U16  id,
U16  value
 

Associate a PWM output (0-15) used for controlling a servo to its location in the model.

Parameters:
side Specify in wich side is located the servo see Side
action Specify the use of selected servo see Action
id Specify wich leg, values 1 to 3
value PWM output 0 to 15

void otScorpio.turn Turn  direction,
int  ang,
int  lvl,
int  delay
 

Turn action. This a blocking method return only on completed action.

Parameters:
direction Turn direction see Turn
ang Angle degree used for the movement
lvl Level (mm) used in this movement
delay Delay as ms used action sync


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0