Skip to content

Commit f26b65c

Browse files
author
Alex
committed
remove uArm Action Control
1 parent 9c901f4 commit f26b65c

9 files changed

Lines changed: 520 additions & 544 deletions

File tree

examples/.DS_Store

0 Bytes
Binary file not shown.

examples/Calibration/Calibration.ino

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,39 @@
88
* Copyright(C) 2015 uArm Team. All right reserved.
99
*******************************************************************************************/
1010

11-
#include <Servo.h>
12-
#include <Wire.h>
11+
/*
12+
* Table of Content
13+
14+
* Function 1 - 4 : move to a certain point (f)
15+
* Fucntion 5 - 6 : move a Rectangle or a curve (function 5-6)
16+
* Function 7 - 8 : attach or detach all servos (function 7-8)
17+
* Function 9 : uArm calibration
18+
* Function 10 : read current coordinate x,y,z
19+
* Function 11 : recording mode
20+
21+
*/
22+
23+
// headers should must include these four headers
24+
1325
#include <EEPROM.h>
26+
#include <Wire.h>
27+
#include "uArm_library.h"
1428
#include "uArm_calibration.h"
15-
#include "uArm_Library.h"
29+
#include <Servo.h>
30+
31+
// define a uArm
32+
//uArmLibrary uArm;
33+
int value; // value is the data recevied
1634

1735
void setup() {
1836

1937
Wire.begin(); // join i2c bus (address optional for master)
20-
Serial.begin(9600); // start serial port at 9600 bps
38+
Serial.begin(9600); // start serial port at 9600 bps
39+
// uArm.init();
40+
2141
}
2242

43+
2344
void loop() {
2445

2546
if(Serial.available()>0)
@@ -28,13 +49,11 @@ void loop() {
2849
char readSerial = Serial.read();
2950
Serial.println(readSerial);
3051

52+
3153
if (readSerial == 'c') {
3254
calib.calibrations();
3355
}
34-
if (readSerial == 'r') {
35-
Serial.println(uarm.readServoOffset(SERVO_ROT_NUM));
36-
Serial.println(uarm.readServoOffset(SERVO_LEFT_NUM));
37-
Serial.println(uarm.readServoOffset(SERVO_RIGHT_NUM));
38-
}
56+
57+
3958
} // close read available
4059
}

examples/StandardUCP/StandardUCP.ino

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
// Firmata-UCP
1717
#include <EEPROM.h>
18+
#include "uarm_library.h"
1819
#include "ucp.h"
19-
#include "uarm_action_control.h"
20+
2021

2122

2223
void setup()
@@ -51,7 +52,7 @@ void sysexCallback(byte command, byte argc, byte *argv)
5152
short y = ucp.convertNumToCM(ucp.getValuesAsTwobitBytes(argv[3],argv[4]));
5253
short z = ucp.convertNumToCM(ucp.getValuesAsTwobitBytes(argv[5],argv[6]));
5354
short t = ucp.convertDMSToSec(ucp.getValuesAsTwobitBytes(argv[7],argv[8]));
54-
actionControl.moveTo(x,y,z,RELATIVE,t);
55+
uarm.moveTo(x,y,z,RELATIVE,t);
5556
if(ucp.debugMode)
5657
{
5758
// Serial.print("X is: ");
@@ -72,7 +73,7 @@ void sysexCallback(byte command, byte argc, byte *argv)
7273
short y = ucp.convertNumToCM(ucp.getValuesAsTwobitBytes(argv[3],argv[4]));
7374
short z = ucp.convertNumToCM(ucp.getValuesAsTwobitBytes(argv[5],argv[6]));
7475
short t = ucp.convertDMSToSec(ucp.getValuesAsTwobitBytes(argv[7],argv[8]));
75-
actionControl.moveTo(x,y,z,ABSOLUTE,t); //
76+
uarm.moveTo(x,y,z,ABSOLUTE,t); //
7677
if(ucp.debugMode)
7778
{
7879
// ucp.sendString("Debug Mode Test");
@@ -104,9 +105,9 @@ void sysexCallback(byte command, byte argc, byte *argv)
104105
case AC_PUMP:
105106
{
106107
if (argv[1] == UCP_SWITCH_ON)
107-
actionControl.gripperCatch();
108+
uarm.gripperCatch();
108109
else
109-
actionControl.gripperRelease();
110+
uarm.gripperRelease();
110111
break;
111112
}
112113
}

examples/Test/Test.ino

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <Wire.h>
2727
#include "uArm_library.h"
2828
#include "uArm_calibration.h"
29-
#include "uArm_action_control.h"
3029
#include <Servo.h>
3130

3231
// define a uArm
@@ -55,7 +54,7 @@ void loop() {
5554
// x = 13, y = -13, z = 3
5655

5756
if (readSerial == '1') {
58-
actionControl.moveTo(13,-13,3);
57+
uarm.moveTo(13,-13,3);
5958
// uArm.moveTo(13.0,13.0,3.0);
6059
delay(1000);
6160
}
@@ -65,7 +64,7 @@ void loop() {
6564
// x = -13, y = -13, z = 3
6665

6766
if (readSerial == '2') {
68-
actionControl.moveTo(-13,-13,3);
67+
uarm.moveTo(-13,-13,3);
6968
delay(1000);
7069
}
7170

@@ -74,7 +73,7 @@ void loop() {
7473
// (dot) dx = 4, dy = -3, dz = 2 in 5 seconds
7574

7675
if (readSerial == '3') {
77-
actionControl.moveTo(1,1,1,RELATIVE,2);
76+
uarm.moveTo(1,1,1,RELATIVE,2);
7877
delay(1000);
7978
}
8079

@@ -83,7 +82,7 @@ void loop() {
8382
// (dot) dx = -4, dy = 3, dz = -2 in 5 seconds
8483

8584
if (readSerial == '4') {
86-
actionControl.moveTo(-4,3,-2,RELATIVE,5);
85+
uarm.moveTo(-4,3,-2,RELATIVE,5);
8786
delay(1000);
8887
}
8988

@@ -92,7 +91,7 @@ void loop() {
9291
// width in 2 seconds for one arm ( 8s totally)
9392

9493
if (readSerial == '5') {
95-
actionControl.drawRec(10,5,2);
94+
uarm.drawRec(10,5,2);
9695
delay(1000);
9796
}
9897

@@ -101,7 +100,7 @@ void loop() {
101100
// width (circle) for full 360 degree in 2 seconds
102101

103102
if (readSerial == '6') {
104-
actionControl.drawCur(6,6,360,2);
103+
uarm.drawCur(6,6,360,2);
105104
delay(1000);
106105
}
107106

@@ -131,11 +130,11 @@ void loop() {
131130

132131
if (readSerial == 'g') {
133132
Serial.print("The current location is ");
134-
Serial.print(actionControl.getCalX());
133+
Serial.print(uarm.getCalX());
135134
Serial.print(" , ");
136-
Serial.print(actionControl.getCalY());
135+
Serial.print(uarm.getCalY());
137136
Serial.print(" , ");
138-
Serial.print(actionControl.getCalZ());
137+
Serial.print(uarm.getCalZ());
139138
Serial.println();
140139
delay(1000);
141140
}

examples/unpackage/unpackage.ino

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <EEPROM.h>
1313
#include <Wire.h>
1414
#include <uArm_library.h>
15-
#include <uArm_action_control.h>
1615
#include <Servo.h>
1716

1817
// headers need to be loaded first
@@ -53,7 +52,7 @@ void loop(){
5352
// first input a to the console to make sure uArm is located above the center of iphone box
5453
if(readSerial == 'a')
5554
{
56-
actionControl.moveTo(centerOfBox_x, centerOfBox_y, centerOfBox_z_case);
55+
uarm.moveTo(centerOfBox_x, centerOfBox_y, centerOfBox_z_case);
5756
}
5857

5958
// then you can input b to execute main functions
@@ -95,7 +94,7 @@ void loop(){
9594
// destination position x = -10, y = -11, z = 18;
9695
// rotation angle = 45 means the object need to be rotate 45 degree due to the rotation of base servo
9796

98-
actionControl.moveTo(centerOfBox_x, centerOfBox_y, centerOfBox_z_case); // finally, move back to initial position
97+
uarm.moveTo(centerOfBox_x, centerOfBox_y, centerOfBox_z_case); // finally, move back to initial position
9998
digitalWrite(6,LOW); // double check to disable the pump
10099
digitalWrite(5,LOW);
101100
}
@@ -111,13 +110,13 @@ void mainMove(double iniX, double iniY, double iniZ, double desX, double desY, d
111110
// desX, desY, desZ are the desitination of uArm
112111
// rotDeg is the rotation degree of end-effector to rotate the object
113112
{
114-
actionControl.moveTo(iniX,iniY,iniZ); // move the initial position
113+
uarm.moveTo(iniX,iniY,iniZ); // move the initial position
115114
absorbFcn(1,0, iniX, iniY , iniZ); // move end-effector downwards until stopper hit something, 1 means begin to absorb
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
115+
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)
116+
uarm.moveTo(desX,desY,desZ,0,2); // move the destination position
118117
absorbFcn(2,rotDeg,desX,desY,desZ); // move end-effector downwards until stopper hit something, 0 means disable the pump
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
118+
uarm.moveTo(0,0,5,1,4,rotDeg); // move the upwards in 4 seconds - slow upwards
119+
uarm.moveTo(desX,desY,desZ); // move to destination
121120
}
122121

123122

@@ -130,7 +129,7 @@ void absorbFcn(int trigger, int rotDeg, double currentX, double currentY, double
130129
buttonState = digitalRead(stopperPin); // if stopper hit anything, the reading would be LOW
131130
if(buttonState == HIGH) // while reading is HIGH, keep move downwards for 2 cm
132131
{
133-
actionControl.moveTo(currentX,currentY,currentZ,0,0.5,rotDeg);
132+
uarm.moveTo(currentX,currentY,currentZ,0,0.5,rotDeg);
134133
currentZ = currentZ - 2; // every time movedowards for 0.2 cm
135134
delay(50);
136135
}

0 commit comments

Comments
 (0)