PDA

View Full Version : [Question(s)] PhantomX won't move



traxs
04-28-2011, 08:42 AM
Hey All!

Yesterday I finished putting together http://www.trossenrobotics.com/p/PhantomX-AX-12-Hexapod.aspx and when I turned in on I can't make any of the servos move with the commander.

Once the power is turned on all the servos leds turn red for less then a seconds and then turn off. The 'on' led on the controller and the commander stays on. Also, the user led flashes on the commander. I looked on the forums last night but without success.

Do I need to try to re-program the controller and commander?

Is it normal for the user led to flash on the controller?

Any ideas? :(

http://img34.imageshack.us/img34/878/dsc0167o.jpg

darkback2
04-28-2011, 10:30 AM
I don't have a phantom X, but I do have an arbotix and have experience with Dynamixel servos.

First off, don't try to reprogram your commander.

The AX-12 led is supposed to turn on and then back off again.

Ok...with that settled did you upload any code to your arbotix?
Do they come with any code pre-installed?
Are your xbees paired?

lnxfergy
04-28-2011, 10:49 AM
Once the power is turned on all the servos leds turn red for less then a seconds and then turn off. The 'on' led on the controller and the commander stays on. Also, the user led flashes on the commander. I looked on the forums last night but without success.

Do I need to try to re-program the controller and commander?

Is it normal for the user led to flash on the controller?

That sounds correct. The AX-12s will flash the red LED briefly when powering on. The User LED on the Commander should flash at a slow rate to tell you it is transmitting.

Is the other LED on the ArbotiX flashing? (one led is power, and is lit in your photo, the other signifies a connection, should be flashing at a pretty fast rate, ~20-30hz). If not, it's probably an XBEE setup issue and the commander isn't communicating with the ArbotIX (Which should have shipped pre-programmed).

-Fergs

traxs
04-28-2011, 11:00 AM
I don't have a phantom X, but I do have an arbotix and have experience with Dynamixel servos.

First off, don't try to reprogram your commander.

The AX-12 led is supposed to turn on and then back off again.

Ok...with that settled did you upload any code to your arbotix?
Do they come with any code pre-installed?
Are your xbees paired?

No, I have not tried to upload any code to the arbotix.
I was under the assumption that everything was pre-installed and the xbees where already paired.


That sounds correct. The AX-12s will flash the red LED briefly when powering on. The User LED on the Commander should flash at a slow rate to tell you it is transmitting.

Is the other LED on the ArbotiX flashing? (one led is power, and is lit in your photo, the other signifies a connection, should be flashing at a pretty fast rate, ~20-30hz). If not, it's probably an XBEE setup issue and the commander isn't communicating with the ArbotIX (Which should have shipped pre-programmed).

-Fergs

The second light (user led?) never flashes on the arbotix. When I get home I will try to reset the XBEEs


Thanks for the replies!

DresnerRobotics
04-28-2011, 11:15 AM
No, I have not tried to upload any code to the arbotix.
I was under the assumption that everything was pre-installed and the xbees where already paired.



The second light (user led?) never flashes on the arbotix. When I get home I will try to reset the XBEEs


Thanks for the replies!

It's possible your PhantomX was accidentally sent out without the Arbotix being programmed and/or Xbees paired.

Xbee Tutorial here: http://forums.trossenrobotics.com/tutorials/how-to-diy-128/xbee-basics-3259/

Arbotix programming information can be found here: http://code.google.com/p/arbotix/wiki/GettingSetup

The code for the PhantomX is found on the product page. Please email/PM me if you have any questions about getting setup.

traxs
04-28-2011, 09:36 PM
It's possible your PhantomX was accidentally sent out without the Arbotix being programmed and/or Xbees paired.

Xbee Tutorial here: http://forums.trossenrobotics.com/tutorials/how-to-diy-128/xbee-basics-3259/

Arbotix programming information can be found here: http://code.google.com/p/arbotix/wiki/GettingSetup

The code for the PhantomX is found on the product page. Please email/PM me if you have any questions about getting setup.

It's Alive!!! :D

http://img600.imageshack.us/img600/4414/dsc0169b.jpg

Pairing the XBEEs and programming the Arbotix did the trick.

The only problem I had was programming the Arbotix. After 2 computers I finally figured out that you can't program the Arbotix with the XBEE installed. :robotsurprised:

DresnerRobotics
04-28-2011, 10:40 PM
Congratulations!

You should post some video. If you have any questions about gait tweaking, please let us know.

The default gait on these is pretty good, but I think there's still plenty of room for improvement.

Zenta
04-29-2011, 05:13 AM
Congratz with your new hexapod (you are one of the lucky ones.... ;) ) !

Btw, I'm just wondering (pardon a noob Q). Since I'm used to RC servos. Isn't calibration of the AX-12's needed? I can't see anything about it in the tutorial. Or did Pypose take care of that?

lnxfergy
04-29-2011, 09:00 AM
Congratz with your new hexapod (you are one of the lucky ones.... ;) ) !

Btw, I'm just wondering (pardon a noob Q). Since I'm used to RC servos. Isn't calibration of the AX-12's needed? I can't see anything about it in the tutorial. Or did Pypose take care of that?

Dynamixel servos are always nicely centered. When you send 512 as the position, it goes to center. No calibration needed.

-Fergs

mannyr7
04-29-2011, 11:32 AM
Beautiful hex! Congrats! Yes, video please.

traxs
04-30-2011, 12:20 AM
Video of hexapod in action! :D


http://www.youtube.com/watch?v=tSjZJaPhw4c

DresnerRobotics
04-30-2011, 01:16 AM
Try left trigger + left joystick. :)

Zenta
04-30-2011, 09:33 AM
Dynamixel servos are always nicely centered. When you send 512 as the position, it goes to center. No calibration needed.


Oh, that sound very user friendly. Most impressive that all servos has the exact centering in reference to the orientation of the servo horn.

elaughlin
04-30-2011, 10:00 AM
Yeah, I have never had the pleasure of working with hobby servos, but I am kind of glad I don't have to go through all of that centering and tiny adjustments of them. Dynamixels are very easy to use for a beginner, but also are impressive for experienced users.

You won the PhantomX Hexapod, correct Zenta? Have you done anything with it yet?



Oh, that sound very user friendly. Most impressive that all servos has the exact centering in reference to the orientation of the servo horn.

traxs
04-30-2011, 12:13 PM
Try left trigger + left joystick. :)

I didn't even try the left trigger! thanks!


http://www.youtube.com/watch?v=aKF5XjTlpjA

I noticed that using the left trigger sometimes puts the hexapod in almost a cruise control mode. It continues to move without input from the commander. I can still change its direction. If I hit the left trigger a couple of times it will stop.

Zenta
05-01-2011, 09:20 AM
You won the PhantomX Hexapod, correct Zenta? Have you done anything with it yet?

I've not received it yet...

minimalfra
01-29-2017, 08:12 AM
Hi guys,

After several attempts, I still have some problems trying to make my robot move.
I found several times my code into arbotix (Phoenix) and it seems to be all ok, also the Xbee modules are coupled correctly and the ID servos ar OK

About the ID servos i've read an article like this:http://www.ericshi.ca/blog/2016/7/getting-phoenix-gait-working-phantomx-ma/ the Number 1 it should bè renamed as 19, is out correct?

The problem is that at the ignition of the robot and the Commander, the servos reset and then all is blocked, or when the led user on arbotix flash and It moves a little but then It is all blocked again.


Someone Can help me?

thanks!!!

KurtEck
01-29-2017, 09:04 AM
Hi and welcome minimalfra,

Might be better to create new thread than resurrect a almost six year old thread.

In order to assist you, it would help to have additional information, such as:

Which Robot? From PM I am assuming PhantomX MK3 kit so using ArbotixM...

Which version of Arduino IDE are you using? I know a lot of Trossen site still setup to use 1.0.6, where these days I only use more recent things like 1.8.1

Where did you get the Bioloid Libraries from? Do you have link to it?

Where did you get the Phoenix code from? I have it in a couple projects on GitHub, probably the easiest to use is the project:
https://github.com/KurtE/Phantom_Phoenix

When using my Phoenix code base, I also typically update the code in the commander with: https://github.com/KurtE/CommanderEx

If still stopping... And using the Phatom_Phoenix code, I would then try going into Hex_Cfg.h file and turn off voltage checking.
Find the lines:
#define cTurnOffVol 1000 // 10v
#define cTurnOnVol 1100 // 11V - optional part to say if voltage goes back up, turn it back on...
And comment them out. Sometimes issue where retrieving information back from Servos can be problematic and it does not detect voltage and turns the servos off...

As for Servo IDs renumbering from 1 to 19. I think my default config will do it automatically with the option:
#define OPT_CHECK_SERVO_RESET // Try to find single servo that reset it's ID...

Hope that gets you up and running..

minimalfra
01-29-2017, 11:12 AM
Hi kurte,

thanks for the quick answer, the robot is Hexapod Phantom MKIII, and I'm using IDE 1.0.6, so Can I use a updated version?.

I've loaded this code: https://github.com/KurtE/Arduino_Phoenix_Parts and I just loaded your code: https://github.com/KurtE/Phantom_Phoenix and now after switching and servos positioning, the led servos remain blinking except led of ID n°1, if change this ID to 19 that, too blinking, but it's still stopped.

KurtEck
01-29-2017, 11:34 AM
As I mentioned I more or less refuse to use anything before Arduino 1.6.x these days. I have 1.6.9 installed that I only use for one Teensy 2.x program as it does not build with current Arduino build stuff and then I have 1.8.0 installed with released Teensyduino and 1.8.1 with Beta... Note Teensyduino is only needed if you are using Teensy 3.x boards from PJRC...

I have been trying to get Trossen updated to current releases for at least a couple of years.

They are/were close to this before I believe Kyle left. There is postings about their beta update for this up in the thread:
http://forums.trossenrobotics.com/showthread.php?7971-ArbotiX-1-6-Files-Libraries But have not heard anything since last August on this...

Not sure if (or who) at Trossen will complete and support this?

But again I would take those steps mentioned there or alternatively their steps are based on Installing recent Arduino and then using my Arbotix fork on GitHub with the Arduino 1.6.x (or some such name branch).

