#include <uarm_library.h>

Public Member Functions

 uArmClass ()
 
double read_servo_offset (byte servo_num)
 Read Servo Offset from EEPROM. From OFFSET_START_ADDRESS, each offset occupy 4 bytes in rom. More...
 
void read_linear_offset (byte servo_num, double &intercept_val, double &slope_val)
 read Linear Offset from EEPROM, From LINEAR_INTERCEPT_START_ADDRESS & LINEAR_SLOPE_START_ADDRESS, each offset occupy 4 bytes in rom More...
 
void alert (byte times, byte runt_time, byte stop_time)
 Use BUZZER for Alert. More...
 
void write_servo_angle (byte servo_num, double servo_angle, boolean with_offset)
 Write the angle to Servo. More...
 
void write_left_right_servo_angle (double servo_left_angle, double servo_right_angle, boolean with_offset)
 Write the left Servo & Right Servo in the same time (Avoid demage the Servo) More...
 
double read_servo_angle (byte servo_num)
 read Angle by servo_num without offset More...
 
double read_servo_angle (byte servo_num, boolean with_offset)
 read Angle by servo_num More...
 
double analog_to_angle (int input_angle, byte servo_num, boolean with_offset)
 Convert the Analog to Servo Angle, by this formatter, angle = intercept + slope * analog. More...
 
int move_to (double x, double y, double z, double hand_angle, byte relative_flags, double time, byte path_type, byte ease_type, boolean enable_hand)
 Move To, Action Control Core Function. More...
 
void move_to (double x, double y, double z)
 
void move_to (double x, double y, double z, double hand_angle)
 
void move_to (double x, double y, double z, int relative, double time)
 
void move_to (double x, double y, double z, int relative, double time, double servo_4_angle)
 
void move_to (double x, double y, double z, int relative, double time, int servo_4_relative, double servo_4_angle)
 
void move_to_at_once (double x, double y, double z)
 
void move_to_at_once (double x, double y, double z, int relative, double servo_4_angle)
 
void write_stretch_height (double stretch, double height)
 Write Sretch & Height. This is an old control method to uArm. Using uarm's Stretch and height, , Height from -180 to 150. More...
 
double get_current_x ()
 
double get_current_y ()
 
double get_current_z ()
 
void get_current_xyz ()
 Calculate X,Y,Z to g_current_x,g_current_y,g_current_z. More...
 
void get_current_xyz (double theta_1, double theta_2, double theta_3)
 Calculate X,Y,Z to g_current_x,g_current_y,g_current_z. More...
 
void angle_to_coordinate (double &x, double &y, double &z)
 
void angle_to_coordinate (double theta_1, double theta_2, double theta_3, double &x, double &y, double &z)
 
void coordinate_to_angle (double x, double y, double z, double &theta_1, double &theta_2, double &theta_3)
 Calculate the angles from given coordinate x, y, z to theta_1, theta_2, theta_3. More...
 
void gripper_catch ()
 Close Gripper. More...
 
void gripper_release ()
 Release Gripper. More...
 
void interpolate (double start_val, double end_val, double *interp_vals, byte ease_type)
 "Genernate the position array" More...
 
void pump_on ()
 Turn on Pump. More...
 
void pump_off ()
 Turn off Pump. More...
 
int write_servo_angle (byte servo_rot_angle, byte servo_left_angle, byte servo_right_angle, byte servo_hand_rot_angle, byte trigger)
 
int write_servo_angle (double servo_rot_angle, double servo_left_angle, double servo_right_angle, double servo_hand_rot_angle)
 Write 4 Servo Angles, servo_rot, servo_left, servo_right, servo_hand_rot. More...
 
int write_servo_angle (double servo_rot_angle, double servo_left_angle, double servo_right_angle)
 Write 3 Servo Angles, servo_rot, servo_left, servo_right. More...
 
boolean set_servo_status (boolean attach_state, byte servo_num)
 Attach Servo, if servo has not been attached, attach the servo, and read the current Angle. More...
 
void init ()
 

Public Attributes

unsigned int INTERP_INTVLS
 

Protected Member Functions

double angle_to_coordinate_y (double theta_1, double theta_2, double theta_3)
 Calculate Y. More...
 

Protected Attributes

double cur_rot
 
double cur_left
 
double cur_right
 
double cur_hand
 
double g_current_x
 
double g_current_y
 
double g_current_z
 
boolean g_gripper_reset
 

Constructor & Destructor Documentation

