PDA

View Full Version : [Question(s)] Problem phoenix code for my hexapod



Demoniac
10-04-2018, 09:20 AM
Hi everybody,

I've build an hexapod from this guy : https://www.thingiverse.com/thing:432829
and everything work well. But weight was too heavy for me.

So, I've decided to build my own hexapod with 3D printed parts, SSC-32U, Arduino Micro, and micro-servos:

6 x MG-90S (Coxa)
12 x 7455 MG-D (Femur and Tibia)

I used the same code like Thingiverse link but my hexapod legs don't do the same movements. The only different things are servos for Femur and Tibia. I've tested with KurtE code and another one from this guy but same problem :
https://www.instructables.com/id/Capers-II-a-Hexapod-Robot/
and
https://github.com/Toglefritz/Capers_II

My hexapod are the same from Instructables Link.

I've read on another forum that there is a line to the code "phoenix_driver_ssc32" to modify in the section [OutputServoInfoForLeg] :

#define cPwmDiv
#define cPFConst

If the problem came from this part, how can I change this lines for my servos MG-90S and 7455 MG-D please ?

Thanks

KurtEck
10-04-2018, 04:11 PM
Sorry to say, I have not touched RC servos in a very very long time.

What you probably need to do is figure out the calibration differences between the two types of servos.

That is you need to compute the code needed to convert from degrees to servo units.

So for example if hitec rc servos that maybe have 180 degrees movement with output range of 500-2500us,
And yours has a different range of values to get you +90 -90...
Than you need to compute these values.

The formula that is for this is shwon in the function


//------------------------------------------------------------------------------------------
//[OutputServoInfoForLeg] Do the output to the SSC-32 for the servos associated with
// the Leg number passed in.
//------------------------------------------------------------------------------------------
#define cPwmDiv 991 //old 1059;
#define cPFConst 592 //old 650 ; 900*(1000/cPwmDiv)+cPFConst must always be 1500
// A PWM/deg factor of 10,09 give cPwmDiv = 991 and cPFConst = 592
// For a modified 5645 (to 180 deg travel): cPwmDiv = 1500 and cPFConst = 900.
#ifdef c4DOF
void ServoDriver::OutputServoInfoForLeg(byte LegIndex, short sCoxaAngle1, short sFemurAngle1, short sTibiaAngle1, short sTarsAngle1)
#else
void ServoDriver::OutputServoInfoForLeg(byte LegIndex, short sCoxaAngle1, short sFemurAngle1, short sTibiaAngle1)
#endif

But again it has been years since I have done so... SO it might take you some trial and error.

Demoniac
10-05-2018, 06:11 AM
Hi KurtEck, thank you.

For MG90S servos, the current and working values are:
#define cPwmDiv 991
#define cPFConst 592

I will try to find values for the 7455MG-D.

Thanks again for the answer