1111
1212#include < EEPROM.h>
1313#include < Wire.h>
14- #include < UF_uArm_Metal_new.h>
14+ #include < uArm_library.h>
15+ #include < uArm_action_control.h>
1516#include < Servo.h>
1617
1718// headers need to be loaded first
1819
19- UF_uArm uarm;
2020
2121int valuel;
2222int buttonState;
@@ -36,7 +36,7 @@ void setup() {
3636
3737 Wire.begin (); // join i2c bus (address optional for master)
3838 Serial.begin (9600 ); // start serial port at 9600 bps
39- uarm.init ();
39+ // uarm.init();
4040
4141}
4242
@@ -53,7 +53,7 @@ void loop(){
5353 // first input a to the console to make sure uArm is located above the center of iphone box
5454 if (readSerial == ' a' )
5555 {
56- uarm .moveTo (centerOfBox_x, centerOfBox_y, centerOfBox_z_case);
56+ actionControl .moveTo (centerOfBox_x, centerOfBox_y, centerOfBox_z_case);
5757 }
5858
5959 // then you can input b to execute main functions
@@ -95,7 +95,7 @@ void loop(){
9595 // destination position x = -10, y = -11, z = 18;
9696 // rotation angle = 45 means the object need to be rotate 45 degree due to the rotation of base servo
9797
98- uarm .moveTo (centerOfBox_x, centerOfBox_y, centerOfBox_z_case); // finally, move back to initial position
98+ actionControl .moveTo (centerOfBox_x, centerOfBox_y, centerOfBox_z_case); // finally, move back to initial position
9999 digitalWrite (6 ,LOW ); // double check to disable the pump
100100 digitalWrite (5 ,LOW );
101101 }
@@ -111,13 +111,13 @@ void mainMove(double iniX, double iniY, double iniZ, double desX, double desY, d
111111 // desX, desY, desZ are the desitination of uArm
112112 // rotDeg is the rotation degree of end-effector to rotate the object
113113{
114- uarm .moveTo (iniX,iniY,iniZ); // move the initial position
114+ actionControl .moveTo (iniX,iniY,iniZ); // move the initial position
115115 absorbFcn (1 ,0 , iniX, iniY , iniZ); // move end-effector downwards until stopper hit something, 1 means begin to absorb
116- uarm .moveTo (0 ,0 ,10 ,1 ,6 ); // move upwards for 10 cm in 6 seconds - slow upwards (relative = 1, means only move in the z axis)
117- uarm .moveTo (desX,desY,desZ,0 ,2 ); // move the destination position
116+ actionControl .moveTo (0 ,0 ,10 ,1 ,6 ); // move upwards for 10 cm in 6 seconds - slow upwards (relative = 1, means only move in the z axis)
117+ actionControl .moveTo (desX,desY,desZ,0 ,2 ); // move the destination position
118118 absorbFcn (2 ,rotDeg,desX,desY,desZ); // move end-effector downwards until stopper hit something, 0 means disable the pump
119- uarm .moveTo (0 ,0 ,5 ,1 ,4 ,rotDeg); // move the upwards in 4 seconds - slow upwards
120- uarm .moveTo (desX,desY,desZ); // move to destination
119+ actionControl .moveTo (0 ,0 ,5 ,1 ,4 ,rotDeg); // move the upwards in 4 seconds - slow upwards
120+ actionControl .moveTo (desX,desY,desZ); // move to destination
121121}
122122
123123
@@ -130,7 +130,7 @@ void absorbFcn(int trigger, int rotDeg, double currentX, double currentY, double
130130 buttonState = digitalRead (stopperPin); // if stopper hit anything, the reading would be LOW
131131 if (buttonState == HIGH ) // while reading is HIGH, keep move downwards for 2 cm
132132 {
133- uarm .moveTo (currentX,currentY,currentZ,0 ,0.5 ,rotDeg);
133+ actionControl .moveTo (currentX,currentY,currentZ,0 ,0.5 ,rotDeg);
134134 currentZ = currentZ - 2 ; // every time movedowards for 0.2 cm
135135 delay (50 );
136136 }
0 commit comments