I often play around with my own test program (https://github.com/KurtE/AX12_Test), which is a hodge podge of junk but it does allow me to see if all of the servos are there and renumber servos... But it relies on my own version of Bioloid library where I pass in which Serial port to use: https://github.com/KurtE/BioloidSerial

Led's blinking. I do this when the Servos are logically turned off as a way to remind me the power is still turned on. I killed a battery or two with forgetting to turn off the switch.

minimalfra
01-29-2017, 12:54 PM
I've updated Arduino IDE to 1.8.1 but I can't finde libraries for arbotix board and I see only libraries for IDE 1.6.x http://learn.trossenrobotics.com/projects/182-arbotix-getting-started-guide-arduino-ide-1-6-x-setup.html so I've installed 1.6.13.

KurtEck
01-29-2017, 04:54 PM
Not Arduino 1.8.x is just an extension of 1.6.x. They went to 1.8 as the two Arduinos (cc and org) I believe are working with each other again and one was using 1.6 and other 1.7 so ... now 1.8

minimalfra
01-30-2017, 12:06 AM
Sorry kurte, about pypose program, it's work only with Nuke code?

tician
01-30-2017, 02:01 AM
The Phoenix codebase is completely independent of the python 'pypose' and any Arduino sketches/libraries generated by it.

The python 'pypose' can be used to create poses and sequences (only by uploading the Arduino sketch named pypose.ino to the arbotix), and also for customizing NUKE for an individual robot. A NUKE gait generated by 'pypose' will contain many parameters specific to the robot taken as inputs when running 'pypose', and the generated library will produce the servo goal positions on-the-fly just like the Phoenix gait does. When 'pypose' is used for producing poses and sequences, the poses and sequences are stored as arrays of servo goal positions in generated header files and can be used in any Arduino sketch using the BioloidController library or any other library that can iterate through the arrays and send the goal positions to the servos.

KurtEck
01-30-2017, 10:48 AM
As Tician mentioned, the pypose/nuke code is a completely different code base.

It was the main code base that Trossen supported for the PhantomX. You used to (maybe still can) be able to download a complete sketch. They had/have a version pre-configured for I believe MK2 (but maybe only MK1) and had two versions one for AX12s and the other for AX18s...

Not sure if anyone is currently supporting this anymore. Recently when I looked up a github for another thread here, it did not look like any changes had been made to the pypose project in a few years and I believe the principle developer of it has not logged into this forum for a couple years.

Also the version of the pre-built programs for the PhantomX was faulting the more recent Arduino compilers. I uploaded a zip file that worked around this. But I have not run it in a long time as I no longer have an Arbotix hooked up to my PhantomX.

minimalfra
01-31-2017, 02:51 AM
Okok as soon as I'll be able I'll try pypose but yesterday i've received an answer by Xbee forum, about a profile to upload in the modules:https://github.com/Interbotix/xbeeProfilesInterbotiX/blob/master/xbee_for_robocontroller.pro and after done It, the communication seems to bè stable but servos don't sync up correctly or don't move at all...

KurtEck
01-31-2017, 09:14 AM
If it were me, I would do a couple of things to try to get some information.

XBees and configuration - A long time ago I got tired of too many people having issues with XBees, they would build their PhantomX plug the unconfigured XBees into their controller and Robot and it did not work. And the instructions on how to use the configuration software was often problematic as there is the old and new versions of X-CTU....

So I have code in both the Phoenix code base as well as the CommanderEx that if it can not talk at to the XBee at baud rate of 38400 but can at 9600 (default), then it has code to configure the XBees... So if you are having problems with communications, try resetting both of them to defaults and let the software do it...

Have you tried running the AX12_Test program I mentioned? (again requires my BioloidSerial library) - This requires the PhantomX to be connected to PC by Serial Cable or XBee...

I usually then have my PhantomX on a stand. I often use something like Nut jar from Costco and maybe book or two below for more height. Things I try include:

Run the command 4 (print all positions) - and See if it can talk to all of the servos... If you see positions like -1 than it could not talk to that servo...

I then try commands like all servos center (1) This should move all of your servos to their zero position. All of the servos should be trying to hold a position. All of the horizontal shoulder should be straight out (Femur), and the Knees (Tibia) should be pointing the feet down toward the ground. If this is not true maybe an issue.

Assuming you can talk to some but not all servos. If you try the command to move a servo, you can try moving each one like:
2 2 600
This should move servo 2 to 600 - If it does move try different value like 400 (in case it was already at 600). If multiple servos move,
then you have some servo ID issues.

For example if you have multiple servos that reset their ID to servo 1, then multiple joints will often then move. You can then go through the work to fix their IDS. There is a command to set a servo ID. Note: if you say : 8 1 12
It says renumber servo 1 to servo 12. If there were multiple servos that answered the move for servo 1 before, All of these will likely be now servo 12. So you may need to disconnect some servos first to get the right one...

I sometimes wish to see how a servo is configured, so I use the print command.
like: 9 2
Which will print stuff out about servo #2....


And in all cases, I always check power! That is are you running this by Lipo Battery right now? If so is the battery properly charged? When I am doing a lot of testing, I sometimes instead use Wall Wart. These days mostly the 10amp version that came with HROS1...

minimalfra
02-01-2017, 04:27 PM
Yes Kurt, I'm using the wall wart provided by Trossen to test my robot, but Pypose can't read correctly all servos.

So now I'm charging the batterypack, because, if I remember correctly, last time that servos worked and synced, was when the battery pack get so low and I was forced to use the wall wart.

KurtEck
02-01-2017, 04:39 PM
Warning: hopefully the voltage did not get too too low on the battery. I hope you have read the Lipo warnings and if the battery is below safe values that you replace it!

Good luck. Let me know if you have any luck with Pypose

Which Pypose are you using?
I know I posted one up in the other thread: http://forums.trossenrobotics.com/showthread.php?8876-Hexapod-PhatonmX-MarkIII-PyPose&p=73722#post73722

But again I don't remember which version of PhantomX it was setup for. I have another one, which has the MK2 as part of the name so more likely setup for MK2 and the MK3 is close to it...
But again I have not tried to run this for a long time!

minimalfra
02-01-2017, 04:57 PM
I've installed this version of Pypose, https://github.com/vanadiumlabs/pypose.git maybe the last.

DresnerRobotics
02-04-2017, 04:52 PM
Just to give those in the thread a heads up, we actually have the PhantomX MK4 release slated for mid 2017, which will include a lot of software updates to get things caught up to the later arduino IDEs as well as give people a couple of options for a codebase.

minimalfra
02-04-2017, 07:37 PM
Hi guys, I'm sorry if I didn't give some news, but between work and various test to be, I've been catch up a few in sleeping... :p

So first of all, I've noticed a my mistake, I've renamed the servos ID respectively 1 - 11 like ID 19 - 1.

So this correction, has not been sufficient.

I think the problem is in the phoenix code, when this, try to assign a new ID to servos, then I've comment the line in https://github.com/KurtE/Phantom_Phoenix/blob/master/Hex_Cfg.h :

####
152 //#define cLFCoxaPin 19 //Front Left leg Hip Horizontal - Avoid servo 1
153 //#else
####
by disabling this my hexapod work a bit but when the Hexapod work, it's lock for a few second.

So the problem there aren't the Xbees but is in the code you know?


https://youtu.be/dmjbuy1qxZM

jwatte
02-05-2017, 12:46 PM
Just to give those in the thread a heads up, we actually have the PhantomX MK4 release slated for mid 2017, which will include a lot of software updates to get things caught up to the later arduino IDEs as well as give people a couple of options for a codebase.

That sounds great!
Assuming I have the servos and stuff from the MKII quad, will it be possible to buy the frames for an MK4? Or will you not be making a quad of the MK4?

KurtEck
02-05-2017, 03:50 PM
So the problem there aren't the Xbees but is in the code you know?

Again if you have not already done so, turn of the voltage checking code.

In Hex_CFG.h , look for the lines:

Make sure: #define cVoltagePin 7 is not defined unless you have setup voltage divider.



#define cTurnOffVol 1000 // 10v
#define cTurnOnVol 1100 // 11V - optional part to say if voltage goes back up, turn it back on...

and comment them out


//#define cTurnOffVol 1000 // 10v
//#define cTurnOnVol 1100 // 11V - optional part to say if voltage goes back up, turn it back on...

Sometimes the retrieving of data back from servos is not always robust... This stops the code from asking.
Or better yet, wire yourself of a simple voltage divider. I have done it with two resistors that connect to a VIN (voltage from battery), ground and one to an analog pin. I used an RC extension cable, cut in half, and then removed the Red one that I then go to VIN and black and ground go to one of the Analog pins. In my case I used a 20K and 4.66K resistor as I had Axial ones around from Sparkfun kit. ... Can say more if interested. But it is a lot more reliable and faster to do simple AnalogRead statements than using communication to servos

minimalfra
02-07-2017, 05:12 PM
Hi Kurt, I've commented those lines when you told me, but still it doesn't walk. It manages to do some footsteps only after commenting the lines which regard servos renaming. In any case, it's not enough because it's unstable.

It's possibile an electric issue?

KurtEck
02-07-2017, 05:43 PM
Always hard to know what is going on without more info.
... Often when it can not walk I find there is additional issues, which sometimes includes:
aaa) Power - not enough ...

a) Multiple servos with same ID (usually 1) - Has happened when users did not set their ids and they default as 1. or 2) sometimes servos just reset to 1. Never able to give definitive answer to why? Low voltage? Commands clobbered? ...

b) Or wrong servos have an ID...

c) On some robots differences in build from Left legs versus right legs

d) Servos are not aligned properly. You mistake which side of a servo indicator is the right side and so you screw on the pieces to the servo off by 180 degrees and other similar issues.

Have you tried my AX12 test program? If you do a command to set all servos center, do they all move? Do they all have power connected (i.e. they don't move by hand).

Or if you could compile in my servo center portion of the Phoenix code (which uses the serial port so difficult to use on Arbotix-M board), there is a Servo Align command. What is nice about this is you can walk through each servo, and if I remember this version correctly, it will wiggle each joint and say what that joint is. You would be surprised how many times it helped find when servos were not correct or working. (Especially with RC servos where each hooked up to IO pin)

And again are you running this still with Arduino 1.0.6? Or have you tried on more recent stuff?

Sometimes I debug this with Debug messages. Again this is more difficult with the Arbotix-M as it only has two serial ports, one is taken up by the servos and the other by the XBee talking to commander.

So what I do when debugging this type configuration is use the knowledge that the Arbotix Commander only sends data to the robot, it does not receive any back. So I still can output stuff by Serial.print... when goes out. I then connect the Commander and the Phoenix to my PC as serial ports. Typically I plug the XBee from the commander into USB XBee adapter and I plug the Commander into the pc by USB cable. I then have a VB app, that I configure with the two Serial ports. And everything that the commander sends, is forwarded to the Robot and everything the robot sends, I put in a text box in the VB app... So I can at least see diagnostic information.

At times I considered to also maybe have the VB app generate special commands to the Robot to hopefully intercept as commands. But I have not done that part ...

Brooks
02-07-2017, 08:47 PM
Man alive, that video was familiar! I had the same problem with my Mk III, especially when running from batteries. My problems seemed to be related to loose servo connections and sizable voltage drop across all those thin wires and traces. The major changes I made were:
1) I constructed a U-shaped wiring harness out of 14ga household solid-copper wiring. It sits cable-tied to the bottom-most base plate; the U-shape lets the battery fit inside the "U".There are seven servo wires coming from this harness, one to each leg and one to the Arbotix-M. Also inside this harness is the servo signal wire. It makes for a very tidy installation, and really reduces voltage drop, as main power is fed directly to this harness. Each connection was soldered and covered with heat-shrink. The whole thing was wrapped with PVC electrical tape.
2) The servo wires cry out for strain-relief. I looked at each wire where it connects to the servo, and, where I could, put a small blob of RTV on each wire, positioned to let the servo move but reduce the flexing of the wire at the connector itself.

I'm using the ax-18a servos, which when stalled pull over two amps. I felt that even when pulling only half of that I was asking the stock power distribution system to handle 18 amps.

It just doesn't lock up any more...

minimalfra
02-11-2017, 06:52 AM
Hi kurte, I'm sorry for the delate.

I don't think is a problem about the Power offline battery-pack because the problem is always the same with battery recently charged and balanced.

a/b) the ID servos are correctly setted and I don't know how they can reset themselves.

c/d) it sounds weird because I followed the guidelines of the website

http://learn.trossenrobotics.com/index.php/getting-started-with-the-arbotix/1-using-the-tr-dynamixel-servo-tool#&panel1-1

http://learn.trossenrobotics.com/10-interbotix/crawlers/phantomx-hexapod/172-phantomx-hexapod-metal-assembly-guide.html

About your testing programme, I haven't tried it yet but is necessary this cable http://www.trossenrobotics.com/bioloid-serial-cable.aspx ?

I'm using the 1.6.13 IDE version.

After all those things I can't understand why I'm finding so many problems because the user that opened this thread simply forgot to upload the code and match Xbees modules.

KurtEck
02-11-2017, 09:30 AM
Hi, not a problem with delay. I am just hoping that you can get it to work and have some fun!

As for Servo IDs - As for their IDs resetting? I and many others have seen it happen, multiple times. That vast majority of the time it is that one or more servos reset to id #1. Many think it may be a temporary voltage drop or maybe some packets being clobbered or ... That cause it. That was the reason I took the lead from another member (r3n33?) who renumbered their #1 servo to something else and that way you can detect it.

c/d) The newer instructions are much better than some of the older instructions. Where it calls out Left vs Right assembly. That used to happen a lot more often. Also instructions are better to describe single horn notch vs double horn notch, but it is still easy for someone not to notice that their horn is rotated and just quickly see the notch and be off and/or the first 10 servos they use are at the default rotation and they just quickly assemble assuming the others will be as well... (Been there, done that) Again as more of us have built the kits the more these issues have been found and instructions improved.

As for that cable you mentioned, I have no idea what that one if for. If this is in regard to my debugging by hooking up controller and PhantomX to computer. Typically what I have done is to leave the XBee in the Arbotix (Robot), remove the XBee from the Commander, and plug the XBee into the USB/XBee board you used to setup the xbees (http://www.trossenrobotics.com/uartsbee ? ) Or any other USB xbee adapter you have. I then plug the Commander into the computer using standard serial cable you use to program it.

My Test app: (https://github.com/KurtE/AX12_Test) - Just need to have serial connection to PC. If you are using an FTDI connection to program your board, just continue to use that cable. Just use Arduino to program it with the test program and then open up Serial monitor. It wants the serial monitor configured for 38400 baud rate. if you type something and nothing happens, check the line ending options and probably set to both (cr and lf). Again it is nothing special, but can give us more information on if it can talk to all of the servos...

My quick and dirty VB app I mentioned, which is nothing special is up at: https://github.com/KurtE/DIY_XBee_DebugTerminal
I have not tried this a long time as I don't do much these days with the Arbotix boards. Earlier before I moved most of my Arduino stuff to Teensy boards, I would do some debugging using an Arduino mega, as it also has additional hardware UARTS... But that required you to create a simple cable to talk to the AX servos (I simply took a bioloid cable, cut out the Power pin, and then connected the signal pin to both RX and TX of the UART... But again I know I was cheating...

-------> But sometimes it is good to regroup ---->
Like again check with test program to make sure we can talk to all the servos. If you use the command to say all servo center do all of the servos respond and does the robot look like it is standing up with all of the legs pointing reasonably?

Like make sure the battery is charged and maybe a fresh set of batteries in the commander

Maybe post a picture of setup

Again make sure that the code is configured to NOT check voltages, by commenting out the voltages I mentioned earlier.
I probably should update the code up in my github to disable this and the like and make it for the generic setup versus have it configured for my own usage....

But typically the ways that the robot would stop walking and drop to ground include:
a) Arbotix thought the voltage went too low - mentioned above.
b) It lost signal to Commander. If it does not receive any messages for a certain amount of time. It assumes it lost contact and again goes to the off state.
c) Something went wrong, maybe processor reset...

In many of these cases I have the code doing Beeps or the like, As a jamb a few extra things onto my Arbotix board:
6858

Right now showing the programmer, my resistor divider and simple speaker (same one I use when I build boards, with the two pins jammed into Servo cable... I know now that Trossen does sell a simple buzzer (http://www.trossenrobotics.com/robotgeek-buzzer), which I have not tried... But I personally find it helpful to have some form of visual and/or sound type feedback. So for example when the robot stands up, there are three beeps going up in frequency, when it sits down it give three beeps going down in frequency... So you can tell if for some reason the robot thinks it should shut down. Likewise there is a set of beeps at the start if the Arbotix can not talk to the XBee... But maybe I am digressing from your issue...

minimalfra
02-18-2017, 11:06 AM
Hi kurtE, I need to run your program "Kurts_AX12_Test_Use_Serial" included in this link: https://github.com/KurtE/BioloidSerial, the same happens with the second: https://github.com/KurtE/AX12_Test

how can I use it?

This is the error

Arduino:1.6.13 (Windows 10), Scheda:"ArbotiX Std"


C:\Users\franc\Desktop\Kurts_AX12_Test_Use_Serial\ Kurts_AX12_Test_Use_Serial.ino:1:24: fatal error: ax12Serial.h: No such file or directory

#include <ax12Serial.h>

^


compilation terminated.


exit status 1
Errore durante la compilazione per la scheda ArbotiX Std





...

I often play around with my own test program (https://github.com/KurtE/AX12_Test), which is a hodge podge of junk but it does allow me to see if all of the servos are there and renumber servos... But it relies on my own version of Bioloid library where I pass in which Serial port to use: https://github.com/KurtE/BioloidSerial

...

I can't run nuke code (https://github.com/Interbotix/HexapodMKIICommander.git)


this is the error...

Arduino:1.6.13 (Windows 10), Scheda:"ArbotiX Std"


sketch\gaits.h: In function 'SmoothGaitGen':


gaits.h:105: error: unable to find a register to spill in class 'POINTER_REGS'


}


^


gaits.h:105: error: this is the insn:


(insn 489 488 490 27 (set (reg:HI 26 r26)


(reg/f:HI 134 [ .result_ptr ])) sketch\gaits.h:104 83 {*movhi}


(nil))


sketch\gaits.h:105: confused by earlier errors, bailing out


lto-wrapper: C:\Users\franc\AppData\Local\Arduino15\packages\ar duino\tools\avr-gcc\4.9.2-atmel3.5.3-arduino2/bin/avr-gcc returned 1 exit status


c:/users/franc/appdata/local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: lto-wrapper failed


collect2.exe: error: ld returned 1 exit status


Più di una libreria trovata per "ax12.h"
Usata: C:\Users\franc\OneDrive\Documenti\Arduino\librarie s\Bioloid
Non usata: C:\Users\franc\OneDrive\Documenti\Arduino\librarie s\ArbotiX
Non usata: C:\Users\franc\OneDrive\Documenti\Arduino\librarie s\ArbotiX
Non usata: C:\Users\franc\OneDrive\Documenti\Arduino\librarie s\ArbotiX
Non usata: C:\Users\franc\OneDrive\Documenti\Arduino\librarie s\ArbotiX
exit status 1
unable to find a register to spill in class 'POINTER_REGS'

KurtEck
02-18-2017, 12:44 PM
Did you read the readme file with that project?

It has a section which includes:

This program also may rely on my modified version of the Bioloid library that I call BioloidSerial. This library was setup to be able to be used with Arduino(ish) boards that have more hardware Uarts like the Teensy 3.x by PJRC. You can pass in which Hardware Serial object to use.
This library is found up at: https://github.com/KurtE/BioloidSerial

minimalfra
02-19-2017, 08:13 AM
Did you read the readme file with that project?

It has a section which includes:

Yes Kurte, but I don't understand very well... :sad:

I can't load on arbotix-M AX12_test because it's don't compile, maybe I before must load bioloidserial libraries somewhere, but I don't know it.

Can you tell me? thanks!!!!!!!!!

KurtEck
02-19-2017, 09:36 AM
Yes - It probably does not compile as it is depending on another library which you probably have not installed on your machine...

The library is located in the place I mentioned in the previous posting: https://github.com/KurtE/BioloidSerial

There are multiple ways to install that library: If you do a google of something like: how to install arduino library from github
You will see lots of hits including: http://www.instructables.com/id/Import-a-Code-Library-to-Arduino/

One way is you can go up to the github project, click on the clone or download green button, and download a zip file. This should go into your normal download folder as a zip file. Now in Arduino IDE go to menu item Sketch->Include Libraries->Add .ZIP library
Which should take you to a dialog, where you choose the zip file you just downloaded. This should put the library code in the right place on your system....

Another way is to clone the library into the right place... The normal place is <your sketches folder>/libraries/...
i.e. the place you put the libraries you downloaded from Trossen...

You then should hopefully be able to compile. At some point I may make a version of the program that simply uses the versions of my libraries that were folded into the Arbotix 1.6 beta release, but I have not yet done so as I am not sure what Trossen's plans are for supporting Arduino. My local copy has stuff in it currently for my own testing, which includes having a direction pin, different RX/TX pins...
But should not be hard to hack it up to remove the usage of my versions of libraries. I did a quick version, here but can not say for sure if it works...



//#define INCLUDE_TIMED_TESTS
//================================================== ==================================================
// Kurts Test program to try out different ways to manipulate the AX12 servos on the PhantomX
// This is a test, only a test...
//================================================== ==================================================
//================================================== ==========================
// Global Include files
//================================================== ===========================

//#include <ax12Serial.h>
//#include <BioloidSerial.h>
#include <ax12.h>
#include <BioloidController.h>
//================================================== ===========================
// Options...
//================================================== ===========================

// Uncomment the next line if building for a Quad instead of a Hexapod.
//#define QUAD_MODE
//#define TURRET

//V0.2
//#define SERVO_DIRECTION_PIN -1
//#define SERVO_POWER_ENABLE_PIN 2


// V0.3
#define SERVO_DIRECTION_PIN 2
#define SERVO_POWER_ENABLE_PIN 3

#define AX_BUS_UART Serial1
//#define VOLTAGE_ANALOG_PIN 0
//#define SERVO1_SPECIAL 19 // We wish to reserve servo 1 so we can see servo reset


//#define AX_RX_PIN 27
//#define AX_TX_PIN 26
//#define SERVO_DIRECTION_PIN 28
//#define SERVO_POWER_ENABLE_PIN 29


//================================================== ===========================
// Define differnt robots..
//================================================== ===========================

// Constants
/* Servo IDs */
#define RF_COXA 2
#define RF_FEMUR 4
#define RF_TIBIA 6

#define RM_COXA 14
#define RM_FEMUR 16
#define RM_TIBIA 18

#define RR_COXA 8
#define RR_FEMUR 10
#define RR_TIBIA 12

#ifdef SERVO1_SPECIAL
#define LF_COXA 19
#else
#define LF_COXA 1
#endif
#define LF_FEMUR 3
#define LF_TIBIA 5

#define LM_COXA 13
#define LM_FEMUR 15
#define LM_TIBIA 17

#define LR_COXA 7
#define LR_FEMUR 9
#define LR_TIBIA 11

#ifdef TURRET
#define TURRET_ROT 20
#define TURRET_TILT 21
#endif

static const byte pgm_axdIDs[] PROGMEM = {
LF_COXA, LF_FEMUR, LF_TIBIA,
#ifndef QUAD_MODE
LM_COXA, LM_FEMUR, LM_TIBIA,
#endif
LR_COXA, LR_FEMUR, LR_TIBIA,
RF_COXA, RF_FEMUR, RF_TIBIA,
#ifndef QUAD_MODE
RM_COXA, RM_FEMUR, RM_TIBIA,
#endif
RR_COXA, RR_FEMUR, RR_TIBIA
#ifdef TURRET
, TURRET_ROT, TURRET_TILT
#endif
};

#define NUM_SERVOS ((int)(sizeof(pgm_axdIDs)/sizeof(pgm_axdIDs[0])))
const char* IKPinsNames[] = {
"LFC","LFF","LFT",
#ifndef QUAD_MODE
"LMC","LMF","LMT",
#endif
"LRC","LRF","LRT",
"RFC","RFF","RFT",
#ifndef QUAD_MODE
"RMC","RMF","RMT",
#endif
"RRC","RRF","RRT",
#ifdef TURRET
"T-ROT", "T-TILT"
#endif
};
//================================================== ===========================
// Globals
//================================================== ===========================
// Global objects
/* IK Engine */
//BioloidControllerEx bioloid = BioloidControllerEx();
BioloidController bioloid = BioloidController(1000000); // may use or not... may go direct to AX12// other globals.
word g_wVoltage;
char g_aszCmdLine[80];
uint8_t g_iszCmdLine;
boolean g_fTrackServos = false;

// Values to use for servo position...
byte g_bServoID;
word g_wServoGoalPos;
word g_wServoGoalSpeed;

#ifndef SERVO_DIRECTION_PIN
#define SERVO_DIRECTION_PIN -1
#endif

//================================================== ==================================================
// Setup
//================================================== ==================================================
void setup() {
Serial.begin(38400); // start off the serial port.

delay(250);
pinMode(4, OUTPUT);
pinMode(1, OUTPUT);
digitalWrite(1, OUTPUT);
delay(250);


#ifdef AX_RX_PIN
AX_BUS_UART.setRX(AX_RX_PIN);
#endif
#ifdef AX_TX_PIN
AX_BUS_UART.setTX(AX_TX_PIN);
#endif


// bioloid.begin(1000000, &AX_BUS_UART, SERVO_DIRECTION_PIN);
bioloid.poseSize = NUM_SERVOS;

// Hack to see if I can make pin 6 act like SERVO_DIRECTION_PIN
// CORE_PIN6_CONFIG = PORT_PCR_MUX(3);
// UART0_MODEM |= UART_MODEM_TXRTSE | UART_MODEM_TXRTSPOL;

#ifdef SERVO_POWER_ENABLE_PIN
pinMode(SERVO_POWER_ENABLE_PIN, OUTPUT);
digitalWrite(SERVO_POWER_ENABLE_PIN, HIGH);
#endif
delay(1000);
Serial.print("System Voltage in 10ths: ");
Serial.println(g_wVoltage = ax12GetRegister(LF_COXA, AX_PRESENT_VOLTAGE, 1), DEC);

pinMode(A1, OUTPUT);
digitalWrite(A1, HIGH);

// pinMode(6, OUTPUT);
// digitalWrite(6, HIGH);
}


//================================================== ==================================================
// Loop
//================================================== ==================================================
void loop() {
// Output a prompt
word wNewVoltage = ax12GetRegister(LF_COXA, AX_PRESENT_VOLTAGE, 1);
if (wNewVoltage != g_wVoltage) {
g_wVoltage = wNewVoltage;
Serial.print("System Voltage in 10ths: ");
Serial.println(g_wVoltage, DEC);
}

// lets toss any charcters that are in the input queue
while(Serial.read() != -1)
;

Serial.println("0 - All Servos off");
Serial.println("1 - All Servos center");
Serial.println("2 - Set Servo position [<Servo>] <Position> [<Speed>]");
Serial.println("3 - Set Servo Angle");
Serial.println("4 - Get Servo Positions");
Serial.println("5 - Find All Servos");
Serial.println("6 - Set Servo return delay time");
Serial.println("8 - Set ID: <old> <new>");
Serial.println("9 - Print Servo Values");
Serial.println("t - Toggle track Servos");
Serial.println("h - hold [<sn>]");
Serial.println("f - free [<sn>]");
Serial.print(":");
Serial.flush(); // make sure the complete set of prompts has been output...
// Get a command
if (GetCommandLine()) {
Serial.println("");
Serial.print("Cmd: ");
Serial.println(g_aszCmdLine);
g_iszCmdLine = 1; // skip over first byte...
switch (g_aszCmdLine[0]) {
case '0':
AllServosOff();
break;
case '1':
AllServosCenter();
break;
case '2':
SetServoPosition();
break;
case '3':
break;
case '4':
GetServoPositions();
break;
case '5':
FindServos();
break;
case '6':
SetServoReturnDelayTime();
break;
case '8':
SetServoID();
break;
case '9':
PrintServoValues();
break;
case 'f':
case 'F':
HoldOrFreeServos(0);
break;
case 'h':
case 'H':
HoldOrFreeServos(1);
break;
#if INCLUDE_TIMED_TESTS
case 'm':
TimedMove2();
break;
case 'n':
TimedMove3();
break;
#endif

case 't':
case 'T':
g_fTrackServos = !g_fTrackServos;
if (g_fTrackServos) {
Serial.println("Tracking On");
TrackServos(true); // call to initialize all of the positions.
}
else
Serial.println("Tracking Off");
TrackPrintMinsMaxs();
break;
}
}
}

// Helper function to read in a command line
uint8_t GetCommandLine(void) {
int ch;
uint8_t ich = 0;
g_iszCmdLine = 0;

for(;;) {
// throw away any thing less than CR character...
ch = Serial.read();
if ((ch >= 10) && (ch <=15)) {
g_aszCmdLine[ich] = 0;
return ich;
}
if (ch != -1)
g_aszCmdLine[ich++] = ch;

if (g_fTrackServos)
TrackServos(false);
}
}

//
boolean FGetNextCmdNum(word *pw ) {
// Skip all leading num number characters...
while ((g_aszCmdLine[g_iszCmdLine] < '0') || (g_aszCmdLine[g_iszCmdLine] > '9')) {
if (g_aszCmdLine[g_iszCmdLine] == 0)
return false; // end of the line...
g_iszCmdLine++;
}
*pw = 0;
while ((g_aszCmdLine[g_iszCmdLine] >= '0') && (g_aszCmdLine[g_iszCmdLine] <= '9')) {
*pw = *pw * 10 + (g_aszCmdLine[g_iszCmdLine] - '0');
g_iszCmdLine++;
}
return true;
}

//================================================== =====================================
void AllServosOff(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, 0x0);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
void AllServosCenter(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
// See if this turns the motor off and I can turn it back on...
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, 0x1);
ax12ReadPacket(6); // git the response...
ax12SetRegister2(pgm_read_byte(&pgm_axdIDs[i]), AX_GOAL_POSITION_L, 0x1ff);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
void HoldOrFreeServos(byte fHold) {
word iServo;

if (!FGetNextCmdNum(&iServo)) {
// All servos...
for (int i = 0; i < NUM_SERVOS; i++) {
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, fHold);
ax12ReadPacket(6); // git the response...
}
}
else {
ax12SetRegister(iServo, AX_TORQUE_ENABLE, fHold);
ax12ReadPacket(6); // git the response...
}
}

//================================================== =====================================

//================================================== =====================================
void SetServoPosition(void) {
word w1;
word w2;

if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.

Serial.println("Set Servo Position");
if (FGetNextCmdNum(&w2)) { // We have at least 2 parameters
g_bServoID = w1; // So first is which servo
g_wServoGoalPos = w2;
if (FGetNextCmdNum(&w2)) { // We have at least 3 parameters
g_wServoGoalSpeed = w2;
ax12SetRegister2(g_bServoID, AX_GOAL_SPEED_L, g_wServoGoalSpeed);
ax12ReadPacket(6); // git the response...
Serial.print("Goal Speed: ");
Serial.print(g_wServoGoalSpeed, DEC);
}
}
else
g_wServoGoalPos = w1; // Only 1 paramter so assume it is the new position

// Now lets try moving that servo there
ax12SetRegister2(g_bServoID, AX_GOAL_POSITION_L, g_wServoGoalPos);
ax12ReadPacket(6); // git the response...
Serial.print(" ID: ");
Serial.print(g_bServoID, DEC);
Serial.print(" ");
Serial.println(g_wServoGoalPos, DEC);
}

//================================================== =====================================
void SetServoReturnDelayTime(void) {
word w1;
word w2;

if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.

if (!FGetNextCmdNum(&w2))
w2 = 0; // we will default to 0 (our desired)

Serial.print("Set Servo ID: ");
Serial.print(w1, DEC);
Serial.print(" return delay time: ");
Serial.println(w2, DEC);

// Now lets try moving that servo there
ax12SetRegister(w1, AX_RETURN_DELAY_TIME, w2);
ax12ReadPacket(6); // get the response...
}



//================================================== =====================================
void SetServoID(void) {
word w1;
word w2;

if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.

if (!FGetNextCmdNum(&w2))
return; // no parameters so bail.

Serial.print("Set Servo ID From: ");
Serial.print(w1, DEC);
Serial.print(" To: ");
Serial.println(w2, DEC);

// Now lets try moving that servo there
ax12SetRegister(w1, AX_ID, w2);
ax12ReadPacket(6); // git the response...
}


void WaitForMoveToComplete(word wID) {
do {
// delay(1);
}
while (ax12GetRegister(wID, AX_MOVING, 1));
}


//================================================== =====================================
void GetServoPositions(void) {

unsigned long ulBefore;
unsigned long ulDelta;
bioloid.readPose();
int w;
for (int i = 0; i < NUM_SERVOS; i++) {
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print(":");
ulBefore = micros();
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
ulDelta = micros() - ulBefore;
Serial.print(w, DEC);
Serial.print(" ");
Serial.print(ulDelta, DEC);
Serial.print(" ");
Serial.println(ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_RETURN_DELAY_TIME, 1), DEC);

if (w == (int)0xffff) {
Serial.print(" Retry: ");
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
Serial.println(w, DEC);
}
delay (100);
}
}