uArmClass::uArmClass ( )

Member Function Documentation

void uArmClass::alert ( byte  times,
byte  runTime,
byte  stopTime 
)

Use BUZZER for Alert.

Parameters
timesBeep Times
runTimeHow Long from High to Low
stopTimeHow Long from Low to High
Examples:
movement.ino, and UArmProtocol.ino.
double uArmClass::analog_to_angle ( int  input_analog,
byte  servo_num,
boolean  withOffset 
)

Convert the Analog to Servo Angle, by this formatter, angle = intercept + slope * analog.

Parameters
input_analogAnalog Value
servo_numSERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
withOffsettrue, false
Returns
Return Servo Angle
void uArmClass::angle_to_coordinate ( double &  x,
double &  y,
double &  z 
)
inline
void uArmClass::angle_to_coordinate ( double  theta_1,
double  theta_2,
double  theta_3,
double &  x,
double &  y,
double &  z 
)
inline
double uArmClass::angle_to_coordinate_y ( double  theta_1,
double  theta_2,
double  theta_3 
)
protected

Calculate Y.

Parameters
theta_1
theta_2
theta_3
Returns
Y Axis Value
void uArmClass::coordinate_to_angle ( double  x,
double  y,
double  z,
double &  theta_1,
double &  theta_2,
double &  theta_3 
)

Calculate the angles from given coordinate x, y, z to theta_1, theta_2, theta_3.

Calculate the angles from given coordinate x, y, z to theta_1, theta_2, theta_3

Parameters
xX axis
yY axis
zZ axis
theta_1SERVO_ROT_NUM servo angles
theta_2SERVO_LEFT_NUM servo angles
theta_3SERVO_RIGHT_NUM servo angles
double uArmClass::get_current_x ( )
inline
void uArmClass::get_current_xyz ( )

Calculate X,Y,Z to g_current_x,g_current_y,g_current_z.

Examples:
GettingStarted.ino, and UArmProtocol.ino.
void uArmClass::get_current_xyz ( double  theta_1,
double  theta_2,
double  theta_3 
)

Calculate X,Y,Z to g_current_x,g_current_y,g_current_z.

double uArmClass::get_current_y ( )
inline
double uArmClass::get_current_z ( )
inline
void uArmClass::gripper_catch ( )

Close Gripper.

Examples:
UArmProtocol.ino.
void uArmClass::gripper_release ( )

Release Gripper.

Examples:
UArmProtocol.ino.
void uArmClass::init ( )
Examples:
UArmProtocol.ino.
void uArmClass::interpolate ( double  start_val,
double  end_val,
double *  interp_vals,
byte  ease_type 
)

"Genernate the position array"

Parameters
start_valStart Position
end_valEnd Position
interp_valsinterpolation array
ease_typeINTERP_EASE_INOUT_CUBIC, INTERP_LINEAR, INTERP_EASE_INOUT, INTERP_EASE_IN, INTERP_EASE_OUT
int uArmClass::move_to ( double  x,
double  y,
double  z,
double  hand_angle,
byte  relative_flags,
double  time,
byte  path_type,
byte  ease_type,
boolean  enable_hand 
)

Move To, Action Control Core Function.

Parameters
xX Axis Value
yY Axis Value
zZ Axis Value
hand_angleHand Axis
relative_flagsABSOLUTE, RELATIVE
path_typePATH_LINEAR, PATH_ANGLES
enable_handEnable Hand Axis
Returns
SUCCESS, FAILED
Examples:
GettingStarted.ino, movement.ino, and UArmProtocol.ino.
void uArmClass::move_to ( double  x,
double  y,
double  z 
)
inline
void uArmClass::move_to ( double  x,
double  y,
double  z,
double  hand_angle 
)
inline
void uArmClass::move_to ( double  x,
double  y,
double  z,
int  relative,
double  time 
)
inline
void uArmClass::move_to ( double  x,
double  y,
double  z,
int  relative,
double  time,
double  servo_4_angle 
)
inline
void uArmClass::move_to ( double  x,
double  y,
double  z,
int  relative,
double  time,
int  servo_4_relative,
double  servo_4_angle 
)
inline
void uArmClass::move_to_at_once ( double  x,
double  y,
double  z 
)
inline
void uArmClass::move_to_at_once ( double  x,
double  y,
double  z,
int  relative,
double  servo_4_angle 
)
inline
void uArmClass::pump_off ( )

Turn off Pump.

