uArm play football with XBox One Controller

Howdy Makers,

 

We made a football game with 2 uArms controlled by XBox one controller. We also designed the football yard which was made by Laser cut board. Here are the final view and video.

 

 

Step 1: Prepare all equips and software

Hardware: 

  • 2 * uArm robot arm
  • 2 * Xbox One Controller
  • 2 * Laptops or Desktops
  • 1 * Football Yard (3D model or Laser Cut model are supplied)
  • 2 * Baffle Board  (3D model or Laser Cut model are supplied)
  • 1 * Ping Pong Ball

Software:

  • Windows 10 (Because Win10 automatically support XBox One Controller, if you use win 7, or 8. You may first download the official support for Controller http://support.xbox.com/zh-CN/xbox-on-windows/accessories/connect-xbox-one-controller-to-pc. joy.cpl)
  • Visual Studio 2013 or 2015 (This will help you install .Net Frameworks 4.5.2 needed for this program)
  • Source Code (Check our github )
  • Arduino Communication Library (check )
  • *SharpDX.XInput Module.  In Visual Studio (check https://www.nuget.org/packages/SharpDX.XInput/2.6.3 to quick download )
  • *uArmForCSharp library. In Visual Studio, add this in reference (check https://github.com/uArm-Developer/UArmForCSharp)
  • *  If you have download all source code, the sharpDx.XInput and uArmForCSharp module are not essential to download.

 

Step 2: Set the environment which can let you play football

Hardware Environment

1, The Football Yard.

Based on our design, we designed a 3-layers football yard made by Laser-cut. The picture is showed below:

rendering-1.4

The up layer is made for setting the constrain for balls. And ball will move above the middle-layer. The down-layer is used to support and fix two robots.

You can use laser-cut machine to cut this or you can design your own football yard by any means.

2, The Baffle Board

The Baffle Board is used to kick the balls on the Football Yard.

 

 

rendering

3, XBox One Controller

The controller we chose is the common XBox One Wireless Controller ($53.99 USD in Amazon)

Software Environment

The software includes two parts, First part is the .ino code which should be downloaded into uArm (uDuino). The code we use is the modified version of StandardFirmata.h. You can download it from our Github named StandardFirmataEEPROM with our latest APIs.

The second part is the environment you should set in Windows Platform. The easiest way is to use WIN10 + Visual Studio 2015. This will simply solve all problems.

To be specific, the software includes:

  • Driver to drive XBox one controller (which will be embedded in WIN 10 OS)
  • xInput Library (which will be invoked in Visual Studio to drive controller)
  • .Net Framework 4.5.2 (which is used to communicate to uArm in visual studio, can be installed automatically in VS 2015)
  • Source Code in Visual Studio (the source code can be compiled without Visual Studio, but all libraries and updates should be installed first)
  • Arduino SDK in Visual Studio

If you do not have Visual Studio 2015 installed, you may need to update the .Net Framework to 4.5.2 version.

 

Step 3: Begin to Program

There are three main steps in visual studio programming :

1, Acquire Controller Button or Knob Data-> 2, Set the logical and UI to control -> 3, Execute Commands to Arduino Through Arduino SDK.

 

Thus, we begin with acquire data from Xbox controller.

1, Acquire Controller Button.

First connect your controller to your computer and check whether you have installed the initial driver for windows. If you are using WIN 10, then move to the next section.

If you are not using WIN 10, check this website to download the latest driver for win7 or win 8.

http://support.xbox.com/en-US/xbox-on-windows/accessories/connect-xbox-one-controller-to-pc

 

Then, open visual studio and under /Tools/NuGet Package, install SharpDX.XInput version 2.6.3

sharpDx

 

So you can use: using SharpDX.XInput; which will invoke the controller APIs.

Define a controller using: private Controller _controller;

Then you can invoke buttons and knob state by defining the state and get the state for each button.

state

The buttons state will show the string that named “A” “B” “X” “Y” “Start” and so on.

The Knob state will display the integers in x-y axis from -32767(most left/low) to +32767(most right/high)  .

 

2, Set the logical and control method.

buttonstate

As shown in the diagram above. Firs you can press Start Button to release uArm that you can manually move uArm to the height. Then press X to save the height and begin to move. After that you can control uArm through left or right Knob. The B button is used to exchange the different control method. There are 3 main control functions:

  • control end-effector Automatically
  • control end-effector through Right Knob
  • control both X-Y-Z axis. Right Knob will control the height.

3, Communication with uArm

First you should download uArm SDK into your computer from our github: https://github.com/uArm-Developer/UArmForCSharp

Then check the method to add libraries into visual studio http://developer.evol.net/api/csharp/

In visual studio, add: using EVOL.NET 

After all these steps, you can use uarm in visual studio.

Defining a new uarm: UArm your_uarm = new UArm(“COM_port”)

Control uarm: your_uarm.MoveTo(_xvalue, _yvalue, _zvalue)

 

Step 4: Hook software and hardware.

Then just connect all software and hardware. You are ready to go~

 

Check our source code may help you about all these step.

 

All  code are free to download, checkout this link to download the

Source code: 

For Visual Studio: https://github.com/uArm-Developer/UArmForCSharp/releases

For Arduino: https://github.com/uArm-Developer/UArmForArduino

For Visual Studio SDK/APIs: https://github.com/uArm-Developer/UArmForCSharp

 

https://www.youtube.com/watch?v=vLxpf7PAWuQ

You can also check our Youtube channel to see what are we doing now~

 

  • remember you have calibrated uArm in the latest way, check this website below to calibrate uArm and use all new APIs .

developer.evol.net

 

Cheers

 

No Comments

Leave a Comment