View Full Version : Kurt's PhantomX Reactor Robot Arm

09-23-2012, 08:58 PM
A box arrived yesterday at my Mailbox and my new PhantomX Reactor Robot Arm arrived :D

So today I decided I should do a little playing around! As the product page mentioned, there is not any software for me to download, so I decided, I better come up with something ;)
The first thing I did was to modify my AX12 servo test program I used for the PhantomX Hex robot, such that I could confirm some of my assumptions before I burned up a servos. Things like that I needed to handle the dual servos for the Shoulders and Elbows where one servo was set to (1024-other servo). I also used the program to get an idea for the minimum and maximum values for each of the joints.

(Side Note)Since today I was playing with my real Tractor and removing the Backhoe and installing the 3 point hitch and wood splitter, I thought it would be fun to make the Arm work like a Backhoe and use the Arbotix Commander 2 to control the Arm.

With the left joystick controlling the base and dipper (elbow), and the right joystick controlling the boom(shoulder) and bucket curl (wrist). Currently I am using the RT/LT buttons to open and close the gripper. I have not installed the Wrist rotate yet. Once I do, I will probably use L1 and R6 buttons for this... After I finish getting this working well enough, I will probably then start playing around and add some IK code to allow you to simply move the joysticks and it moves the arm out/in UP/Down...

This is a WIP, but in case anyone wishes to see it in the raw state, I have included the source file here. Once it gets a little farther along, will probably add it to my Github.


09-26-2012, 10:21 AM
Quick Update: I believe I have the Backhoe code working a lot better now, still need to confirm that I am going the right directions with each of the joints and adjust.

Since the first posting, I installed the Wrist Rotate option. Took me a little longer than I expected as I did not have a longer cable to wire up the rotate, so I soldered 2 80mms to each other and I think that is plenty long.

I also changed how I am controlling the gripper as well as the wrist rotate. I use the L6 button in combination with the right joystick to control those two joints.

Also to keep from cluttering up the posts with Zip files, I did go ahead and added this code to my Github account (github\kurte).


09-26-2012, 04:07 PM
Hello Kirt

First off thank you for the info.
I also just got me PhantomX Reactor Robot Arm,ArbotiX Commander v2.0 and 2-XBee 1mW Communication Module.
Trossen robotics has help me some.But there Arduino Code Example is a work in progress software.

I have been able to load the LED test software in Arduim software.
Can you please help we with info.
1.What software you use?
2. Step bye step loading of your software files on PhantomX Reactor Robot Arm.

From one PhantomX Reactor Robot Arm owner to anothere It would be a great if you could help me.

Thank you for what you do.
Paul Boubel sr.
youtube- kahn1701
[email protected] ([email protected])

09-26-2012, 06:11 PM
I am using Arduino 1.0.1 for all of my work.

To work on Arduino 1.0.x you need to use their latest Arbotix stuff, which you can get a copy of off of:

You need to follow the Arbotix Instructions on how to install this stuff for a build... Been awhile, so it would take me awhile to figure out how to do this again...

But it involves copying some of the stuff you got from above into your Arduino Sketchbook directory. Some goes into:
<your sketchbook>\hardware
Other parts go into
<your sketchbook>\Libraries

Then if you copy my sketch into the appropriate folder: On mine I have it under:
<Your Sketchbook>\Github\Phantom_Arm
Then you simply open up the Arduino application, go to the Sketchbook menu item and then follow the menu items to the directory you put it in...

I personally use an AVR ISP 2 Programmer to program my board, so I have that configured under Tools\Programmer and then I use the Upload using Programmer command to program my board. I do this for two reasons, 1) My board did not come with the bootloader on it and 2) You can not use FTDI and XBee at same time, so makes life easier...

Also can I assume that the two XBees came paired and configured for 38400 baud rate? If not more steps involved. Also if not do you have an USB XBee adapter that you can plug into your PC?

Hope this gets you going.


09-27-2012, 07:52 PM

Thank you..Got it working .Look forware to more of your work..

09-30-2012, 10:37 AM
Will hopefully have some more up soon. Currently in the process of integrating in some Arm IK code, which I probably introduced a lot of bugs into. In the end I hope to have at three ways to control it.
1) My Backhoe method.
2) IK mode using 3D Cartesian coordinates.
3) Like 2, but 2D where you take the Base rotate out of it...

Got most code in for 1) and 2) and (3 should simply be an update to 2...), but now I need to debug. I ran into the issue yesterday of how to debug this code as the Serial port on the Arm was taken up by the XBee who is talking to the XBee on the Remote which has no debug capabilities...

I then came up with a method that is working for me. I hacked up one of my VB terminal programs, that I am using to debug other the PhantomX with the DIY remote and changed it to allow me to select 2 Serial ports. I then moved the XBee from the Arm to my USB XBee adapter and plugged in the FTDI cable to the Arm. The VB app is real simple:
It takes whatever comes in from the first comm port (com1) and forwards it to the 2nd comm port (com2). It also takes whatever comes in from Com2 and displays it on the screen (adds it to my listbox that I am using to display).

Edit: Note, this is only one way I could have connected this up. Could have instead moved XBee from Commander to PC USB and then plug the commander in to the USB, and left the robot wireless... or...

So I now simply added Serial.print(...) lines to the Arm program which show up :)... Now I just need to debug this stuff :lol:

I can upload or add this VB app to my github if anyone else would find this useful.


09-30-2012, 01:28 PM
You have all the toys, clearly :P

