FUZE powered Raspberry Pi with Robot Arm kit available on Amazon right now. |
Check it out on Amazon: FUZE powered by Raspberry Pi (RPi V2) - FUZE-T2-R Teach Kids to Code Unit English Keyboard with Printed Project Cards & Robot Arm Kit - Black/Red
Thanks very much to Nathan and Sam for assembling the two arms.
The FUZE computer is very similar in feel to the old BBC Microcomputer, but it is a Raspberry Pi under the hood. It does all the usual Raspberry Pi things with the addition of FUZE BASIC pre-installed: a dialect of BASIC that allows you to program the robot arms. The feel of the user guide is very similar to the old BBC Microcomputer user manual.
The robot arms have five motors that can be activated individually. These motors control the rotation of the base, the shoulder joints, elbow, the wrist and the gripper. You can program it to pick up objects and move them around. One project I intend to do is to use one of my robots as an automatic air freshener. Every few hours the gripper will squeeze a can of freshener into the room.
Code to control the robot arm
When you first get your robot set up you will want to start to control it. The code that comes with the FUZE BASIC instruction book is rather limited. I wanted finer control over the start and stop of the motors as well as the ability to control several of the machine's motors at once.
Presented here is my first attempt at some control code for the robot should it be of use to anyone.
You use the cursor keys to control the body and shoulder; Q/A/W/S for the wrist and elbow; Z/X for the gripper; ENTER to toggle the light, and SPACE for 'emergency stop' (you will need it!). Type the program into the FUZE BASIC editor, or copy from this page and save it as 'robot.fuze'. If in doubt contact me and I'll send you the file for your pi.
REM version 1.0.0.3
PROC resetArm
PROC displayInstructions
leftBodyOn = FALSE
rightBodyOn = FALSE
upShoulderOn = FALSE
downShoulderOn = FALSE
upElbowOn = FALSE
downElbowOn = FALSE
upWristOn = FALSE
downWristOn = FALSE
openGripperOn = FALSE
closeGripperOn = FALSE
lightOn = FALSE
CYCLE
key = INKEY
SWITCH (key)
REM right cursor - move body right
CASE 331
IF rightBodyOn THEN
armBody (0)
rightBodyOn = FALSE
ELSE
armBody (1)
rightBodyOn = TRUE
ENDIF
ENDCASE
REM left cursor - move body left
CASE 330
IF leftBodyOn THEN
armBody (0)
leftBodyOn = FALSE
ELSE
armBody (-1)
leftBodyOn = TRUE
ENDIF
ENDCASE
REM space - reset
CASE 32
PROC resetArm
ENDCASE
REM up cursor - move shoulder up
CASE 332
IF upShoulderOn THEN
armShoulder (0)
upShoulderOn = FALSE
ELSE
armShoulder (1)
upShoulderOn = TRUE
ENDIF
ENDCASE
REM down cursor - move shoulder down
CASE 333
IF downShoulderOn THEN
armShoulder (0)
downShoulderOn = FALSE
ELSE
armShoulder (-1)
downShoulderOn = TRUE
ENDIF
ENDCASE
REM W - move elbow up
CASE 87, 119
IF upElbowOn THEN
armElbow (0)
upElbowOn = FALSE
ELSE
armElbow (1)
upElbowOn = TRUE
ENDIF
ENDCASE
REM S - move elbow down
CASE 83, 115
IF downElbowOn THEN
armElbow (0)
downElbowOn = FALSE
ELSE
armElbow (-1)
downElbowOn = TRUE
ENDIF
ENDCASE
REM Q - move wrist up
CASE 81, 113
IF upWristOn THEN
armWrist (0)
upWristOn = FALSE
ELSE
armWrist (1)
upWristOn = TRUE
ENDIF
ENDCASE
REM A - move wrist down
CASE 65, 97
IF downWristOn THEN
armWrist (0)
downWristOn = FALSE
ELSE
armWrist (-1)
downWristOn = TRUE
ENDIF
ENDCASE
REM Z - close gripper
CASE 88, 120
IF closeGripperOn THEN
armGripper (0)
closeGripperOn = FALSE
ELSE
armGripper (-1)
closeGripperOn = TRUE
ENDIF
ENDCASE
REM X - open Gripper
CASE 90, 122
IF openGripperOn THEN
armGripper (0)
openGripperOn = FALSE
ELSE
armGripper (1)
openGripperOn = TRUE
ENDIF
ENDCASE
REM ENTER - light on/off
CASE 13
IF lightOn THEN
armLight (0)
lightOn = FALSE
ELSE
armLight (1)
lightOn = TRUE
ENDIF
ENDCASE
ENDSWITCH
REPEAT
STOP
DEF PROC resetArm
armBody (0)
armShoulder (0)
armElbow (0)
armWrist (0)
armGripper (0)
armLight (0)
ENDPROC
DEF PROC displayInstructions
CLS
fontScale (2, 2)
INK = Red
PRINT "The Robots are revolting!"
INK = White
hvTab (0, 2)
INK = Green
PRINT "BODY and SHOULDER"
INK = White
PRINT "Cursor keys"
PRINT
INK = Green
PRINT "WRIST up/down"
INK = White
PRINT "Q/A"
PRINT
INK = Green
PRINT "ELBOW up/down"
INK = White
PRINT "W/S"
PRINT
INK = Green
PRINT "GRIPPER close/open"
INK = White
PRINT "Z/X"
PRINT
INK = Green
PRINT "LIGHT on/off"
INK = White
PRINT "ENTER"
PRINT
INK = Green
PRINT "EMERGENCY STOP"
INK = White
PRINT "SPACE"
PRINT
ENDPROC
No comments:
Post a Comment