Dynamixel AX12 automatic position min/max sense

Ok, first thing first, I’ve only been working with the digital servo’s for a month. I’m able to get most functions running properly using an arduino uno, arduino mega and a G15 motor shield (rev 2). While I’m using the G15 cube servo, the commands are similar for the Dynamixel AX12. I’m able to port code for the AX12 to use with the G15 with little trouble. I plan on making a switch at some point the the Dynamixel, but need to get proof of concept before I dump the money into the “high end” servos.

This is what I’m working on - ‘calibrate’ min/max position of the servo while it is attached to the mechanism to be moved:

  1. program reads current position of servo, move in small steps towards 0 degrees. Automatically find where that travel ends and set minimum angle position variable. End point may not be zero.

  2. program moves servo in opposite direction in small steps towards 359 degrees. Automatically find where that travel ends and set maximum angle position variable. End point may not be 359 degrees.

  3. use the minimum variable and maximum variable to set the angle limit for that servo ID.

It should be simple, but I’m missing some bit of logic to get the servo to accomplish the first two items. The third item is easy and already working.

Has anyone here accomplished this type of code and willing to share a snippet? Even just the If/Do-While logic would probably be enough, I’m probably just not seeing the forest for the trees! It’s also possible I don’t know the proper nomenclature to search for the right answer!

Thanks

PlankSpank

Hi,

First, please note that theG15 Cube Servo Controller Shield Revision 2 won’t be compatible with the Dynamixel AX-12.
The two Dynamixel AX-12 connectors on the first revision were removed on the second one.

Did you take a look at the G15 Servo Library here ? The ReadAngle and Positioning examples should give you an idea on how to program the behavior you described.

Regards,

Thanks for the quick reply!

I’m well aware of the compatibility issues between the rev to shield and the dynamical AX12. That said, a very valid point for those folks that come on board with this thread that don’t know that.

I’m well-versed at this point in the commands that you suggested. The issue is getting automatic sensing of the minimum and maximum positions to stop the servo motor movement before we run into a hard stop

Think a robotic hand stopping before it crashes an egg that it’s going to pick up !

Apologies if my previous post seemed unfriendly, it’s easy to be misunderstood in a forum if we’re not really careful!

To clarify:

The problem I have is let’s assume we don’t know the min and max angles or these angles change over time. I would like the program to move towards min and stop when it finds the end of travel and set a variable, calmin. Repeat action towards max and stop when it finds end of travel in max direction, set calmax variable.

I seem to be “caught in a loop” of my own thinking and was looking for some guidance from people with more experience. I made reference to the robot hand picking up an egg as an example of control logic that would probably solve my problem. The hand has to limit travel when it encounters the egg so it doesn’t crush it.

My lack of experience or understanding is certainly obvious here, but I’m able to pick up the coding pretty quickly. I’ve tried to implement torque, ismoving, getpos, etc. but I’m missing something. Probably missing something silly or, maybe I’m trying to solve a really hard problem? Is it possible for the servo to do what I want without additional hardware?

Anybody have experience solving this type of problem?

Plank

Hi.
One easy way to solve 1 and 2 is to first set the Torque Limit to about 15 to 20% then command the servo to the end position. Continously read the position until no further changes. Then you’ll have the limit position. You should add/subtract a small value from the limit values for safety.