It takes whatever comes in from the first comm port (com1) and forwards it to the 2nd comm port (com2). It also takes whatever comes in from Com2 and displays it on the screen (adds it to my listbox that I am using to display).
I did this for Numa with Python so I could use the Arbotix Commander and get back IR rangefinder info and overlay it on the camera feed... very satisfying trickery to implement :)

10-01-2012, 11:32 PM
You have all the toys, clearly :P
I do have a few :lol:

I did this for Numa with Python so I could use the Arbotix Commander and get back IR rangefinder info and overlay it on the camera feed... very satisfying trickery to implement :)
Yep - I do think somone should post something about doing this as it sure does make debugging the code a lot easier, as there is no obvious stuff to use to debug on these boards. There is only 1 LED, no buttons, the USARTs are used by the XBee and Servos and no sound... I now have little speakers, plugged into both of my Arbotix boards, which provide me some sound (would be safer with additional circuitry but I have not run into an issue yet), this trick provides for debug output...

But now back to the topic at hand (or arm)...

This evening I think I have the 3D (Cartesian) IK code working a lot better. I now can use the 2 Joysticks to directly update an X, Y, Z and Desired gripper angle, can open and close the gripper and rotate the wrist holding the L6 button and the right joystick. I added some code to detect obvious error conditions, like after you subtract the wrist off, if the coordinate we are after is more than the length of the Shoulder section plus the length of the elbow section, we can not succeed. I also have a warning condition that if I am within N logical units of this. The UI code then detects this and does not allow you to move the arm logically farther away. I may also need to extend this to maybe handle not allowing it to get too close to base.

But next up I think I will do a variation of this that uses more of a cylindrical coordinate system, that is one Joystick axis will rotate the arm, another will choose the distance in what was the X/Z planes and the third will still choose Y. I am thinking I should be able to use most of the same code...

If anyone is interested, I did update my github sources with my current stuff.


10-02-2012, 01:34 PM
Quick update: I updated the code to now have the cylindrical coordinate system as well... Code updated on Github. Also uploaded VB debug app there as well.


10-05-2012, 04:08 PM

First I want to say thanks for great work. The thread here (http://forums.trossenrobotics.com/showthread.php?5429-Thinking-about-trying-out-a-different-Hex-robot...) is a fantastic resource for anybody like me who just received a phantomX, played a bit with NUKE, but now wants to start digging into programming custom behaviors.

I am having problems getting the code to work on the phantomx, however. It compiles fine, but basically does nothing after I upload. I am trying to use the Commander2 to control the bot, but with no luck.

My biggest issue so far is the one you mentioned, the lack of ability to get debug feedback during runtime. Are there any tools you have created besides the solution mentioned above that I could look into? Otherwise, are there any "scripted" leg motions I could run just to ensure that much at least works as it should? Currently, I get no leg movement whatsoever, even on startup. Thanks again


10-05-2012, 05:15 PM
Hi and Welcome Phil,

Probably should answer on the other thread. If you downloaded my stuff off of github, you may want to check the file:
Hex_Cfg.h to see what was the last input type I was testing at that time... For example it may have been for my own DIY XBee remote control and not the commander... This is controlled by the USExxx defines.

My current file shows:
#define USEXBEE
as the uncommented option. You probably want the line:
to be the option you want...

The current code does not use the servos until it get's a valid start command. By our DIY remote this is the "0" button pressed. On PS2 it is the start button. On the Commander, I detect when it starts to get valid messages, which implied that the commander was turned on...

If that does not work, go ahead and reply back on the other thread you mentioned...

As for debugging support, I use several techniques.
1) toggle unused IO pins and connect my logic analyzer up... This is usually a last resort
2) I use sounds... I plug in a speaker to an IO pin (better/safer with proper circuitry), but it has not hurt me yet. I have used cheap ones from Radioshack, currently I use ones I buy from Digikey as I have a few of them for some other boards I built....
3) With my DIY XBee stuff - They communicate in XBee packet mode. I Extended my protocol and have a VB app that can register with a robot and then the robot can send packets to it to display... (talked about in the other thread - App up on github).
4) With Commander, I use a VB app (talked about in this thread and up on github), that you have the commander talk to the PC and the robot talk to PC. Either/both/neither of these connections can use the Paired XBees (If both would require 2 sets of paired XBees). The VB app is real simple it simply forwards the stuff it receives on the comm port coming from Commander to the comm port associated with the robot and then any stuff that is sent on the comm port from the robot is shown on the screen...

5) Test programs. I have simple Arduino sketches to do specific tests. I have a separate ones for the Arm and hexapod. I believe the Hexapod test one called Kurts_AX12_Test has been uploaded as part of that other thread. I use it by moving the XBee from the Commander to a USB XBee connected to PC. It then prompts for commands, things like: Move All servos to center. Good to see if all of the servos respond. Another test is Get Servo Positions. This one also tells me if something is wrong. I have had several times where a servo will reset its id back to 1 and things hang... So have another command to say set id for Servo X to Y. You need to disconnect all of the other ones that have that id (1) before issuing this command...

Hope that helps

12-10-2012, 06:11 PM
Andrew, as you mentioned, there appears to be some form of init issue with the Arm code when running on the WidowX. As I don't have one, I can only guess. I know that the issues is somewhat localized....

In many cases like this I use one of my debug programs to help me out... For example I have my PhantomX test program that allows me to do things like: Turn all servos off and some experiments I had to move all servos to zero...

With the problems you are seeing, I added some more cases to my code. One to turn the servos back on, and another that moves the arm to the home position in about 1/2 second... In my case I have it going to the position I used for a Backhoe.

The program assumes I have a serial connection to the PC and I use the terminal window at 38400. It would not be hard to hack it up for the other arm... I included a zip file of it here...