//================================================== =====================================
void FindServos(void) {

bioloid.readPose();
int w;
Serial.println("Begin: ");
for (int i = 0; i < 254; i++) {
w = ax12GetRegister(i, AX_PRESENT_POSITION_L, 2 );
if (w != (int)-1) {
Serial.print(i, DEC);
Serial.print(" - ");
Serial.println(w, DEC);
}
delay (100);
}
Serial.println("Done");
}
//================================================== =====================================
int g_asPositionsPrev[NUM_SERVOS];
int g_asMins[NUM_SERVOS];
int g_asMaxs[NUM_SERVOS];

void TrackServos(boolean fInit) {

bioloid.readPose();
int w;
bool fSomethingChanged = false;
for (int i = 0; i < NUM_SERVOS; i++) {
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
if (fInit) {
g_asMins[i] = w;
g_asMaxs[i] = w;
}
if (w != g_asPositionsPrev[i]) {
if (!fInit) {
// only print if we moved more than some delta...
if (abs(w-g_asPositionsPrev[i]) > 3) {
Serial.print(IKPinsNames[i]);
Serial.print("(");
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print("):");
Serial.print(w, DEC);
Serial.print("(");
Serial.print((((long)(w-512))*375L)/128L, DEC);
Serial.print(") ");
fSomethingChanged = true;
}
}
g_asPositionsPrev[i] = w;
if (g_asMins[i] > w)
g_asMins[i] = w;

if (g_asMaxs[i] < w)
g_asMaxs[i] = w;
}
}
if (fSomethingChanged)
Serial.println();
}

void TrackPrintMinsMaxs(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print(":");
Serial.print(g_asMins[i], DEC);
Serial.print("(");
Serial.print((((long)(g_asMins[i]-512))*375L)/128L, DEC);
Serial.print(") ");

Serial.print(g_asMaxs[i], DEC);
Serial.print("(");
Serial.print((((long)(g_asMaxs[i]-512))*375L)/128L, DEC);
Serial.println(")");
}
}


//================================================== =====================================
void PrintServoValues(void) {

word wID;
word w;
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
if (!FGetNextCmdNum(&wID))
return;
for (int i = 0; i < 50; i++) {
Serial.print(i, DEC);
Serial.print(":");
digitalWrite(A2, HIGH);
w = ax12GetRegister(wID, i, 1 );
digitalWrite(A2, LOW);
if (w == (word)-1)
digitalWrite(A3, !digitalRead(A3));
Serial.print(w, HEX);
Serial.print(" ");
if ((i%10) == 9)
Serial.println("");
Serial.flush(); // try to avoid any interrupts while processing.
delay(5);
}
}
//================================================== =====================================


//================================================== =====================================
boolean GetMultax12Registers(int id, int regstart, int length, uint8_t *pab){
uint8_t *pbT;
setTX(id);
// 0xFF 0xFF ID LENGTH INSTRUCTION PARAM... CHECKSUM
int checksum = ~((id + 6 + regstart + length)%256);
ax12writeB(0xFF);
ax12writeB(0xFF);
ax12writeB(id);
ax12writeB(4); // length
ax12writeB(AX_READ_DATA);
ax12writeB(regstart);
ax12writeB(length);
ax12writeB(checksum);
setRX(id);
// Should verify size of data actually read...
if(ax12ReadPacket(length + 6) > 0){
pbT = &ax_rx_buffer[5];
while (length--)
*pab++ = *pbT++; // copy the data
return true;
}
return false;
}


This is only the first tab of the program, you might have to include the 2nd tab, but I think it should work without it...

minimalfra
02-19-2017, 03:15 PM
KurtE, after upload correctly your bioloidserial libraries, this is the error that I received.


This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "ArbotiX"
In file included from AX12_Test.ino:12:
C:\Users\franc\OneDrive\Documenti\Arduino\librarie s\BioloidSerial-master/BioloidSerial.h:50: error: 'Serial1' was not declared in this scope
AX12_Test.ino: In function 'void setup()':
AX12_Test:139: error: 'Serial1' was not declared in this scope


68706871

KurtEck
02-19-2017, 03:33 PM
Oops,

As I mentioned, I for the most part only support the later 1.6.x or 1.8.x releases of Arduino. My libraries assume that the 2nd serial port on the Arbotix is actually setup as a standard Serial port and not the hacked up version that the earlier Arbotix code used which bypassed the queues and the like. Which is why it is not finding Serial1...

It is probably possible for you to hack up my test program and replace the

#include <ax12Serial.h>
#include <BioloidSerial.h>
With the

#include <ax12.h>
#include <BioloidController.h>
Of the earlier libraries. You may also need to modify the object definition:

BioloidControllerEx bioloid = BioloidControllerEx();
If I rmember correctly it used a one step init define...

BioloidController bioloid = BioloidController(1000000); // may use or not... may go direct to AX12// other globals.

And later I think you remove the 2nd phase of the init:

bioloid.begin(1000000, &AX_BUS_UART, SERVO_DIRECTION_PIN);
And then it might build on old system... Again I don't have that setup any longer.

minimalfra
02-19-2017, 04:06 PM
Oops,

As I mentioned, I for the most part only support the later 1.6.x or 1.8.x releases of Arduino. My libraries assume that the 2nd serial port on the Arbotix is actually setup as a standard Serial port and not the hacked up version that the earlier Arbotix code used which bypassed the queues and the like. Which is why it is not finding Serial1...

It is probably possible for you to hack up my test program and replace the

#include <ax12Serial.h>
#include <BioloidSerial.h>
With the

#include <ax12.h>
#include <BioloidController.h>
Of the earlier libraries. You may also need to modify the object definition:

BioloidControllerEx bioloid = BioloidControllerEx();
If I rmember correctly it used a one step init define...

BioloidController bioloid = BioloidController(1000000); // may use or not... may go direct to AX12// other globals.

And later I think you remove the 2nd phase of the init:

bioloid.begin(1000000, &AX_BUS_UART, SERVO_DIRECTION_PIN);
And then it might build on old system... Again I don't have that setup any longer.


I've commented the lines:111, 112, 139 but nothing.

About the release 1.0.6 of arduino, I've reinstalled that oldest to upload NUKE firmware but nothing also them.

About this: https://github.com/KurtE/DIY_XBee_DebugTerminal.git how can I use it with UARTsbee ?

KurtEck
02-19-2017, 04:44 PM
Sorry, I am not following: You say you commented lines... But in the above I had replace most of the lines and only comment out one line...

Not sure what you mean when you say nothing... Did it compile and properly download to the Arbotix?

If so, while the cable is still in place that you used to program the Arbotix, did you open the Serial Monitor? I believe it should be configured for 38400 baud rate. If you put the cursor in the input line and hit the CR does a bunch of text display? If not make sure line ending is set to something like both... Now does something display?

If so if you type 1<cr> does all of the servos respond?

Again Personally I would probably try Installing the latest version of Arduino. You can install in different spot... I normally install mine to Root directory, like: c:\arduino-1.8.1 So I can keep multiple versions of Arduino. I would then try their beta version of hardware folders... When I do this I play games and rename the <sketch folder>/hardware for the current 1.0.6 stuff to maybe <sketch folder>/hardware.106 and then put a new one with /hardware with the new stuff...

minimalfra
02-20-2017, 01:38 PM
I'm sorry, If I'm not clear...

1) I add your bioloidserial libreries correctly
2) when I try to verify your program Ax12_test, received that error. So I replaced that lines ad You Say me:

#include <ax12Serial.h>
#include <BioloidSerial.h>

With:

#include <ax12.h>
#include <BioloidController.h>

And commented on 139^ line

After these changes the error is always the same, forum this I've been tried to comment the 111 and 112 lines about the object definition.

I must be leave unchanged these last?

the corrected code:



//#define INCLUDE_TIMED_TESTS
//================================================== ==================================================
// Kurts Test program to try out different ways to manipulate the AX12 servos on the PhantomX
// This is a test, only a test...
//================================================== ==================================================
//================================================== ==========================
// Global Include files
//================================================== ===========================


#include <ax12.h>
#include <BioloidController.h>


//================================================== ===========================
// Options...
//================================================== ===========================


// Uncomment the next line if building for a Quad instead of a Hexapod.
//#define QUAD_MODE
//#define TURRET


//V0.2
//#define SERVO_DIRECTION_PIN -1
//#define SERVO_POWER_ENABLE_PIN 2


// V0.3
//#define SERVO_DIRECTION_PIN 2
//#define SERVO_POWER_ENABLE_PIN 3


#define AX_BUS_UART Serial1
#define VOLTAGE_ANALOG_PIN 0
#define SERVO1_SPECIAL 19 // We wish to reserve servo 1 so we can see servo reset


//================================================== ===========================
// Define differnt robots..
//================================================== ===========================


// Constants
/* Servo IDs */
#define RF_COXA 2
#define RF_FEMUR 4
#define RF_TIBIA 6


#define RM_COXA 14
#define RM_FEMUR 16
#define RM_TIBIA 18


#define RR_COXA 8
#define RR_FEMUR 10
#define RR_TIBIA 12


#ifdef SERVO1_SPECIAL
#define LF_COXA 19
#else
#define LF_COXA 1
#endif
#define LF_FEMUR 3
#define LF_TIBIA 5


#define LM_COXA 13
#define LM_FEMUR 15
#define LM_TIBIA 17


#define LR_COXA 7
#define LR_FEMUR 9
#define LR_TIBIA 11


#ifdef TURRET
#define TURRET_ROT 20
#define TURRET_TILT 21
#endif


static const byte pgm_axdIDs[] PROGMEM = {
LF_COXA, LF_FEMUR, LF_TIBIA,
#ifndef QUAD_MODE
LM_COXA, LM_FEMUR, LM_TIBIA,
#endif
LR_COXA, LR_FEMUR, LR_TIBIA,
RF_COXA, RF_FEMUR, RF_TIBIA,
#ifndef QUAD_MODE
RM_COXA, RM_FEMUR, RM_TIBIA,
#endif
RR_COXA, RR_FEMUR, RR_TIBIA
#ifdef TURRET
, TURRET_ROT, TURRET_TILT
#endif
};


#define NUM_SERVOS ((int)(sizeof(pgm_axdIDs)/sizeof(pgm_axdIDs[0])))
const char* IKPinsNames[] = {
"LFC","LFF","LFT",
#ifndef QUAD_MODE
"LMC","LMF","LMT",
#endif
"LRC","LRF","LRT",
"RFC","RFF","RFT",
#ifndef QUAD_MODE
"RMC","RMF","RMT",
#endif
"RRC","RRF","RRT",
#ifdef TURRET
"T-ROT", "T-TILT"
#endif
};
//================================================== ===========================
// Globals
//================================================== ===========================
// Global objects
/* IK Engine */
BioloidControllerEx bioloid = BioloidControllerEx();
//BioloidController bioloid = BioloidController(1000000); // may use or not... may go direct to AX12// other globals.
word g_wVoltage;
char g_aszCmdLine[80];
uint8_t g_iszCmdLine;
boolean g_fTrackServos = false;


// Values to use for servo position...
byte g_bServoID;
word g_wServoGoalPos;
word g_wServoGoalSpeed;


#ifndef SERVO_DIRECTION_PIN
#define SERVO_DIRECTION_PIN -1
#endif


//================================================== ==================================================
// Setup
//================================================== ==================================================
void setup() {
Serial.begin(38400); // start off the serial port.


delay(250);
pinMode(4, OUTPUT);
pinMode(1, OUTPUT);
digitalWrite(1, OUTPUT);
delay(250);


// bioloid.begin(1000000, &AX_BUS_UART, SERVO_DIRECTION_PIN);
bioloid.poseSize = NUM_SERVOS;


#ifdef SERVO_POWER_ENABLE_PIN
pinMode(SERVO_POWER_ENABLE_PIN, OUTPUT);
digitalWrite(SERVO_POWER_ENABLE_PIN, HIGH);
#endif
delay(1000);
Serial.print("System Voltage in 10ths: ");
Serial.println(g_wVoltage = ax12GetRegister(LF_COXA, AX_PRESENT_VOLTAGE, 1), DEC);


pinMode(A1, OUTPUT);
digitalWrite(A1, HIGH);

pinMode(6, OUTPUT);
digitalWrite(6, HIGH);
}


//================================================== ==================================================
// Loop
//================================================== ==================================================
void loop() {
// Output a prompt
word wNewVoltage = ax12GetRegister(LF_COXA, AX_PRESENT_VOLTAGE, 1);
if (wNewVoltage != g_wVoltage) {
g_wVoltage = wNewVoltage;
Serial.print("System Voltage in 10ths: ");
Serial.println(g_wVoltage, DEC);
}


// lets toss any charcters that are in the input queue
while(Serial.read() != -1)
;


Serial.println("0 - All Servos off");
Serial.println("1 - All Servos center");
Serial.println("2 - Set Servo position [<Servo>] <Position> [<Speed>]");
Serial.println("3 - Set Servo Angle");
Serial.println("4 - Get Servo Positions");
Serial.println("5 - Find All Servos");
Serial.println("6 - Set Servo return delay time");
Serial.println("8 - Set ID: <old> <new>");
Serial.println("9 - Print Servo Values");
Serial.println("t - Toggle track Servos");
Serial.println("h - hold [<sn>]");
Serial.println("f - free [<sn>]");
Serial.print(":");
Serial.flush(); // make sure the complete set of prompts has been output...
// Get a command
if (GetCommandLine()) {
Serial.println("");
Serial.print("Cmd: ");
Serial.println(g_aszCmdLine);
g_iszCmdLine = 1; // skip over first byte...
switch (g_aszCmdLine[0]) {
case '0':
AllServosOff();
break;
case '1':
AllServosCenter();
break;
case '2':
SetServoPosition();
break;
case '3':
break;
case '4':
GetServoPositions();
break;
case '5':
FindServos();
break;
case '6':
SetServoReturnDelayTime();
break;
case '8':
SetServoID();
break;
case '9':
PrintServoValues();
break;
case 'f':
case 'F':
HoldOrFreeServos(0);
break;
case 'h':
case 'H':
HoldOrFreeServos(1);
break;
#if INCLUDE_TIMED_TESTS
case 'm':
TimedMove2();
break;
case 'n':
TimedMove3();
break;
#endif


case 't':
case 'T':
g_fTrackServos = !g_fTrackServos;
if (g_fTrackServos) {
Serial.println("Tracking On");
TrackServos(true); // call to initialize all of the positions.
}
else
Serial.println("Tracking Off");
TrackPrintMinsMaxs();
break;
}
}
}


// Helper function to read in a command line
uint8_t GetCommandLine(void) {
int ch;
uint8_t ich = 0;
g_iszCmdLine = 0;


for(;;) {
// throw away any thing less than CR character...
ch = Serial.read();
if ((ch >= 10) && (ch <=15)) {
g_aszCmdLine[ich] = 0;
return ich;
}
if (ch != -1)
g_aszCmdLine[ich++] = ch;


if (g_fTrackServos)
TrackServos(false);
}
}


//
boolean FGetNextCmdNum(word *pw ) {
// Skip all leading num number characters...
while ((g_aszCmdLine[g_iszCmdLine] < '0') || (g_aszCmdLine[g_iszCmdLine] > '9')) {
if (g_aszCmdLine[g_iszCmdLine] == 0)
return false; // end of the line...
g_iszCmdLine++;
}
*pw = 0;
while ((g_aszCmdLine[g_iszCmdLine] >= '0') && (g_aszCmdLine[g_iszCmdLine] <= '9')) {
*pw = *pw * 10 + (g_aszCmdLine[g_iszCmdLine] - '0');
g_iszCmdLine++;
}
return true;
}

//================================================== =====================================
void AllServosOff(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, 0x0);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
void AllServosCenter(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
// See if this turns the motor off and I can turn it back on...
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, 0x1);
ax12ReadPacket(6); // git the response...
ax12SetRegister2(pgm_read_byte(&pgm_axdIDs[i]), AX_GOAL_POSITION_L, 0x1ff);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
void HoldOrFreeServos(byte fHold) {
word iServo;


if (!FGetNextCmdNum(&iServo)) {
// All servos...
for (int i = 0; i < NUM_SERVOS; i++) {
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, fHold);
ax12ReadPacket(6); // git the response...
}
}
else {
ax12SetRegister(iServo, AX_TORQUE_ENABLE, fHold);
ax12ReadPacket(6); // git the response...
}
}


//================================================== =====================================

//================================================== =====================================
void SetServoPosition(void) {
word w1;
word w2;


if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.


Serial.println("Set Servo Position");
if (FGetNextCmdNum(&w2)) { // We have at least 2 parameters
g_bServoID = w1; // So first is which servo
g_wServoGoalPos = w2;
if (FGetNextCmdNum(&w2)) { // We have at least 3 parameters
g_wServoGoalSpeed = w2;
ax12SetRegister2(g_bServoID, AX_GOAL_SPEED_L, g_wServoGoalSpeed);
ax12ReadPacket(6); // git the response...
Serial.print("Goal Speed: ");
Serial.print(g_wServoGoalSpeed, DEC);
}
}
else
g_wServoGoalPos = w1; // Only 1 paramter so assume it is the new position


// Now lets try moving that servo there
ax12SetRegister2(g_bServoID, AX_GOAL_POSITION_L, g_wServoGoalPos);
ax12ReadPacket(6); // git the response...
Serial.print(" ID: ");
Serial.print(g_bServoID, DEC);
Serial.print(" ");
Serial.println(g_wServoGoalPos, DEC);
}

//================================================== =====================================
void SetServoReturnDelayTime(void) {
word w1;
word w2;


if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.


if (!FGetNextCmdNum(&w2))
w2 = 0; // we will default to 0 (our desired)


Serial.print("Set Servo ID: ");
Serial.print(w1, DEC);
Serial.print(" return delay time: ");
Serial.println(w2, DEC);


// Now lets try moving that servo there
ax12SetRegister(w1, AX_RETURN_DELAY_TIME, w2);
ax12ReadPacket(6); // get the response...
}


//================================================== =====================================
void SetServoID(void) {
word w1;
word w2;


if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.


if (!FGetNextCmdNum(&w2))
return; // no parameters so bail.


Serial.print("Set Servo ID From: ");
Serial.print(w1, DEC);
Serial.print(" To: ");
Serial.println(w2, DEC);


// Now lets try moving that servo there
ax12SetRegister(w1, AX_ID, w2);
ax12ReadPacket(6); // git the response...
}


void WaitForMoveToComplete(word wID) {
do {
// delay(1);
}
while (ax12GetRegister(wID, AX_MOVING, 1));
}


//================================================== =====================================
void GetServoPositions(void) {


unsigned long ulBefore;
unsigned long ulDelta;
bioloid.readPose();
int w;
for (int i = 0; i < NUM_SERVOS; i++) {
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print(":");
ulBefore = micros();
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
ulDelta = micros() - ulBefore;
Serial.print(w, DEC);
Serial.print(" ");
Serial.print(ulDelta, DEC);
Serial.print(" ");
Serial.println(ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_RETURN_DELAY_TIME, 1), DEC);


if (w == 0xffff) {
Serial.print(" Retry: ");
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
Serial.println(w, DEC);
}
delay (100);
}
}


//================================================== =====================================
void FindServos(void) {


bioloid.readPose();
int w;
Serial.println("Begin: ");
for (int i = 0; i < 254; i++) {
w = ax12GetRegister(i, AX_PRESENT_POSITION_L, 2 );
if (w != (int)-1) {
Serial.print(i, DEC);
Serial.print(" - ");
Serial.println(w, DEC);
}
delay (100);
}
Serial.println("Done");
}
//================================================== =====================================
int g_asPositionsPrev[NUM_SERVOS];
int g_asMins[NUM_SERVOS];
int g_asMaxs[NUM_SERVOS];


void TrackServos(boolean fInit) {


bioloid.readPose();
int w;
bool fSomethingChanged = false;
for (int i = 0; i < NUM_SERVOS; i++) {
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
if (fInit) {
g_asMins[i] = w;
g_asMaxs[i] = w;
}
if (w != g_asPositionsPrev[i]) {
if (!fInit) {
// only print if we moved more than some delta...
if (abs(w-g_asPositionsPrev[i]) > 3) {
Serial.print(IKPinsNames[i]);
Serial.print("(");
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print("):");
Serial.print(w, DEC);
Serial.print("(");
Serial.print((((long)(w-512))*375L)/128L, DEC);
Serial.print(") ");
fSomethingChanged = true;
}
}
g_asPositionsPrev[i] = w;
if (g_asMins[i] > w)
g_asMins[i] = w;


if (g_asMaxs[i] < w)
g_asMaxs[i] = w;
}
}
if (fSomethingChanged)
Serial.println();
}


void TrackPrintMinsMaxs(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print(":");
Serial.print(g_asMins[i], DEC);
Serial.print("(");
Serial.print((((long)(g_asMins[i]-512))*375L)/128L, DEC);
Serial.print(") ");


Serial.print(g_asMaxs[i], DEC);
Serial.print("(");
Serial.print((((long)(g_asMaxs[i]-512))*375L)/128L, DEC);
Serial.println(")");
}
}


//================================================== =====================================
void PrintServoValues(void) {


word wID;
word w;
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
if (!FGetNextCmdNum(&wID))
return;
for (int i = 0; i < 50; i++) {
Serial.print(i, DEC);
Serial.print(":");
digitalWrite(A2, HIGH);
w = ax12GetRegister(wID, i, 1 );
digitalWrite(A2, LOW);
if (w == (word)-1)
digitalWrite(A3, !digitalRead(A3));
Serial.print(w, HEX);
Serial.print(" ");
if ((i%10) == 9)
Serial.println("");
Serial.flush(); // try to avoid any interrupts while processing.
delay(5);
}
}
//================================================== =====================================


//================================================== =====================================
boolean GetMultax12Registers(int id, int regstart, int length, uint8_t *pab){
uint8_t *pbT;
setTX(id);
// 0xFF 0xFF ID LENGTH INSTRUCTION PARAM... CHECKSUM
int checksum = ~((id + 6 + regstart + length)%256);
ax12writeB(0xFF);
ax12writeB(0xFF);
ax12writeB(id);
ax12writeB(4); // length
ax12writeB(AX_READ_DATA);
ax12writeB(regstart);
ax12writeB(length);
ax12writeB(checksum);
setRX(id);
// Should verify size of data actually read...
if(ax12ReadPacket(length + 6) > 0){
pbT = &ax_rx_buffer[5];
while (length--)
*pab++ = *pbT++; // copy the data
return true;
}
return false;
}

and this is the error:


This report would have more information with "Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "ArbotiX"
AX12_Test:111: error: 'BioloidControllerEx' does not name a type
AX12_Test.ino: In function 'void setup()':
AX12_Test:140: error: 'bioloid' was not declared in this scope
AX12_Test.ino: In function 'void GetServoPositions()':
AX12_Test:416: error: 'bioloid' was not declared in this scope
AX12_Test.ino: In function 'void FindServos()':
AX12_Test:443: error: 'bioloid' was not declared in this scope
AX12_Test.ino: In function 'void TrackServos(boolean)':
AX12_Test:464: error: 'bioloid' was not declared in this scope

So after uploaded AX12_test on arbotix-m, always with bioloidserialI and the arduino serial monitor I can controll my hexapod by uartsbee with Xbee Commander wired to pc? It's right?

About a newest Arduino IDE, I think to have some problems, because maybe I haven't the arbotix libreries updated.

After that's all, what is this other file: https://github.com/KurtE/DIY_XBee_DebugTerminal.git ?

Thank You, forum your patience

KurtEck
02-20-2017, 06:16 PM
To verify that the instructions should have worked. I went over to my Intel UP board, booted Windows 10, downloaded Arduino 1.0.6
I then went to trossen instructions and downloaded libraries and hardware for the 1.0.6, and extracted into sketchfolder and appropriate subdirectories.

I then went up to GitHub and downloaded my ax12_Test project as zip file and then unzipped into sketch folder. I renamed to remove the -Master suffix off the name.

I then edited I believe the way I mentioned and I was able to download to Arbotix-m board, which I have jumped to Quad.



//#define INCLUDE_TIMED_TESTS
//================================================== ==================================================
// Kurts Test program to try out different ways to manipulate the AX12 servos on the PhantomX
// This is a test, only a test...
//================================================== ==================================================
//================================================== ==========================
// Global Include files
//================================================== ===========================
#include <ax12.h>
#include <BioloidController.h>
//================================================== ===========================
// Options...
//================================================== ===========================
// Uncomment the next line if building for a Quad instead of a Hexapod.
//#define QUAD_MODE
//#define TURRET
//V0.2
//#define SERVO_DIRECTION_PIN -1
//#define SERVO_POWER_ENABLE_PIN 2

// V0.3
//#define SERVO_DIRECTION_PIN 2
//#define SERVO_POWER_ENABLE_PIN 3
#define AX_BUS_UART Serial1
#define VOLTAGE_ANALOG_PIN 0
#define SERVO1_SPECIAL 19 // We wish to reserve servo 1 so we can see servo reset
//================================================== ===========================
// Define differnt robots..
//================================================== ===========================
// Constants
/* Servo IDs */
#define RF_COXA 2
#define RF_FEMUR 4
#define RF_TIBIA 6
#define RM_COXA 14
#define RM_FEMUR 16
#define RM_TIBIA 18
#define RR_COXA 8
#define RR_FEMUR 10
#define RR_TIBIA 12
#ifdef SERVO1_SPECIAL
#define LF_COXA 19
#else
#define LF_COXA 1
#endif
#define LF_FEMUR 3
#define LF_TIBIA 5
#define LM_COXA 13
#define LM_FEMUR 15
#define LM_TIBIA 17
#define LR_COXA 7
#define LR_FEMUR 9
#define LR_TIBIA 11
#ifdef TURRET
#define TURRET_ROT 20
#define TURRET_TILT 21
#endif
static const byte pgm_axdIDs[] PROGMEM = {
LF_COXA, LF_FEMUR, LF_TIBIA,
#ifndef QUAD_MODE
LM_COXA, LM_FEMUR, LM_TIBIA,
#endif
LR_COXA, LR_FEMUR, LR_TIBIA,
RF_COXA, RF_FEMUR, RF_TIBIA,
#ifndef QUAD_MODE
RM_COXA, RM_FEMUR, RM_TIBIA,
#endif
RR_COXA, RR_FEMUR, RR_TIBIA
#ifdef TURRET
, TURRET_ROT, TURRET_TILT
#endif
};
#define NUM_SERVOS ((int)(sizeof(pgm_axdIDs)/sizeof(pgm_axdIDs[0])))
const char* IKPinsNames[] = {
"LFC","LFF","LFT",
#ifndef QUAD_MODE
"LMC","LMF","LMT",
#endif
"LRC","LRF","LRT",
"RFC","RFF","RFT",
#ifndef QUAD_MODE
"RMC","RMF","RMT",
#endif
"RRC","RRF","RRT",
#ifdef TURRET
"T-ROT", "T-TILT"
#endif
};
//================================================== ===========================
// Globals
//================================================== ===========================
// Global objects
/* IK Engine */
//BioloidControllerEx bioloid = BioloidControllerEx();
BioloidController bioloid = BioloidController(1000000); // may use or not... may go direct to AX12// other globals.
word g_wVoltage;
char g_aszCmdLine[80];
uint8_t g_iszCmdLine;
boolean g_fTrackServos = false;
// Values to use for servo position...
byte g_bServoID;
word g_wServoGoalPos;
word g_wServoGoalSpeed;
#ifndef SERVO_DIRECTION_PIN
#define SERVO_DIRECTION_PIN -1
#endif
//================================================== ==================================================
// Setup
//================================================== ==================================================
void setup() {
Serial.begin(38400); // start off the serial port.
delay(250);
pinMode(4, OUTPUT);
pinMode(1, OUTPUT);
digitalWrite(1, OUTPUT);
delay(250);
// bioloid.begin(1000000, &AX_BUS_UART, SERVO_DIRECTION_PIN);
bioloid.poseSize = NUM_SERVOS;
#ifdef SERVO_POWER_ENABLE_PIN
pinMode(SERVO_POWER_ENABLE_PIN, OUTPUT);
digitalWrite(SERVO_POWER_ENABLE_PIN, HIGH);
#endif
delay(1000);
Serial.print("System Voltage in 10ths: ");
Serial.println(g_wVoltage = ax12GetRegister(LF_COXA, AX_PRESENT_VOLTAGE, 1), DEC);
pinMode(A1, OUTPUT);
digitalWrite(A1, HIGH);

pinMode(6, OUTPUT);
digitalWrite(6, HIGH);
}

