Crius All in one pro for my RC car 8x8 - Multiwii car.
I using this controller to control my car Krohpit ATV 8x8 Gyro 1/10 RC with board transmission. In particular BTR-80.
The controller will operate two motors left and right side, controlled steering servo and suspension servo.
The controller has gyroscopes and accelerometers, with which you can solve the problem of stabilizing the body of the car, keeping the trajectory bends, traction control, ABS.
Perhaps you can solve the problem of smooth landing on the wheels when jumping on trampolines by changing momentum on the wheels.
Perhaps you can solve the problem of smooth landing on the wheels when jumping on trampolines by changing momentum on the wheels.
Even this controller allows you to connect GPS and telemetry module to control the computer.
The suspension servo will work on the principle of X oktokopter.
09.11.2013Beta version 1. The basis of the code has taken Arduino Multiwii 2.2. Increased the number of servo channels to 15. Now I use a soft-PWM signal generation method for the servo.The frequency of the PWM 50 Hz.
Did the four functions of the steering:
1. Board transmission control, if zero speed - turn on the spot, wheel turned inwards.
2. Board transmission control, if zero speed - turn on the spot, wheel stand by centering.
3. Steering the front wheels. Differential main motors.
4. Steering all the wheels, rear dependent on speed. Differential main motors.
And the four functions of elektrosuspension:
1. All servos of suspension disabled.
2. Static clearance and horizon the chassis.
3. Progressive tilting chassis in turn.
4. Gyrostabilization chassis.
This is the main part of the code is responsible for channel management in Output.ino
#if defined(Krohpit_ATV)
static int16_t servoMid[15]; // Midpoint on servo
static uint8_t servoTravel[15] = SERVO_RATES; // Rates in 0-100%
static int8_t servoReverse[15] = SERVO_DIRECTION ; // Inverted servos
static int16_t servoLimit[15][2]; // Holds servoLimit data
static int16_t servoOffset[15] = SERVO_OFFSET;
static int16_t Clearance = 0;
#define SERVO_MIN 1000 // limit servo travel range must be inside [1000;2000]
#define SERVO_MAX 2000 // limit servo travel range must be inside [1000;2000]
for(i=0; i<15; i++){ // Set rates with 0 - 100%.
servoMid[i] =MIDRC + servoOffset[i];
servoLimit[i][0]=servoMid[i]-((servoMid[i]-SERVO_MIN) *(servoTravel[i]*0.01));
servoLimit[i][1]=servoMid[i]+((SERVO_MAX - servoMid[i]) *(servoTravel[i]*0.01));
}
if (f.RRSTR_MODE){ //RRSTR Steering all the wheels, rear dependent on speed. Differential main motors.
if (rcCommand[AUX1] >50) {
servo[0] = servoMid[0] + rcCommand[AUX1] - 0.1*rcCommand[YAW]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1] + 0.1*rcCommand[YAW]; //Motor R
} else {
if (rcCommand[AUX1] <-50) {
servo[0] = servoMid[0] + rcCommand[AUX1] + 0.1*rcCommand[YAW]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1] - 0.1*rcCommand[YAW]; //Motor R
}
else {
servo[0] = servoMid[0] + rcCommand[AUX1]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1]; //Motor R
}
}
servo[2] = servoMid[2] + rcCommand[YAW]*servoReverse[2]; //Steering FL
servo[3] = servoMid[3] + rcCommand[YAW]*servoReverse[3]; //Steering FR
servo[4] = servoMid[4] + int(float(rcCommand[YAW])*(1-abs(float(rcCommand[AUX1]))/500))*servoReverse[4]; //Steering RL
servo[5] = servoMid[5] + int(float(rcCommand[YAW])*(1-abs(float(rcCommand[AUX1]))/500))*servoReverse[5]; //Steering RR
}
else{
if(f.YAWSTR_MODE){ //YAWSTR Board transmission control, if zero speed - turn on the spot
if (rcCommand[AUX1] >5) {
servo[0] = servoMid[0] + rcCommand[AUX1] - rcCommand[YAW]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1] + rcCommand[YAW]; //Motor R
} else {
if (rcCommand[AUX1] <-5) {
servo[0] = servoMid[0] + rcCommand[AUX1] + rcCommand[YAW]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1] - rcCommand[YAW]; //Motor R
}
else {
servo[0] = servoMid[0] - rcCommand[YAW]; //Motor L
servo[1] = servoMid[1]+ rcCommand[YAW]; //Motor R
}
}
if (rcData[AUX3]>1850) {
servo[2] = 1950; //Steering FL
servo[3] = 1050; //Steering FR
servo[4] = 1950; //Steering RL
servo[5] = 1050; //Steering RR
}
else {
servo[2] = servoMid[2]; //Steering FL
servo[3] = servoMid[3]; //Steering FR
servo[4] = servoMid[4]; //Steering RL
servo[5] = servoMid[5]; //Steering RR
}
}
else{ //Steering the front wheels. Differential main motors.
if (rcCommand[AUX1] >50) {
servo[0] = servoMid[0] + rcCommand[AUX1] - 0.1*rcCommand[YAW]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1] + 0.1*rcCommand[YAW]; //Motor R
}
else {
if (rcCommand[AUX1] <-50) {
servo[0] = servoMid[0] + rcCommand[AUX1] + 0.1*rcCommand[YAW]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1] - 0.1*rcCommand[YAW]; //Motor R
}
else {
servo[0] = servoMid[0] + rcCommand[AUX1]; //Motor L
servo[1] = servoMid[1] + rcCommand[AUX1]; //Motor R
}
}
servo[2] = servoMid[2] + rcCommand[YAW]*servoReverse[2]; //Steering FL
servo[3] = servoMid[3] + rcCommand[YAW]*servoReverse[3]; //Steering FR
servo[4] = servoMid[4]; //Steering RL
servo[5] = servoMid[5]; //Steering RR
}
}
if (rcData[THROTTLE]<1060) {
pinMode(3,INPUT); //6 Suspension
pinMode(5,INPUT); //7 Suspension
pinMode(6,INPUT); //8 Suspension
pinMode(2,INPUT); //9 Suspension
pinMode(7,INPUT); //10 Suspension
pinMode(8,INPUT); //11 Suspension
pinMode(9,INPUT); //12 Suspension
pinMode(10,INPUT); //13 Suspension
}
else {
pinMode(3,OUTPUT); //6 Suspension
pinMode(5,OUTPUT); //7 Suspension
pinMode(6,OUTPUT); //8 Suspension
pinMode(2,OUTPUT); //9 Suspension
pinMode(7,OUTPUT); //10 Suspension
pinMode(8,OUTPUT); //11 Suspension
pinMode(9,OUTPUT); //12 Suspension
pinMode(10,OUTPUT); //13 Suspension
Clearance = min(abs(rcData[THROTTLE]-MIDRC),500);
if (rcData[THROTTLE]<MIDRC) Clearance = -Clearance;
#define PIDMIX(X,Y,Z,U,V,W) Clearance + axisPID[ROLL]*X + axisPID[PITCH]*Y + axisPID[YAW]*Z + rcCommand[ROLL]*U + rcCommand[PITCH]*V + rcCommand[YAW]*W
if(f.PASSTHRU_MODE){ //PASSTHRU Static clearance and horizon the chassis.
servo[6] = servoMid[6] + PIDMIX(0,0,0,+1 ,-1/2,0); //MIDFRONT_L
servo[7] = servoMid[7] + PIDMIX(0,0,0,-1,-1 ,0); //FRONT_R
servo[8] = servoMid[8] + PIDMIX(0,0,0,-1 ,+1/2,0); //MIDREAR_R
servo[9] = servoMid[9] + PIDMIX(0,0,0,+1,+1 ,0); //REAR_L
servo[10] =servoMid[10] - PIDMIX(0,0,0,-1,+1 ,0); //FRONT_L
servo[11] =servoMid[11] - PIDMIX(0,0,0,+1 ,+1/2,0); //MIDFRONT_R
servo[12] =servoMid[12] - PIDMIX(0,0,0,+1,-1 ,0); //REAR_R
servo[13] =servoMid[13] - PIDMIX(0,0,0,-1 ,-1/2,0); //MIDREAR_L
}else{
if(f.PROGRES_MODE){ //PROGRES Progressive tilting chassis in turn.
servo[6] = servoMid[6] + PIDMIX(0,0,0,+1 ,-1/2,1); //MIDFRONT_L
servo[7] = servoMid[7] + PIDMIX(0,0,0,-1,-1 ,-1); //FRONT_R
servo[8] = servoMid[8] + PIDMIX(0,0,0,-1 ,+1/2,-1); //MIDREAR_R
servo[9] = servoMid[9] + PIDMIX(0,0,0,+1,+1 ,1); //REAR_L
servo[10] =servoMid[10] - PIDMIX(0,0,0,-1,+1 ,-1); //FRONT_L
servo[11] =servoMid[11] - PIDMIX(0,0,0,+1 ,+1/2,1); //MIDFRONT_R
servo[12] =servoMid[12] - PIDMIX(0,0,0,+1,-1 ,1); //REAR_R
servo[13] =servoMid[13] - PIDMIX(0,0,0,-1 ,-1/2,-1); //MIDREAR_L
}else{ //Gyrostabilization chassis.
servo[6] = servoMid[6] + PIDMIX(+1 ,-1/2,0,0,0,0); //MIDFRONT_L
servo[7] = servoMid[7] + PIDMIX(-1,-1 ,0,0,0,0); //FRONT_R
servo[8] = servoMid[8] + PIDMIX(-1 ,+1/2,0,0,0,0); //MIDREAR_R
servo[9] = servoMid[9] + PIDMIX(+1,+1 ,0,0,0,0); //REAR_L
servo[10] =servoMid[10] - PIDMIX(-1,+1 ,0,0,0,0); //FRONT_L
servo[11] =servoMid[11] - PIDMIX(+1 ,+1/2,0,0,0,0); //MIDFRONT_R
servo[12] =servoMid[12] - PIDMIX(+1,-1 ,0,0,0,0); //REAR_R
servo[13] =servoMid[13] - PIDMIX(-1 ,-1/2,0,0,0,0); //MIDREAR_L
}
}
}
servo[14]=servoMid[14];
for(i=0;i<15;i++){
servo[i] = map(servo[i], SERVO_MIN, SERVO_MAX,servoLimit[i][0],servoLimit[i][1]);
servo[i] = constrain( servo[i], SERVO_MIN, SERVO_MAX);
}
/*
rcCommand[THROTTLE] - clearance 1000:2000
Clearance - clearance -500:500
rcCommand[ROLL] - tilt left / right -500:500
rcCommand[PITCH] - tilt forward / backward -500:500
rcCommand[YAW] - steering -500:500
rcCommand[AUX1] - throttle / brake -500:500
rcData[AUX1] - throttle / brake 1000:2000
rcData[AUX2] - suspension mode 1000:2000
rcData[AUX3] - steering mode 1000:2000
rcData[AUX4] - gear shift 1000:2000
*/
#endif //Krohpit_ATV
No comments:
Post a Comment