Snapper Arm Wii Classic Controller Demo

wiiSnapperArm.jpg
mt_ignore
Direct Control
mt_ignore
Pose Control

This demo shows how to control the Snapper robot arm using a Wii Classic Controller in three separate modes, Backhoe (direct servo control), Cartesian (x/y/z coordinates), or Cylindrical.

Project Parts List:

This project can also be done with the RobotGeek Snapper Core Arm and the RobotGeek Wii Classic Controller Kit , assuming that you have your own microcontroller, power supply and wiring.

Arm Placement and Setup:

Whenever you program the Snapper arm, you should first manually position the servos in the sleep configuration. This will make the transition from off to on for the arm smoother.

When working with the arm, we recommend that you weigh it down / secure it to the surface you are working on. This will stop the arm from falling over due to sudden movements on startup. Make sure there is plenty of room around the arm so that it will not hit anything.

If you're arm shows movement during programming, you can remove the shield or remover the power jumpers during programming.

The arm should never be powered by USB alone. Always connect the DC power before you connect in the USB cable, and disconnect the USB cable before you disconnect the power. If you want to power down the arm but leave the USB plugged in, remove the power jumpers.

Durign operation, if your arm contorts, collides or otherwise curls in on itself, remove power and usb immediately.

It's normal to hear a buzzing noise coming from one or more of the servos during operation.

Wiring

Device Sensor Shield Port
Servos
Base Rotation RobotGeek Servo Digital 3
Shoulder RobotGeek Servo Digital 5
Elbow RobotGeek Servo Digital 6
Wrist RobotGeek Servo Digital 9
Gripper RobotGeek Servo Digital 10
Input
Wii Classic Controller RobotGeek Wii Adapter I2C
b_500_500_16777215_00__images_tutorials_rgSnapperArm_wiiControllerSnapperArm_bb.png
Wiring the Controller

The Wii Adapter Board is electronically compatible with any microcontroller with a 5v I2C connection. Here are several examples of wiring the Wii Adapter.

Make sure the orientation of your Classic Controller is correct when connecting to the Wii Adapter. Plugging the unit in the wrong way will cause it to malfunction. The flat black plastic should point upwards and the clear plastic piece should face downwards. You can also remove the clear plastic piece by remving the screws.

b_500_500_16777215_00__images_tutorials_wii_wii-adapt-instruction-1.jpg b_500_500_16777215_00__images_tutorials_wii_wii-adapt-instruction-2.jpg
Sensor Shield

This Wii Adapter was designed for use with the RobotGeek Sensor Shield. The Wii Adapter will connect directly to the Sensor Shield's I2C port using a 4 Pin Sensor Cable.

Sensor Shield Pin Wii Adapter Pin
SCL SCL
SDA SDA
5V VCC
G GND

Upload the Firmware

Open The Code

The rest of this guide assumes that you've set up the required libraries and sketches in the Snapper Arm Getting Started Guide and the Geekduino Getting Started Guide. These guides will help you to install and setup the Tools and Libraries and Snapper Sketches

Open the Arduino IDE and navigate to the following sketch:

File -> Sketchbook -> RobotGeek Sketches -> SnapperArm -> SnapperArmWiiClassic   

Setting Gripper Type

Before you can load the code onto your Robot Arm, you'll need to adjust your code to match your gripper type. Around line 78 you should see the following code block

//#define GRIPPER_TYPE ROBOT_GEEK_9G_GRIPPER
    //#define GRIPPER_TYPE ROBOT_GEEK_PARALLEL_GRIPPER

If you have any problems finding these lines, just press the 'compile' button and you'll see an error just below the code block.

In the code block, the two lines are Commented Out. Any line that starts with // is not processed by the Arduino IDE. This is useful for making code comments or to de-activate code without deleting the line. You will need to Uncomment one line by removing the slashes as shown below.

If you are using the RobotGeek Parallel Gripper, uncomment the second line. Your code should look like

//#define GRIPPER_TYPE ROBOT_GEEK_9G_GRIPPER
    #define GRIPPER_TYPE ROBOT_GEEK_PARALLEL_GRIPPER

If you are using the RobotGeek 9G Gripper, uncomment the first line. Your code should look like

#define GRIPPER_TYPE ROBOT_GEEK_9G_GRIPPER
    //#define GRIPPER_TYPE ROBOT_GEEK_PARALLEL_GRIPPER

Now that the gripper type is defined, the code will take care of correctly processing your gripper type.

Setting Control Mode

By default, this firmware will start in backhoe control mode. You can leave this code as is, as you can change which mode the arm is in with a simple button press.

#define DEFAULT_CONTROL_MODE  IKM_BACKHOE
    //#define DEFAULT_CONTROL_MODE  IKM_IK3D_CARTESIAN
    //#define DEFAULT_CONTROL_MODE  IKM_CYLINDRICAL

Compiling / Upload

Click the 'Verify' button . If you get any errors, make sure you've setup the RobotGeek Tools and Libraries in the Geekduino Getting Started Guide. If everything worked out then you should see a 'Done Compiling' message under the code.

Now click the Upload button to load the code onto your microcontroller.

Once the firmware is uploaded, the Snapper Arm will move to a 'home' position - each joint servo will center, causing the arm to make an 'L' pose.

Basic Control

You can learn about the Wii controller Library in the Wii Classic Controller Getting Started Guide Library Documentation Section.

We will be covering the basic usage of the Wii Classic Controller as a Snapper Arm control device. Follow the Diagram and Table below.

b_500_500_16777215_00__images_tutorials_wii_wii-classic-controller-labeled.png
Wii Controller Input Snapper Arm Action
L/R Gripper Increment
zL/zR Gripper Continuous
Joysticks Arm Movement (changes depending on mode)
(-) Deactivate Servos
(+) Activate Servos
Digital Pad Up Arm Speed Up
Digital Pad Down Arm Speed Down
Digital Pad Left Gripper Speed Down
Digital Pad Right Gripper Speed Up
Y Cylindrical (Mode Change)
X Cartesian (Mode Change)
A Backhoe (Mode Change)
B Start Sequence (Mode Change)

×

PC Control These demos and projects allow the robot to be controlled via a computer.

ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.

Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.

Pose Control - These demos and projects allow you to create and playback a sequence of poses.

Serial Control - These demos and projects control the robot using a serial packet protocol.

Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.

Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.

Reference - These articles have technical details regarding the control and operation of the robot.

×

More info here

Feedback Form


Search