//================================================== ==================================================
// Loop
//================================================== ==================================================
void loop() {
// Output a prompt
word wNewVoltage = ax12GetRegister(LF_COXA, AX_PRESENT_VOLTAGE, 1);
if (wNewVoltage != g_wVoltage) {
g_wVoltage = wNewVoltage;
Serial.print("System Voltage in 10ths: ");
Serial.println(g_wVoltage, DEC);
}
// lets toss any charcters that are in the input queue
while(Serial.read() != -1)
;
Serial.println("0 - All Servos off");
Serial.println("1 - All Servos center");
Serial.println("2 - Set Servo position [<Servo>] <Position> [<Speed>]");
Serial.println("3 - Set Servo Angle");
Serial.println("4 - Get Servo Positions");
Serial.println("5 - Find All Servos");
Serial.println("6 - Set Servo return delay time");
Serial.println("8 - Set ID: <old> <new>");
Serial.println("9 - Print Servo Values");
Serial.println("t - Toggle track Servos");
Serial.println("h - hold [<sn>]");
Serial.println("f - free [<sn>]");
Serial.print(":");
Serial.flush(); // make sure the complete set of prompts has been output...
// Get a command
if (GetCommandLine()) {
Serial.println("");
Serial.print("Cmd: ");
Serial.println(g_aszCmdLine);
g_iszCmdLine = 1; // skip over first byte...
switch (g_aszCmdLine[0]) {
case '0':
AllServosOff();
break;
case '1':
AllServosCenter();
break;
case '2':
SetServoPosition();
break;
case '3':
break;
case '4':
GetServoPositions();
break;
case '5':
FindServos();
break;
case '6':
SetServoReturnDelayTime();
break;
case '8':
SetServoID();
break;
case '9':
PrintServoValues();
break;
case 'f':
case 'F':
HoldOrFreeServos(0);
break;
case 'h':
case 'H':
HoldOrFreeServos(1);
break;
#if INCLUDE_TIMED_TESTS
case 'm':
TimedMove2();
break;
case 'n':
TimedMove3();
break;
#endif
case 't':
case 'T':
g_fTrackServos = !g_fTrackServos;
if (g_fTrackServos) {
Serial.println("Tracking On");
TrackServos(true); // call to initialize all of the positions.
}
else
Serial.println("Tracking Off");
TrackPrintMinsMaxs();
break;
}
}
}
// Helper function to read in a command line
uint8_t GetCommandLine(void) {
int ch;
uint8_t ich = 0;
g_iszCmdLine = 0;
for(;;) {
// throw away any thing less than CR character...
ch = Serial.read();
if ((ch >= 10) && (ch <=15)) {
g_aszCmdLine[ich] = 0;
return ich;
}
if (ch != -1)
g_aszCmdLine[ich++] = ch;
if (g_fTrackServos)
TrackServos(false);
}
}
//
boolean FGetNextCmdNum(word *pw ) {
// Skip all leading num number characters...
while ((g_aszCmdLine[g_iszCmdLine] < '0') || (g_aszCmdLine[g_iszCmdLine] > '9')) {
if (g_aszCmdLine[g_iszCmdLine] == 0)
return false; // end of the line...
g_iszCmdLine++;
}
*pw = 0;
while ((g_aszCmdLine[g_iszCmdLine] >= '0') && (g_aszCmdLine[g_iszCmdLine] <= '9')) {
*pw = *pw * 10 + (g_aszCmdLine[g_iszCmdLine] - '0');
g_iszCmdLine++;
}
return true;
}
//================================================== =====================================
void AllServosOff(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, 0x0);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
void AllServosCenter(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
// See if this turns the motor off and I can turn it back on...
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, 0x1);
ax12ReadPacket(6); // git the response...
ax12SetRegister2(pgm_read_byte(&pgm_axdIDs[i]), AX_GOAL_POSITION_L, 0x1ff);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
void HoldOrFreeServos(byte fHold) {
word iServo;
if (!FGetNextCmdNum(&iServo)) {
// All servos...
for (int i = 0; i < NUM_SERVOS; i++) {
ax12SetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_TORQUE_ENABLE, fHold);
ax12ReadPacket(6); // git the response...
}
}
else {
ax12SetRegister(iServo, AX_TORQUE_ENABLE, fHold);
ax12ReadPacket(6); // git the response...
}
}
//================================================== =====================================
//================================================== =====================================
void SetServoPosition(void) {
word w1;
word w2;
if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.
Serial.println("Set Servo Position");
if (FGetNextCmdNum(&w2)) { // We have at least 2 parameters
g_bServoID = w1; // So first is which servo
g_wServoGoalPos = w2;
if (FGetNextCmdNum(&w2)) { // We have at least 3 parameters
g_wServoGoalSpeed = w2;
ax12SetRegister2(g_bServoID, AX_GOAL_SPEED_L, g_wServoGoalSpeed);
ax12ReadPacket(6); // git the response...
Serial.print("Goal Speed: ");
Serial.print(g_wServoGoalSpeed, DEC);
}
}
else
g_wServoGoalPos = w1; // Only 1 paramter so assume it is the new position
// Now lets try moving that servo there
ax12SetRegister2(g_bServoID, AX_GOAL_POSITION_L, g_wServoGoalPos);
ax12ReadPacket(6); // git the response...
Serial.print(" ID: ");
Serial.print(g_bServoID, DEC);
Serial.print(" ");
Serial.println(g_wServoGoalPos, DEC);
}
//================================================== =====================================
void SetServoReturnDelayTime(void) {
word w1;
word w2;
if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.
if (!FGetNextCmdNum(&w2))
w2 = 0; // we will default to 0 (our desired)
Serial.print("Set Servo ID: ");
Serial.print(w1, DEC);
Serial.print(" return delay time: ");
Serial.println(w2, DEC);
// Now lets try moving that servo there
ax12SetRegister(w1, AX_RETURN_DELAY_TIME, w2);
ax12ReadPacket(6); // get the response...
}

//================================================== =====================================
void SetServoID(void) {
word w1;
word w2;
if (!FGetNextCmdNum(&w1))
return; // no parameters so bail.
if (!FGetNextCmdNum(&w2))
return; // no parameters so bail.
Serial.print("Set Servo ID From: ");
Serial.print(w1, DEC);
Serial.print(" To: ");
Serial.println(w2, DEC);
// Now lets try moving that servo there
ax12SetRegister(w1, AX_ID, w2);
ax12ReadPacket(6); // git the response...
}

void WaitForMoveToComplete(word wID) {
do {
// delay(1);
}
while (ax12GetRegister(wID, AX_MOVING, 1));
}

//================================================== =====================================
void GetServoPositions(void) {
unsigned long ulBefore;
unsigned long ulDelta;
bioloid.readPose();
int w;
for (int i = 0; i < NUM_SERVOS; i++) {
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print(":");
ulBefore = micros();
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
ulDelta = micros() - ulBefore;
Serial.print(w, DEC);
Serial.print(" ");
Serial.print(ulDelta, DEC);
Serial.print(" ");
Serial.println(ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_RETURN_DELAY_TIME, 1), DEC);
if (w == 0xffff) {
Serial.print(" Retry: ");
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
Serial.println(w, DEC);
}
delay (100);
}
}

//================================================== =====================================
void FindServos(void) {
bioloid.readPose();
int w;
Serial.println("Begin: ");
for (int i = 0; i < 254; i++) {
w = ax12GetRegister(i, AX_PRESENT_POSITION_L, 2 );
if (w != (int)-1) {
Serial.print(i, DEC);
Serial.print(" - ");
Serial.println(w, DEC);
}
delay (100);
}
Serial.println("Done");
}
//================================================== =====================================
int g_asPositionsPrev[NUM_SERVOS];
int g_asMins[NUM_SERVOS];
int g_asMaxs[NUM_SERVOS];
void TrackServos(boolean fInit) {
bioloid.readPose();
int w;
bool fSomethingChanged = false;
for (int i = 0; i < NUM_SERVOS; i++) {
w = ax12GetRegister(pgm_read_byte(&pgm_axdIDs[i]), AX_PRESENT_POSITION_L, 2 );
if (fInit) {
g_asMins[i] = w;
g_asMaxs[i] = w;
}
if (w != g_asPositionsPrev[i]) {
if (!fInit) {
// only print if we moved more than some delta...
if (abs(w-g_asPositionsPrev[i]) > 3) {
Serial.print(IKPinsNames[i]);
Serial.print("(");
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print("):");
Serial.print(w, DEC);
Serial.print("(");
Serial.print((((long)(w-512))*375L)/128L, DEC);
Serial.print(") ");
fSomethingChanged = true;
}
}
g_asPositionsPrev[i] = w;
if (g_asMins[i] > w)
g_asMins[i] = w;
if (g_asMaxs[i] < w)
g_asMaxs[i] = w;
}
}
if (fSomethingChanged)
Serial.println();
}
void TrackPrintMinsMaxs(void) {
for (int i = 0; i < NUM_SERVOS; i++) {
Serial.print((byte)pgm_read_byte(&pgm_axdIDs[i]), DEC);
Serial.print(":");
Serial.print(g_asMins[i], DEC);
Serial.print("(");
Serial.print((((long)(g_asMins[i]-512))*375L)/128L, DEC);
Serial.print(") ");
Serial.print(g_asMaxs[i], DEC);
Serial.print("(");
Serial.print((((long)(g_asMaxs[i]-512))*375L)/128L, DEC);
Serial.println(")");
}
}

//================================================== =====================================
void PrintServoValues(void) {
word wID;
word w;
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
if (!FGetNextCmdNum(&wID))
return;
for (int i = 0; i < 50; i++) {
Serial.print(i, DEC);
Serial.print(":");
digitalWrite(A2, HIGH);
w = ax12GetRegister(wID, i, 1 );
digitalWrite(A2, LOW);
if (w == (word)-1)
digitalWrite(A3, !digitalRead(A3));
Serial.print(w, HEX);
Serial.print(" ");
if ((i%10) == 9)
Serial.println("");
Serial.flush(); // try to avoid any interrupts while processing.
delay(5);
}
}
//================================================== =====================================

//================================================== =====================================
boolean GetMultax12Registers(int id, int regstart, int length, uint8_t *pab){
uint8_t *pbT;
setTX(id);
// 0xFF 0xFF ID LENGTH INSTRUCTION PARAM... CHECKSUM
int checksum = ~((id + 6 + regstart + length)%256);
ax12writeB(0xFF);
ax12writeB(0xFF);
ax12writeB(id);
ax12writeB(4); // length
ax12writeB(AX_READ_DATA);
ax12writeB(regstart);
ax12writeB(length);
ax12writeB(checksum);
setRX(id);
// Should verify size of data actually read...
if(ax12ReadPacket(length + 6) > 0){
pbT = &ax_rx_buffer[5];
while (length--)
*pab++ = *pbT++; // copy the data
return true;
}
return false;
}








Note I used the programmer to reprogram the bootloader as a way to use standard stuff... So I did the program and then opened the Serial monitor. I had to configure for 38400 baud rate and Both NL ^ CR.

So when I open the terminal I was able to talk to my servos... Again Only 12 servos as quad...

Again at that point, was able to enter: 4<cr>
Again <CR> is not the actual characters but simply hitting the enter key on your keyboard... Also again you need to have the text cursor in the text entry field at top of monitor window.

Note: If you get that to work, if you hit 1<cr> it should make all of the servo go to a default location and hold...
You can then maybe hit 0<cr> which frees up the servos... you can then hit: t<cr> to turn on tracking mode. In tracking mode it tries to continuously query all of their servos for their current location. If some move it will tell that they moved by giving a semi-cryptic name for each servo plus new location....

Again assuming you are using the Serial cable to program your Arbotix and not a programmer, to run this above program you simply leave the hardware as you have it and then play in the monitor window ... This does not have any code to actuall make the robot walk.
You can move individual servos, by using the 2 command. Like: 2 2 600<cr>
Will move servo 2 to position 600

KurtEck
02-20-2017, 07:06 PM
Note: I saved a copy of the above sketch in the Ax12_Test project as a new Branch (Arduino1.0.6-Version)

KurtEck
02-21-2017, 05:45 PM
Another quick update. It has been a long time since I played with the Arbotix and it does appear like the program is resetting when you try to do many moves. Will try to take some time to help debug it.

I set up the Quad with the Arbotix and have now tried it with Arduino 1.0.6 as well as a 1.6.13... And there are some faults going on.

I am still in the process of hacking up on the UP board to run everything. For example I do have both the Arbotix board and the Commander plugged in to my UP board (USB) and I am running my VB app with Serial forwarding. So I can do things like Serial.println("Startup");
And it will show up in this window...

The VB app I am using is in my Phantom_Arm github project. It is nothing fancy. But taking me awhile to get it to run natively as I did not have Visual studio installed on the UP.. But did copy an exe over from my main dev machine.

Actually might simply be easier to move the Arbotix stuff back to main machine. So can use LA to maybe instrument more with digitalWrites to localize where it may be resetting...

Curious: When I build it on my main machine, I am not seeing the resets... Need to figure out where differences are...

jwatte
02-22-2017, 12:39 AM
How do you power the Arbotix? When you say you "move it," do you use USB power? If so, the UP board may not provide enough power, and you may want to power the board from another source.

KurtEck
02-22-2017, 09:15 AM
Hi Jwatte,

The UP board was powered by a wall wart 4amp 5v... The only USB going to the setup was a USB to FTDI cable, which is being used to program it and as Serial object. Other USB devices: I was also powering the Arbotix Commander through USB, so I had the two Comm ports, to tie to each other, wifi and probably a BT dongle on the board as well, and mouse and keyboard. The up was acting fine, as I was running Windows 10 on it and there were no issues with the display (TV)

The Arbotix and servos were powered by different Wall wart, a 5amp 12v one that came with PhantomX. The PhantomX (Quad) is sitting on an empty Kirkland unsalted Cashews jar so the servos are not under stress, so the 5Amp should be sufficient.

What I am trying to do is to see if the problems that some people are running into and I was not, is maybe due to differences on my machine. Like maybe changes I have made but not checked in... Or maybe due to using different compilers or... I would probably be better off doing it on my 2ndary machine (Mac) than the UP, but thought I would give it a try.

On the UP, I added a Serial.println("...") in the Setup code after the commander (i.e. serial) is initialized and I was picking up these messages in my VB app display, so I know that the AVR processor is resetting and not simply loosing communications to the commander or thinking the power was going too low and turning off.

Will play some more on main machine using 1.8.1 and may update UP board to 1.8.1 (it had 1.6.13 I believe). I may also update my MAC to 1.8.1 plus in this case try to download the software that Trossen (Kyle) modified of my Arbotix 1.6 branch and see if that works...

At times it sure would be nice to be able to setup Arduino for debugger, so you can see where the code is faulting.

jwatte
02-22-2017, 10:58 AM
If the power is the same in both cases, I don't know what could cause it to reset more when connected to the UP than to the Windows machine, sorry. Hope you figure it out!

minimalfra
02-22-2017, 12:51 PM
Hi Kurt, your correction it's ok. ;)
but I haven't loaded yet on arbotix because of the time available.

Can You give me an answer about this?

https://github.com/KurtE/DIY_XBee_DebugTerminal.git[/URL] ?


And how can I put the code in a SCROLLBOX???

Zenta
02-23-2017, 05:09 AM
And how can I put the code in a SCROLLBOX???

Click advanced reply and select # to wrap [CODE] tags around selected text.

KurtEck
02-23-2017, 04:38 PM
Hi again, not sure what you are asking for?

My VB app that I have used to debug doing some stuff is actually part of the project: https://github.com/KurtE/Phantom_Arm
The obvious problems of using this app is it only works on windows...

Again if you are simply wanting to test the servos, with the AX12... program I have, you simply need a serial connection to your pc. i.e. the one you used to program it. You should then be able to use the Serial Monitor to talk to the board... Again nothing special here just some simple tests to that uses the Bioloid library to talk to the servos. As I mentioned I put a branch up that uses these libraries instead of my BioloidSerial.

Today on my MAC, I tried:
Download Arduino 1.8.1
Follow Kyle's instuctions up at: http://forums.trossenrobotics.com/showthread.php?7971-ArbotiX-1-6-Files-Libraries&p=71992&highlight=#post71992

Alternatively to download zip, you can grab the stuff from github: https://github.com/Interbotix/arbotix/commits/arduino-1-6

On my MAC, in my Arduino folder, I renamed the hardware folder to something else like hardware.106 Likewise I renamed the libraries folder to something like libraries.106

I then copied the hardware and libraries folders from the zip file (or github stuff) into my Arduino folder.

I then built the Phantom_Phoenix project on the MAC and uploaded to (Quad as if HEX). I then plugged in the XBee (unplugged Serial port) and XBee in Commander and turned on Commander. At this point the robot woke up. I used the left most switch held down and moved the right joystick (up or down) and saw the legs extend down (I am still on stand). I then released the left most button and joystick and when I move the joystick, the PhantomX looks like it wants to walk... There were not resets detected...

I did upload a few changes, including turning off the voltage checking, plus changes to build on mac / vs \ and also changes that allow more Teensy processors to work...

So again I would suggest doing something similar and see if this works for you. If not again it would be good to see if the AX12 test program can talk to your servos.

minimalfra
02-24-2017, 06:05 AM
Hi kurtE, I've tried AX12_test, the app it's functioning, but It seems that all' servos are off.

The servo's red led, blink one time when switched on and the buzzer makes a continuous beep...

KurtEck
02-24-2017, 09:16 AM
When you say functioning, are you saying that you get stuff properly displaying in the Serial monitor?

When you first connect power all of the servos blink once? That is normal servo behavior. It lets you know that servos receive power.

Beep... Not sure. However I had several digital Writes going on in the test program to help debug stuff if you have something like a Logic Analyzer to help debug code flow.

But: I also looked at the updated PhantomX assembly guide and noticed they now show an optional RobotGeek buzzer that can be installed. There instructions say install it to the pin D7... The Phoenix code has been typically setup for a buzzer on D1. So always possible running into some debug stuff using D7 for testing which is causing the beep. Anyway try moving the buzzer to D1.

Also when you said all servos were off. Again defaults to this in the code.
Did you try entering: 1<cr>
Again <cr> is hit the return key. Did it echo anything in the Serial output? If not make sure Serial monitor is configured to output both the CR LF characters. There is an option at bottom of monitor window, which I think defaults to none

Edit: Forgot to mention, I updated the test program to hopefully make the debug toggles to be optional, plus defined a symbol: SOUND_PIN set to 1, which changed code to use instead of hard coded 1. Also made some other pinMode/digitalWrite calls optional...
So you might want to update.

Also when you tried it, are you still using 1.0.6?

minimalfra
02-24-2017, 03:53 PM
Yes, I will upgrade again to 1.6.13 as soon as will I've more time... ;)

so this is the situation with serial monitor... :$


688468856886

KurtEck
02-24-2017, 06:07 PM
From what I can tell, your servos are not working at all?

I retried running the AX12 program with Arduino 1.0.6 using the libraries and hardware defines from the Trossen webpage. I then changed my AX12 test program to default to using ax12.h and bioloidController.h if i am not building on a Teensy....

I ran it again on my Quad (compiled for Hex) and it worked fine. When I hit the 1 command, all of the servos went to their default locations, like: 6887
I could then query the servo positions and the like.

So if this is not happening on your Hex following similar steps, might need to stand back and check a few more things.

Like: What power are you feeding to the system? Are you providing 12v wall wart or 3s Lipo power to the system?
Have you measured the power to make sure?

I would then try disconnecting all of the servos and then maybe try to connect just 1 leg and then try the find all servos (and or get servo positions command) and see if it finds the 3 servos for that leg, if not try a different leg... If it finds the ones of one leg plug in another leg and try... If none of the legs fully work, disconnect the cables from the first servo of a leg to only have the coxa servo connected and see if it can find it.

Again I assume you set all of the servo IDS to match the servos that are in the PhantomX MK3 build manual?

minimalfra
02-25-2017, 08:22 AM
The only difference, with your configuration It seems to be the Yellow jumper from D15 to A7

it's maybe possible that some cable are damaged? I think about bot, because if that was the case, it wouldn't be switched on. You know?

KurtEck
02-25-2017, 08:27 AM
Yes that is one of several possibilities. Which is one of the reasons to do the steps I mentioned in previous posting.

Some of the other things include:

Also be wrong voltage power supply coming in. Example a 5v wall wart, which is enough to run a processor, but not enough to run the servos (been there, done that). Or trying to run on a Lipo battery that has run to a really low voltage (if it is that low it is probably unsafe to use...) Also check the jumpers on the board. Example are you running on VIN or USB power?

Other jumpers on board correct? For example J1 (I think it is called) is set to connect RX to TX which is needed to talk to Dynamixel servos...

All of the servos still have servo ID #1 - Have seen a few people forget to go through the step to set servo IDs for their servos.

Software is corrupt - Again option to do like I did yesterday and redownload the trossen hardware and libraries, delete (or rename) existing library and hardware folders in your sketch folder and use fresh copy. (Also update to my latest version of AX sketch). Obviously make sure it fully compiles and installs... (Again I think in long run you are better off with latest Arduino 1.8.1 and later libraries, but I did verify the really old stuff still functions)

...

So again I would try the steps I outlined in previous posting.

Edit: As for my jumper, you are probably talking about my wired in resistor voltage divider that allows me to check the battery voltage using an analogRead instead of asking servos. Again the code to use this was disabled...

minimalfra
02-25-2017, 12:03 PM
Dear KurtE,

maybe I've resolved, or better, I've found the issue.

There are some cables damaged, so now I've to buy another cables set... :(

I think this, because with more attention, I've tried again all test programs: HexapodTest, pypose and AX12_test.

All programs work, but some servos work in the right way fixing cables.

We really didn't need this ! ! ! :(:(:(:(:(:(:(:(:(

KurtEck
02-25-2017, 01:56 PM
Sorry to hear this.

Did you follow the instructions for installing the wires (Step 11 in http://learn.trossenrobotics.com/10-interbotix/crawlers/phantomx-hexapod/172-phantomx-hexapod-metal-assembly-guide.html) ?

They usually do a good job in having your route the wires such that they avoid being pinched, which can lead to shorts and or open connections. Also when i am doing it, I try to move the servos around and visually check for those types of conditions.

Glad though you localized down the problem

minimalfra
02-25-2017, 02:10 PM
Now I Will try to find the cable broken with a multimeter...

anbukumar73
03-18-2017, 01:04 AM
Dear All
I recently bought, PhantomX AX Metal Hexapod Mark III Kit with AX-18 servos, I have assembled the complete Robot following all the instructions provided in Learning website of Trosson. However when I try to load the Hexapod Test program, I am getting this error on the screen - avrdude: stk500_getsync(): not in sync: resp=0x00

Attaching some photos of the assembly, I tried uploading 'Blink" program but getting the same error. I double checkd all the wiring, power jumper, power voltage every thing seems to be fine. When I plugin the power adaptor which came with the kit, all the servos becomes stiff / tight but none of them moves as shown in the test program video.


Can some one in this forum 69046905690669076908690969106911please help me resolve this issue ?


Thanks and Regards

Anbu Kumar
Cell Number +91-86603-79858
Bangalore, India

KurtEck
03-18-2017, 09:48 AM
First suggestion: I believe that Trossen Robotics uses email and the like to do support, so you might also try to contact them through: email trsupport@trossenrobotics.com

Some of the things I would try include and or things to look at include:
a) How is the board powered? I could not tell from your pictures if the power jumpers were for VIN or USB? I would probably try both ways. That is if it is set to VIN that assumes you have power going to the board through the 12v wall wart or lipo battery.
I always first assume power issues. If you look at the arbotix documents like: http://learn.trossenrobotics.com/arbotix/arbotix-advanced-topics/40-powering-the-arbotix-m.html

If you have a volt meter, I would check that when I am plugged in to either VUSB or VIN, I would check things like do I have +5v on the pins that say they should have +5v?

b) I would probably start off with everything unplugged from the arbotix board except the FTDI cable and power set to VUSB. Can you download blink to this board? Note: I don't remember which pin LED is on... But simple to find out...

c) What version of Arduino are you using? I am assuming their default setup with the very very old Arduino 1.0.6... Did you properly copy in the Hardware and library sections to the appropriate places? What board type did you setup the Arduino to use?

Personally I refuse to use this old version and use current versions of Arduino.... Something along the line what is described in the thread:
http://forums.trossenrobotics.com/showthread.php?7971-ArbotiX-1-6-Files-Libraries&p=71992&highlight=#post71992

d) Do you have the correct com port selected? Windows or Mac or Linux? What version... Are you able to use this FTDI/XBEE adapter to talk to the XBee? i.e. your machine can talk to the proper Serial port? Note: I have had one of these FTDI adapters fail on me... If by chance you have another FTDI cable, you might try it and see if it works or not. I also assume from your pictures that when you try to program the Arbotix-m, that you do not have an XBee installed in either the Arbotix-m nor in the FTDI adapter.

e) There is always a change that your Arbotix-m for some reason does not have a boot loader. Do you by chance have an AVR programmer? Like the one they sell (http://www.trossenrobotics.com/p/USB-AVR-Programmer.aspx)? If so it is so much nicer to use the Arbotix-m as you don't have to remove XBee to program.... If you have one of these, then you might try to upload using it...
I believe that one needs programmer set to AVR ISP MK2 (Serial)... And/or you can use it to burn bootloader.

Again sorry for the shotgun answer, as hard to know... And again you may want to directly contact Trossen.

Kurt

jwatte
03-18-2017, 09:38 PM
The Phantom and Arbotix stuff works with Arduino 1.6 now, which is much better than 1.0!

Separately, I highly recommend using a programmer, rather than a serial port. As you say, that way you don't have to worry about the Xbee getting in the way. The programmer doesn't have to be of type AVRISPmk2 -- that just happens to be the type that the serial bootloader emulates. USBTinyISP (a k a USBTiny) and USBASP are popular other programmer tools, often available cheaper than the AVRISP (from places like eBay...)

Anyway, Kurt's one-step-at-a-time approach to troubleshooting is good; try it! And, if somehow none of those steps work, then you have to keep reducing things to first principles -- the first thing that should work is X, so let's set up a simple case where I can verify X works. Then, once I know that works, the second thing that should work is X+Y, so set up a simple case where I can verify X+Y. Keep going, and you'll find the issue! (Or you will get all the way to "everything works," which will be good, too :-)

minimalfra
05-21-2017, 02:21 AM
Dear KurtEck,

finally, after many problems, it works!
In order to find a solution for the damaged cables, I tried (because of the high import price in Italy) to buy the single components (Pin, connectors cables and crimping tools) and do them by myself but they didn't work.
After all, I decided to buy them from Trossen in order to find a solution for my problem.
I posted a video in order to show you my PhantomX. :D


https://youtu.be/XM5tTFl8IN8

So my project can go a head :D

Best regards...

KurtEck
05-21-2017, 07:33 AM
Glad you have it running!