Examples:
GettingStarted.ino, and UArmProtocol.ino.
void uArmClass::pump_on ( )

Turn on Pump.

Examples:
GettingStarted.ino, and UArmProtocol.ino.
void uArmClass::read_linear_offset ( byte  servo_num,
double &  intercept_val,
double &  slope_val 
)

read Linear Offset from EEPROM, From LINEAR_INTERCEPT_START_ADDRESS & LINEAR_SLOPE_START_ADDRESS, each offset occupy 4 bytes in rom

Parameters
servo_numSERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
intercept_valget intercept_val
slope_valget slope_val
double uArmClass::read_servo_angle ( byte  servo_num)

read Angle by servo_num without offset

Parameters
servo_numSERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
Returns
Return servo_num Angle
Examples:
UArmProtocol.ino.
double uArmClass::read_servo_angle ( byte  servo_num,
boolean  withOffset 
)

read Angle by servo_num

Parameters
servo_numSERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
withOffsettrue, false
Returns
Return servo_num Angle
double uArmClass::read_servo_offset ( byte  servo_num)

Read Servo Offset from EEPROM. From OFFSET_START_ADDRESS, each offset occupy 4 bytes in rom.

Parameters
servo_numSERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
Returns
Return servo offset
Examples:
GettingStarted.ino.
boolean uArmClass::set_servo_status ( boolean  setAttached,
byte  servoNum 
)

Attach Servo, if servo has not been attached, attach the servo, and read the current Angle.

Parameters
servonumber SERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
Examples:
GettingStarted.ino, movement.ino, and UArmProtocol.ino.
void uArmClass::write_left_right_servo_angle ( double  servo_left_angle,
double  servo_right_angle,
boolean  writeWithoffset 
)

Write the left Servo & Right Servo in the same time (Avoid demage the Servo)

Parameters
servo_left_angleleft servo target angle
servo_right_angleright servo target angle
writeWithoffsetTrue: with Offset, False: without Offset
Examples:
UArmProtocol.ino.
void uArmClass::write_servo_angle ( byte  servo_number,
double  servo_angle,
boolean  writeWithoffset 
)

Write the angle to Servo.

Parameters
servo_numberSERVO_ROT_NUM, SERVO_LEFT_NUM, SERVO_RIGHT_NUM, SERVO_HAND_ROT_NUM
servo_angleServo target angle, 0.00 - 180.00
writeWithoffsetTrue: with Offset, False: without Offset
Examples:
UArmProtocol.ino.
int uArmClass::write_servo_angle ( byte  servo_rot_angle,
byte  servo_left_angle,
byte  servo_right_angle,
byte  servo_hand_rot_angle,
byte  trigger 
)
int uArmClass::write_servo_angle ( double  servo_rot_angle,
double  servo_left_angle,
double  servo_right_angle,
double  servo_hand_rot_angle 
)

Write 4 Servo Angles, servo_rot, servo_left, servo_right, servo_hand_rot.

Parameters
servo_rot_angleSERVO_ROT_NUM
servo_left_angleSERVO_LEFT_NUM
servo_right_angleSERVO_RIGHT_NUM
servo_hand_rot_angleSERVO_HAND_ROT_NUM
Returns
SUCCESS, FAILED
int uArmClass::write_servo_angle ( double  servo_rot_angle,
double  servo_left_angle,
double  servo_right_angle 
)

Write 3 Servo Angles, servo_rot, servo_left, servo_right.

Parameters
servo_rot_angleSERVO_ROT_NUM
servo_left_angleSERVO_LEFT_NUM
servo_right_angleSERVO_RIGHT_NUM
Returns
SUCCESS, FAILED
void uArmClass::write_stretch_height ( double  armStretch,
double  armHeight 
)

Write Sretch & Height. This is an old control method to uArm. Using uarm's Stretch and height, , Height from -180 to 150.

Parameters
armStretchStretch from 0 to 195
armHeightHeight from -150 to 150
Examples:
UArmProtocol.ino.

Member Data Documentation

double uArmClass::cur_hand
protected
double uArmClass::cur_left
protected
double uArmClass::cur_right
protected
double uArmClass::cur_rot
protected
double uArmClass::g_current_x
protected
double uArmClass::g_current_y
protected
double uArmClass::g_current_z
protected
boolean uArmClass::g_gripper_reset
protected
unsigned int uArmClass::INTERP_INTVLS

The documentation for this class was generated from the following files: