Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp Robotic Arm(Servo Motors), Using a text file to input coordinates — Parallax Forums

Basic Stamp Robotic Arm(Servo Motors), Using a text file to input coordinates

Mr_FanaticMr_Fanatic Posts: 4
edited 2008-06-23 06:51 in BASIC Stamp

Hi guys, currently i'm experiment-testing a robotic arm, and I'm wondering if its possible to use a text file with coordinate values as input, instead of hard coding the coordinates in the script. This is a parallax basic stamp and runs on Hitec servo motors.

Here's a sample program and the highlighted part are the coordinates for the robot. Thanks[noparse]:)[/noparse]

channelValue VAR Word ' Rx channel value
servoPos VAR Word ' PSC servo position
ptrStream VAR Word ' Stream pointer
array VAR Byte(6) ' Servo positions (degrees)
lowerConstr VAR Byte ' lower angle constraint
upperConstr VAR Byte ' upper angle constraint
ramp VAR Byte ' servo rotation speed
delay VAR Byte ' Pause
pscChannel VAR Nib ' PSC channel
RxChannels VAR Nib ' Receiver channel
RC VAR Bit ' Rx On/Off

ctrlByte VAR Byte ' Servo joint(s) updated
baseBit VAR ctrlByte.BIT0 ' 0 = no change
bicepBit VAR ctrlByte.BIT1 ' 1 = joint value changed
elbowBit VAR ctrlByte.BIT2
wristBit VAR ctrlByte.BIT3
wristRotateBit VAR ctrlByte.BIT4
gripperBit VAR ctrlByte.BIT5


' base bicep elbow wrist wristR gripper
PUT Constraints, 0,180, 100,140, 60,150, 0,170, 0,180, 100,170



' Bse Bcpt elbw wrst wrstR grppr dly ctrlByte
Stream DATA 0, 100, 100, 70, 90, 150, 0, %00101111,
0, 100, 150, 70, 90, 150, 20, %00000001,
0, 90, 20, 60, 90, 150, 0, %00101110,
0, 85, 20, 60, 90, 50, 0, %00100010,
0, 100, 20, 70, 90, 50, 10, %00101100,
120, 100, 80, 70, 90, 50, 10, %00001111,
120, 100, 80, 70, 90, 50, 10, %00001110,
120, 100, 80, 70, 90, 50, 0, %00001111,
60, 100, 100, 70, 90, 50, 10, %00000001,
60, 85, 20, 60, 90, 50, 10, %00001111,
60, 85, 20, 60, 90, 150, 10, %00100000,
0, 100, 100, 70, 90, 150, 0, %00001111,
$FF 'END


#DEFINE debugMode = 0
ramp = $5

Main:
GOSUB IGet_Stream ' Get data
PAUSE 100 ' Pause before repeating
GOTO Main

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I thins i'm a genius, I think...

Sign In or Register to comment.