Servo commands inverted

76 views
Skip to first unread message

Ricardo Magagnin

unread,
Sep 16, 2018, 12:19:49 PM9/16/18
to Vorpal Robotics Forum
Hello all, greetings from Brazil!
I have tried to solve an issue with knee and hip inverted motion, when I compare with videos in DEMO mode and Test mode, looks like that my VORPAL have a inverted movement. As a consequence, when I try to walk or dance, the hexapod cannot standing up, cannot move correctly.
this is hard to explain, when I suppose the legs is UP in fact is down and vice versa.
I made a video to explain better.


Please I need a help to identify what is happen.

Steve Pendergrast

unread,
Sep 16, 2018, 6:39:34 PM9/16/18
to Vorpal Robotics Forum
Hello,

If you sourced your own motors (I can't tell from the video) then the issue is most likely that you have purchased non-standard motors that are the reverse of normal in their direction. Many vendors sell counterfeit motors and don't even bother to tell you that the motors are clockwise or counterclockwise.

Assuming that's the issue you can fix it by modifying one line of code to reverse everything.  Edit the robot code and change line  1463 from:

  int p = map(position,0,180,SERVOMIN,SERVOMAX);

To:

  int p = map(position,180,0,SERVOMIN,SERVOMAX);

This reverses the servo signal.

For instructions on flashing a new version of the code see this wiki page:

Hope this helps!

Ricardo Magagnin

unread,
Sep 16, 2018, 8:40:09 PM9/16/18
to Vorpal Robotics Forum
Hello Steve,

Thank you for your support.
Unfortunately, servos is from e-bay and no one told me about the direction..
I made the changes you recommended and looks much better now.
But, now I have some side effect of this change (I think), let me try to explain.
1. STOP position: It is OK, It was adjusted again the shafts in this position.
2. ADJ position: the Legs move to up position instead of to Down.
3. TEST position: the direction looks OK but the default initial position is too up.
4. DEMO mode: the motion looks OK but the initial position is not stand, it keeps down and the servos in load condition due the weight.
I don't know which line I need to change in the source code, please I will appreciate if you can support me.
I made new video with the change and new issues.


Thank you,


Steve Pendergrast

unread,
Sep 19, 2018, 9:54:48 AM9/19/18
to Vorpal Robotics Forum
Hello,

The servo horns should all be sticking straight out from the servo (both knees and hips) when in ADJ mode.  There are diagrams in the instructions showing what this is supposed to look like. But make sure you're doing this in ADJ mode not STAND mode.

If that's what you did and it still doesn't look right, then you may have servos that have a nonstandard min and max signal.  When you buy from places like aliexpress, banggood, ebay, etc. you are almost always getting cheap knock-offs and not real Tower Pro servos, they usually are extremely low quality, about 10% of them will fail within minutes of first use, etc.

I am about to come out with a new rev of the software that includes the ability to adjust min and max using TRIM mode on the gamepad. This is needed for our Max The Megapod project since the larger servos are different in this regard.

You could try to mod the software but it will be quite inconvenient since you're basically guessing. You would change the SERVOMIN and SERVOMAX #define statements around line 123. Change the numbers only.  If you change MIN by 20 you'd have to change MAX by 20 in the opposite direction to maintain the proper center.  Or, wait a week and I'll have a version where you can adjust this using the gamepad and the code will take care of keeping the center correct for  you.
Reply all
Reply to author
Forward
0 new messages