Go Back  RCU Forums > RC Cars, Buggies, Trucks, Tanks and more > RC Tanks
Reload this Page >

Open Source Battle System

Notices
RC Tanks Discuss all aspects of rc tank building and driving here!

Open Source Battle System

Old 12-21-2009, 12:52 AM
  #1  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default Open Source Battle System

About a year ago I asked David, the maker of the DBU/DBC about making a battle circuit that doesn't use any heng long electronics, has momentum and enough versatility in its design for tanks from WWI through modern and all types of servos/ESC. In a way I suppose a generic yet expandable competitor to ELMOD. I worked on it for a while before it hit the back burner. The last month or so I have picked it back up and started on software for a prototype based on an Arduino Mega. (Possibly on an ST8-Discovery later for $7.00 plus a small adapter board!). I have a good deal of it written but its been a long time since I have written embedded code. I have come to the point where on the tamiya compatibility portion of the battle system. Does anyone have technical specs on the signal type, frequency, and LED wavelength they could share with me. I'm hoping this could end up being something we all design and expand together. I think it would be nice to have an ELMOD equivalent system we build ourselves for sub $100 dollar range. Ill post some code later.




ADVANCED VEHICLE COMBAT SIMULATOR

Features:

Loss of Radio Signal: Module returns tank to neutral if radio signal is absent for ÂĽ second.

Recoil: A servo output on the board is connected to the infrared firing sequence in the battle system. When a command to fire the main gun is given the recoil servo will retract quickly while the muzzle flash bulb fires and the infrared emitter pulses, then the servo slowly moves back to the original position. The recoil potentiometer on the board allows the unit to be connected to an external controller to power a motor to provide the recoil functions. When the potentiometer value is not 0 Volts, the servo output is set to maximum for a period of time set by the potentiometer voltage.

Forward Speed: The forward speed is controlled by the Forward Max Speed Pot. This input controls the maximum sway of the forward servo output.

Reverse Speed: The reverse speed is controlled by the Reverse Max Speed Pot. This input controls the maximum sway of the reverse servo output.

Azimith Speed: The main azimith function’s speed is controlled by the Azimith Max Speed Pot. This input controls the maximum sway of the azimuth servo output.

Pivot Speed: The pivot function’s speed is controlled by the Pivot Max Speed Pot. This input adjusts the maximum speed that a full skid steer can make.

Momentum: Designed to simulate a heavy vehicle. Induces exponential / dynamic acceleration ramps for Forward, Reverse, Braking and Coasting. Settings are tied to battle system, Vehicle Selections and forward and reverse max speed pot values. Feature can be switched off on the board for testing or close quarters maneuvering. Acceleration/Deceleration ramps are determined by vehicle power/weight ratios set from the Vehicle Selection dip switches selection and are dynamic to requested throttle inputs. (Half throttle = Half horsepower with same weight therefore half acceleration)

Deck Clearance: A switch input is used to control the lower limit of elevation while the switch is closed. This function allows the main gun to pass over the rear deck without interference.

Stabilization: The turret can be stabilized in both elevation and azimuth. A two axis Memsic 2125 2g accelerometer can be attached to the gun breach, with X being the horizontal axis. The AVCS compares the PWM outputs from the accelerometer to determine the angle of the main gun. A quality heading hold gyro can be connected to the AVCS and attached to the turret. The AVCS outputs a reference 1.5mS signal to the gyro. The gyro output signal is then used to stabilized the azimuth function. The stabilization function can be switched from E-Mode(Non stabilized) to Normal mode on the fly. It can also be turned off permanently using a dip switch on the board or by vehicle selection 0-3.

CITV: A servo output is provided to rotate a CITV. The CITV pot allows the main azimith speed and the CITV azimith speed be matched so the CITV appears stabilized. The CITV can also be moved by inputs from the controller.

Loading Position: On certain vehicles elevation returns to the loading position after fireing the main gun.

Smoke Module Controller: A Servo PWM output is provided that mimics the motor load to produce more smoke under loaded conditions such as acceleration start up and shifting.

Sounds: All vehicle sounds are stored within the AVCS on an SD card. The individual system sounds are organized into 512 different wave files that can be accessed by the controller. Any wave file can be used for vehicle sounds up to 22 KHz in bandwidth.

SERVO INPUTS:
Ch1- Throttle (Digital Servo Input) 1-2mS PWM 1.5mS Center
CH2- Steering (Digital Servo Input) 1-2mS PWM 1.5mS Center
Ch3- Azimith (Digital Servo Input) 1-2mS PWM 1.5mS Center
Ch4- Elevation (Digital Servo Input) 1-2mS PWM 1.5mS Center
Ch5- Stabilization/Start up-Shutdown (Digital Servo Input) 1-2mS PWM 1.5mS Center
Ch6- Machine Gun/Fire Cannon or Missile (IFV) (Digital Servo Input) 1-2mS PWM 1.5mS Center
Ch7- Pivot Steer (Digital Servo Input) 1-2mS PWM 1.5mS Center
Ch8- CITV Input (Digital Servo Input) 1-2mS PWM 1.5mS Center
Gyro Signal Input (Digital Servo Input) 1-2mS PWM 1.5mS Center

SWITCH INPUTS:
Front Infrared Receiver (Digital Input) 0-5V Active Low
Side Infrared Receivers (Digital Input) 0-5V Active Low
Back Infrared Receiver (Digital Input) 0-5V Active Low
Hull Bottom Infrared Receiver (Digital Input) 0-5V Active Low
Deck Clearance Switch (Digital Input) 0-5V Active Low

ANALOG INPUTS:
X Accelerometer Input (Analog Input) 0-5V Potentiometer
Y Accelerometer Input (Analog Input) 0-5V Potentiometer
Z Accelerometer Input (Future Expansion) (Analog Input) 0-5V Potentiometer

ON BOARD ANALOG CONTROLS:
Recoil/Controller Pot (Analog Input) 0-5V Potentiometer
Forward Max Speed Pot (Analog Input) 0-5V Potentiometer
Reverse Max Speed Pot (Analog Input) 0-5V Potentiometer
Azimith Max Speed Pot (Analog Input) 0-5V Potentiometer
Pivot Max Speed Pot (Analog Input) 0-5V Potentiometer
ElevationRatioPot (Analog Input) 0-5V Potentiometer
CITV Ratio Pot (Analog Input) 0-5V Potentiometer

ON BOARD DIGITAL CONTROLS:
Stabilization Dip Switch (Digital Input) 0-5V Active Low
Momentum Dip Switch (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 1 (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 2 (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 3 (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 4 (Future Expansion) (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 5 (Future Expansion) (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 6 (Future Expansion) (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 7 (Future Expansion) (Digital Input) 0-5V Active Low
Vehicle Selection Dip Switch 8 (Future Expansion) (Digital Input) 0-5V Active Low

SERVO OUTPUTS:
Left Track Controller (Digital Servo Output) 1-2mS PWM 1.5mS Center
Right Track Controller (Digital Servo Output) 1-2mS PWM 1.5mS Center
Azimuth Controller/Servo (Digital Servo Output) 1-2mS PWM 1.5mS Center
Elevation Controller/Servo (Digital Servo Output) 1-2mS PWM 1.5mS Center
Recoil Controller/Servo (Digital Servo Output) 1-2mS PWM 1.5mS Center
CITV Controller/Servo (Digital Servo Output) 1-2mS PWM 1.5mS Center
Gyro Reference Signal (Digital Servo Output) 1-2mS PWM 1.5mS Center
Smoke module controller (Digital Servo Output) 1-2mS PWM 1.5mS Center

DRIVER OUTPUTS:
Brake lights Driver (Digital Output) 0-5V Sinking
Muzzle Flash Driver (Digital Output) 0-5V Sinking
Infrared Transmitter LED (Digital Output) 0-5V Sinking
Hit LEDs (Digital Output) 0-5V Sinking
Auxiliary Function Driver (Digital Output) 0-5V Sinking

COMMUNICATIONS:
SPI Clock (SCK) (Digital Output) 0-5V Sinking
SPI Data Out (SDO) (Digital Output) 0-5V Sinking
SPI Data In (SDI) (Digital Input) 0-5V Active Low
USB (Digital Input)

SOUND:
Line Level audio output (Analog Audio Output) 1/8" Phono
Speaker output (Amplifier Output 50mA)

Tamiya Battle System Compatible Vehicle Selections: The system uses variable Vehicle Selections set by switches for different types of vehicles.
Selection Class Reload 50% 25% Destroyed Momentum Invulnerability
0 WWII Ultra-Light 2 sec 1 1 1 minimal 20 sec
1 WWII Light 3 sec 1 2 3 little 15 sec
2 WWII Medium 5 sec 1 3 5 medium 12 sec
3 WWII Heavy 9 sec 1 5 9 high 10 sec
4 Eastern MBT 5 sec 2 6 13 little 10 sec
5 Western MBT 5 sec 3 8 15 little 10 sec
6 IFV/APC .5 sec 1 3 5 little 10 sec
7 Wheeled .5 sec 1 1 2 minimal 20 sec

A new signal created for Machine gun fire to and from class 6 and 7. This signal will not be recognized by the other classes therefore the class 6 and 7 vehicles cannot engage the other classes with machine gun. The other classes however can engage class 6 and 7 vehicles with both their machine gun and main gun ordnance. Class 6 vehicles also can fire ATGM weapons with a limit of 2 rounds per start up cycle. All the classes will have a bottom mounted sensor that detects a Landmine. When a landmine is encountered the vehicles traction system is disabled until it is restarted or destroyed.
Old 12-21-2009, 12:56 AM
  #2  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Here is the code I have thus far. Anyone super familiar with programing Arduinos.



#include "servo.h"

///////////////////////////////////////////////////////////////////////////////////////
// PIN ASSIGNMENTS //
///////////////////////////////////////////////////////////////////////////////////////

// RC RECEIVER SERVO INPUT PINS
const int RawThrottleIn = ?; // RC receiver Throttle pin
const int RawSteeringIn = ?; // RC receiver Steering pin
const int RawAzimithIn= ?; // RC receiver Azimith pin
const int RawElevationIn = ?; // RC receiver Elevation pin
const int RawStartStopStabIn = ?; // RC receiver Start-Stop/Stabilization pin
const int RawMGMaingunMissleIn = ?; // RC receiver Machine gun-Maingun/Missle pin
const int RawPivotSteerIn = ?; // RC receiver Pivot Steer pin
const int RawCITVIn = ?; // RC receiver CITV pin
const int RawGyroIn = ?; // RC receiver Gyro pin

// SWITCH INPUT PINS
const int FrontIrIn = ?; // Front Infrared Receiver pin
const int SideIrIn = ?; // Side Infrared Receivers pin
const int BackIrIn = ?; // Back Infrared Receiver pin
const int HullIrIn = ?; // Hull Infrared Receiver pin
const int DeckClearanceIn = ?; // Deck Clearance Switch pin

// ANALOG INPUT PINS
const int xIn = ?; // x-axis of the accelerometer pin
const int yIn = ?; // y-axis of the accelerometer pin

// ON BOARD ANALOG CONTROL PINS
const int RecoilPotIn = ?; // Recoil potentiometer pin
const int MaxForwardPotIn = ?; // Forward potentiometer pin
const int MaxReversePotIn = ?; // Reverse potentiometer pin
const int MaxAzimithPotIn = ?; // Azimith potentiometer pin
const int MaxPivotPotIn = ?; // Pivot potentiometer pin
const int CITVRatioPotIn = ?; // CITV potentiometer pin
const int ElevationRatioPotIn = ?; // Elevation potentiometer pin

// ON BOARD DIGITAL CONTROL PINS
const int StabSwitchIn = ?; // Stabilization Switch pin
const int MomentumSwitchIn = ?; // Momentum Switch pin
const int SelectSwitch1In = ?; // Vehicle selection switch 1 pin
const int SelectSwitch2In = ?; // Vehicle selection switch 2 pin
const int SelectSwitch3In = ?; // Vehicle selection switch 3 pin
const int SelectSwitch4In = ?; // Vehicle selection switch 4 pin
const int SelectSwitch5In = ?; // Vehicle selection switch 5 pin
const int SelectSwitch6In = ?; // Vehicle selection switch 6 pin
const int SelectSwitch7In = ?; // Vehicle selection switch 7 pin
const int SelectSwitch8In = ?; // Vehicle selection switch 8 pin

// SERVO OUTPUT PINS
const int LeftTrackOut = ?; // Left Track output pin
const int RightTrackOut = ?; // Right Track output pin
const int AzimithOut = ?; // Azimith output pin
const int ElevationOut = ?; // Elevation output pin
const int RecoilOut = ?; // Recoil output pin
const int CITVOut = ?; // CITV output pin
const int GyroOut = ?; // Gyro Reference output pin
const int SmokeModuleOut = ?; // Smoke Generator output pin

//SETUP SERVOS
servo myservo1; //LeftTrack / Throttle Servo setup
servo myservo2; //RightTrack / Steering Servo setup
servo myservo3; //Azimith Servo setup
servo myservo4; //Elevation Servo setup
servo myservo5; //Recoil Servo setup
servo myservo6; //CITV Servo setup
servo myservo7; //Gyro Reference setup
servo myservo8; //Smoke Module Servo setup

// OUTPUT DRIVER PINS
const int BrakeLightsOut = ?; // Brake Lights output pin
const int MuzzleFlashOut = ?; // Muzzle Flash output pin
const int IRTransOut = ?; // Infrared Transmitter output pin
const int HitLEDSOut = ?; // Hit LEDS output pin
const int Aux1Out = ?; // Aux1 output pin
const int Aux2Out = ?; // Aux2 output pin

// COMMUNICATIONS PINS
const int SCK = ?; // SPI Clock pin
const int SDO = ?; // SPI Data Out pin
const int SDI = ?; // SPI Data In pin



///////////////////////////////////////////////////////////////////////////////////////
// TABLES //
///////////////////////////////////////////////////////////////////////////////////////

//byte Acceleration1_Table[] = {1500, 1525, 1575, 1670, 1770, 1870, 1950, 2020, 2075, 2125, 2178, 2205, 2250, 2275, 2300, 2330, 2350, 2365, 2380, 2400, 2410, 2420, 2430, 2440, 2450, 2455, 2460, 2465, 2467, 2469, 2471, 2473, 2476, 2479, 2481, 2483, 2485, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500};

//byte Acceleration2_Table[] = {1500, 1521, 1561, 1635, 1713, 1791, 1853, 1908, 1952, 1992, 2034, 2057, 2094, 2115, 2136, 2161, 2179, 2193, 2206, 2224, 2234, 2244, 2254, 2264, 2274, 2280, 2286, 2293, 2297, 2301, 2305, 2308, 2313, 2318, 2322, 2326, 2330, 2334, 2337, 2340, 2344, 2347, 2350, 2353, 2357, 2360, 2363, 2366, 2369, 2373, 2376, 2378, 2381, 2383, 2386, 2388, 2391, 2393, 2396, 2398, 2401, 2403, 2406, 2408, 2411, 2413, 2416, 2418, 2421, 2423, 2426, 2428, 2431, 2433, 2435, 2438, 2440, 2443, 2445, 2448, 2450, 2453, 2455, 2458, 2460, 2463, 2465, 2468, 2470, 2473, 2475, 2478, 2480, 2483, 2485, 2488, 2490, 2493, 2495, 2498, 2500};

//byte Acceleration3_Table[] = {1500, 1518, 1548, 1600, 1655, 1710, 1755, 1795, 1828, 1858, 1889, 1908, 1935, 1953, 1970, 1990, 2005, 2018, 2030, 2045, 2055, 2065, 2075, 2085, 2095, 2103, 2110, 2118, 2124, 2130, 2136, 2142, 2148, 2155, 2161, 2167, 2173, 2179, 2184, 2190, 2195, 2201, 2206, 2212, 2217, 2223, 2228, 2234, 2239, 2245, 2250, 2255, 2260, 2265, 2270, 2275, 2280, 2285, 2290, 2295, 2300, 2305, 2310, 2315, 2320, 2325, 2330, 2335, 2340, 2345, 2350, 2355, 2360, 2365, 2370, 2375, 2380, 2385, 2390, 2395, 2400, 2405, 2410, 2415, 2420, 2425, 2430, 2435, 2440, 2445, 2450, 2455, 2460, 2465, 2470, 2475, 2480, 2485, 2490, 2495, 2500};

//byte Acceleration4_Table[] = {1500, 1475, 1425, 1330, 1230, 1130, 1050, 980, 925, 875, 823, 795, 750, 725, 700, 670, 650, 635, 620, 600, 590, 580, 570, 560, 550, 545, 540, 535, 533, 531, 529, 527, 524, 521, 519, 517, 515, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500};

//byte Acceleration5_Table[] = {1500, 1479, 1439, 1365, 1287, 1209, 1147, 1092, 1048, 1008, 966, 943, 906, 885, 864, 839, 821, 807, 794, 776, 766, 756, 746, 736, 726, 720, 714, 707, 703, 699, 695, 692, 687, 682, 678, 674, 670, 666, 663, 660, 656, 653, 650, 647, 643, 640, 637, 634, 631, 627, 624, 622, 619, 617, 614, 612, 609, 607, 604, 602, 599, 597, 594, 592, 589, 587, 584, 582, 579, 577, 574, 572, 569, 567, 565, 562, 560, 557, 555, 552, 550, 547, 545, 542, 540, 537, 535, 532, 530, 527, 525, 522, 520, 517, 515, 512, 510, 507, 505, 502, 500};

//byte Acceleration6_Table[] = {1500, 1483, 1453, 1400, 1345, 1290, 1245, 1205, 1173, 1143, 1111, 1093, 1065, 1048, 1030, 1010, 995, 983, 970, 955, 945, 935, 925, 915, 905, 898, 890, 883, 877, 871, 865, 859, 852, 846, 840, 834, 828, 822, 816, 811, 805, 800, 794, 789, 783, 778, 772, 767, 761, 756, 750, 745, 740, 735, 730, 725, 720, 715, 710, 705, 700, 695, 690, 685, 680, 675, 670, 665, 660, 655, 650, 645, 640, 635, 630, 625, 620, 615, 610, 605, 600, 595, 590, 585, 580, 575, 570, 565, 560, 555, 550, 545, 540, 535, 530, 525, 520, 515, 510, 505, 500};


///////////////////////////////////////////////////////////////////////////////////////
// VARIABLES //
///////////////////////////////////////////////////////////////////////////////////////

// RC RECEIVER SERVO INPUT VARIABLES
int ThrottleVal; // Throttle input value in microseconds
int SteeringVal; // Steering input value in microseconds
int AzimithVal; // Azimith input value in microseconds
int ElevationVal; // Elevation input value in microseconds
int StartStopStabVal; // Start-Stop/Stab value in microseconds
int MGMaingunMissleVal; // MG-Maingun/Missle value in microseconds
int PivotSteerVal; // Pivot steer value in microseconds
int CITVVal; // CITV value in microseconds
int GyroVal; // Gyro value in microseconds

// SWITCH INPUT VARIABLES
int FrontIRState; // Front infrared sensor state (High-Low)
int SideIRState; // Side infrared sensor state (High-Low)
int BackIRState; // Back infrared sensor state (High-Low)
int HullIRState; // Hull infrared sensor state (High-Low)
int DeckClearananceState; // Deck Clearance switch state (High-Low)

// ACCELEROMETER INPUT VARIABLES
int X_AxisVal; // Accelerometer X axis value
int Y_AxisVal; // Accelerometer Y axis value
int pulseX;
int pulseY;
int AccelerationX;
int AccelerationY;

// ON BOARD ANALOG CONTROL VARIABLES
int RecoilPotVal; // Recoil potentiometer value (0-1023)
int MaxForwardPotVal; // Forward potentiometer value (0-1023)
int MaxReversePotVal; // Reverse potentiometer value (0-1023)
int MaxAzimithPotVal; // Azimith potentiometer value (0-1023)
int MaxPivotPotVal; // Pivot potentiometer value (0-1023)
int CITVRatioPotVal; // CITV potentiometer value (0-1023)
int ElevationRatioPotVal; // Elevation potentiometer value (0-1023)

// ON BOARD DIGITAL CONTROL VARIABLES
int StabSwitchVal; // Stabilization Switch state (High-Low)
int MomentumSwitchVal; // Momentum switch state (High-Low)
int SelectSwitch1Val; // Select Switch 1 state (High-Low)
int SelectSwitch2Val; // Select Switch 2 state (High-Low)
int SelectSwitch3Val; // Select Switch 3 state (High-Low)
int SelectSwitch4Val; // Select Switch 4 state (High-Low)
int SelectSwitch5Val; // Select Switch 5 state (High-Low)
int SelectSwitch6Val; // Select Switch 6 state (High-Low)
int SelectSwitch7Val; // Select Switch 7 state (High-Low)
int SelectSwitch8Val; // Select Switch 8 state (High-Low)

// SERVO OUTPUT VARIABLES
int LeftTrackVal; // Left Track Speed output value in microseconds
int RightTrackVal; // Right Track Speed output value in microseconds
int AzimithVal; // Azimith output value in microseconds
int ElevationVal; // Elevation output value in microseconds
int RecoilVal; // Recoil output value in microseconds
int CITVVal; // CITV output value in microseconds
int SmokeModuleVal; // Smoke Module output value in microseconds

// OUTPUT DRIVER VARIABLES
int BrakeLightsVal = 0; // Brake Lights output State
int MuzzleFlashVal; // Muzzle Flash output State
int IRTransVal; // Infrared Transmitter output State
int HitLEDSVal; // Hit LEDS output State
int Aux1Val; // Aux1 output State
int Aux2Val; // Aux2 output State

// COMMUNICATIONS VARIABLES




//OTHER VARIABLES

int PivotPotBottomLimit; //Pivot Speed Limit Left
int PivotPotTopLimit; //Pivot Speed Limit Right

int AziPotBottomLimit; //Azimith Speed Limit Left
int AziPotTopLimit; //Azimith Speed Limit Right

int ElevationSound;
int AzimithSound;
int PivotSound;

int StabStatus = 0; //Stabilization Status initialized to off
int Start_StopVal = 0; //Startup-Shutdown value initialized to off

int Recoil_Count_Delay = 0; //Delay counter for Recoil sequence initialized to off
int Fire = 0; //Fire main gun signal from battle system initialized to off
int Firing = 0; //Main gun firing sequence initialized to off

int ForwardTractionRamp = 1; //Acceleration ramp multiplier
int ReverseTractionRamp = 1; //Acceleration ramp multiplier
int TractionRamp = 1; //Acceleration ramp multiplier
int LeftTrackMulti = 1; //Multiplier for Steering/Throttle mixing
int RightTrackMulti = 1; //Multiplier for Steering/Throttle mixing
int SmokeVal = 0; //Smoke generator system value

Int ServoCenter = 1500; //Servo calibration input signal center point in uS
Int ServoMax = 2000; //Servo calibration input signal Maximum point in uS
Int ServoMin = 1000; //Servo calibration input signal Minimum point in uS

Int ServoSwitchDeadband; //Servo signal switch calibration dead band in uS
Int ServoDeadBand; //Servo signal calibration dead band in uS
Int VehicleSelection; //Vehicle selection value to Acceleration Ramps and Battle System


///////////////////////////////////////////////////////////////////////////////////////
// SETUP //
///////////////////////////////////////////////////////////////////////////////////////

void setup()
{
Serial.begin(9600); //serial library start

pinMode(RawThrottleIn, INPUT);
pinMode(RawSteeringIn, INPUT);
pinMode(RawAzimithIn, INPUT);
pinMode(RawElevationIn, INPUT);
pinMode(RawStartStopStabIn, INPUT);
pinMode(RawMGMaingunMissleIn, INPUT);
pinMode(RawLRFPivotSteerIn, INPUT);
pinMode(RawCITVIn, INPUT);
pinMode(RawGyroIn, INPUT);

pinMode(FrontIrIn, INPUT);
pinMode(SideIrIn, INPUT);
pinMode(BackIrIn, INPUT);
pinMode(HullIrIn, INPUT);
pinMode(DeckClearanceIn, INPUT);

pinMode(xIn, INPUT);
pinMode(yIn, INPUT);

pinMode(RecoilPotIn, INPUT);
pinMode(MaxForwardPotIn, INPUT);
pinMode(MaxReversePotIn, INPUT);
pinMode(MaxAzimithPotIn, INPUT);
pinMode(MaxPivotPotIn, INPUT);
pinMode(CITVRatioPotIn, INPUT);
pinMode(ElevationRatioPotIn, INPUT);

pinMode(StabSwitchIn, INPUT);
pinMode(MomentumSwitchIn, INPUT);
pinMode(SelectSwitch1In, INPUT);
pinMode(SelectSwitch2In, INPUT);
pinMode(SelectSwitch3In, INPUT);
pinMode(SelectSwitch4In, INPUT);
pinMode(SelectSwitch5In, INPUT);
pinMode(SelectSwitch6In, INPUT);
pinMode(SelectSwitch7In, INPUT);
pinMode(SelectSwitch8In, INPUT);

myservo1.attach(LeftTrackOut);
myservo2.attach(RightTrackOut);
myservo3.attach(AzimithOut);
myservo4.attach(ElevationOut);
myservo5.attach(RecoilOut);
myservo6.attach(CITVOut);
myservo7.attach(GyroOut);
myservo8.attach(SmokeModuleOut);

pinMode(BrakeLightsOut, OUTPUT);
pinMode(MuzzleFlashOut, OUTPUT);
pinMode(IRTransOut, OUTPUT);
pinMode(HitLEDSOut, OUTPUT);
pinMode(Aux1Out, OUTPUT);
pinMode(Aux2Out, OUTPUT);

pinMode(SCK, OUTPUT);
pinMode(SDO, OUTPUT);
pinMode(SDI, INPUT);

StabSwitchVal = digitalRead(StabSwitchIn);
MomentumSwitchVal = digitalRead(MomentumSwitchIn);
SelectSwitch1Val = digitalRead(SelectSwitch1In);
SelectSwitch2Val = digitalRead(SelectSwitch2In);
SelectSwitch3Val = digitalRead(SelectSwitch3In);
SelectSwitch4Val = digitalRead(SelectSwitch4In);
SelectSwitch5Val = digitalRead(SelectSwitch5In);
SelectSwitch6Val = digitalRead(SelectSwitch6In);
SelectSwitch7Val = digitalRead(SelectSwitch7In);
SelectSwitch8Val = digitalRead(SelectSwitch8In);


//VEHICLE SELECTION CODE

If(SelectSwitch1Val = LOW && SelectSwitch2Val = LOW && SelectSwitch3Val = LOW){
VehicleSelection = 0; //WWII Ultra Light Tank
}

If(SelectSwitch1Val = HIGH && SelectSwitch2Val = LOW && SelectSwitch3Val = LOW){
VehicleSelection = 1; //WWII Light Tank
}

If(SelectSwitch1Val = LOW && SelectSwitch2Val = HIGH && SelectSwitch3Val = LOW){
VehicleSelection = 2; //WWII Medium Tank
}

If(SelectSwitch1Val = HIGH && SelectSwitch2Val = HIGH && SelectSwitch3Val = LOW){
VehicleSelection = 3; //WWII Heavy Tank
}

If(SelectSwitch1Val = LOW && SelectSwitch2Val = LOW && SelectSwitch3Val = HIGH){
VehicleSelection = 4; //Eastern MBT
}

If(SelectSwitch1Val = HIGH && SelectSwitch2Val = LOW && SelectSwitch3Val = HIGH){
VehicleSelection = 5; //Western MBT
}

If(SelectSwitch1Val = LOW && SelectSwitch2Val = HIGH && SelectSwitch3Val = HIGH){
VehicleSelection = 6; //IFV / APC / Light MBT
}

If(SelectSwitch1Val = HIGH && SelectSwitch2Val = HIGH && SelectSwitch3Val = HIGH){
VehicleSelection = 7; //Wheeled Vehicle
}

}



///////////////////////////////////////////////////////////////////////////////////////
// EXECUTEABLE CODE //
///////////////////////////////////////////////////////////////////////////////////////
void loop()
{
ThrottleVal = pulseIn(RawThrottleIn, HIGH, 20000);
SteeringVal = pulseIn(RawSteeringIn, HIGH, 20000);
AzimithVal = pulseIn(RawAzimithIn, HIGH, 20000);
ElevationVal = pulseIn(RawElevationIn, HIGH, 20000);
StartStopStabVal = pulseIn(RawStartStopStabIn, HIGH, 20000);
MGMaingunMissleVal = pulseIn(RawMGMaingunMissleIn, HIGH, 20000);
PivotSteerVal = pulseIn(RawPivotSteerIn, HIGH, 20000);
CITVVal = pulseIn(RawCITVIn, HIGH, 20000);
GyroVal = pulseIn(RawGyroIn, HIGH, 20000);

FrontIRState = digitalRead(FrontIrIn);
SideIRState = digitalRead(SideIrIn);
BackIRState = digitalRead(BackIrIn);
HullIRState = digitalRead(HullIrIn);
DeckClearanceState = digitalRead(DeckClearanceIn);

pulseX = pulseIn(xIn,HIGH);
pulseY = pulseIn(yIn,HIGH);

RecoilPotVal = analogRead(RecoilPotIn);
MaxForwardPotVal = analogRead(MaxForwardPotIn);
MaxReversePotVal = analogRead(MaxReversePotIn);
MaxAzimithPotVal = analogRead(MaxAzimithPotIn);
MaxPivotPotVal = analogRead(MaxPivotPotIn);
CITVRatioPotVal = analogRead(CITVRatioPotIn);
ElevationRatioPotVal = analogRead(ElevationRatioPotIn);



//START STOP SEQUENCE CODE

If(Start_StopVal = 1){ //Vehicle allready running
If(StartStopStabVal < 1400){ //Shutdown command
StartStopVal = 0; //Shutdown vehicle


//Shutdown Sounds //Shutdown sound sequence


Delay(10000); //Delay 10 seconds for sounds
}}

If(Start_StopVal = 0){ //Vehicle not running
If(1600 > SteerVal > 1400){ //Startup Calibration check
If(1600 > ThrottleVal > 1400){ //Startup Calibration check
If(ElevationVal < 1400){ //Startup Calibration check
If(AzimithVal >1600){ //Startup Calibration check
If(StartStopStabVal < 1400){ //Start command
StartStopVal = 1; //Start vehicle
ServoCenter = AzimithVal; //Calibration of servo input signals
ServoMax = ThrottleVal; //Calibration of servo input signals
ServoMin = SteerVal; //Calibration of servo input signals


//Startup Sounds //Startup sound sequence


Delay(10000); //Delay 18 seconds for sounds
}}}}}}

If(Start_StopVal = 1){ //Vehicle allready running, Start of Running Vehicle code


//SERVO INPUT MAPPING TO ServoCenter +/- 1000 counts

SteerVal = map(SteerVal, ServoMin, ServoMax, (ServoCenter - 1000), (ServoCenter + 1000));
ThrottleVal = map(ThrottleVal, ServoMin, ServoMax, (ServoCenter - 1000), (ServoCenter + 1000));
AzimithVal = map(AzimithVal, ServoMin, ServoMax, (ServoCenter - 1000), (ServoCenter + 1000));
ElevationVal = map(ElevationVal, ServoMin, ServoMax, (ServoCenter - 1000), (ServoCenter + 1000));



//POT INPUT MAPPING

MaxPivotPotVal = map(MaxPivotPotVal, 0, 1023, 0, 1000); //Map Pivot pot value to 0-1000 counts
MaxForwardPotVal = map(MaxForwardPotVal, 0, 1023, 0, 1000); //Map Forward pot value to 0-1000 counts
MaxReversePotVal = map(MaxReversePotVal, 0, 1023, 0, 1000); //Map Reverse pot value to 0-1000 counts
MaxAzimithPotVal = map(MaxAzimithPotVal, 0, 1023, 0, 1000); //Map Azimith pot value to 0-1000 counts
ElevationRatioPotVal= map(ElevationRatioPotVal, 0, 1023, 1, 7); //Map Elevation Ratio pot value to 1-7 counts



//BATTLE SYSTEM CODE

digitalwrite(MuzzleFlashOut, MuzzleFlashVal);
digitalwrite(IRTransOut, IRTransVal);
digitalwrite(HitLEDSOut, HitLEDSVal);



//ACCELERATION RAMPS CODE

ThrottleVal = map(ThrottleVal, ServoCenter, (ServoCenter + 1000), ServoCenter, (MaxForwardPotVal + ServoCenter)); //Forward

ThrottleVal = map(ThrottleVal, (ServoCenter - 1000), ServoCenter, (ServoCenter - MaxReversePotVal), ServoCenter); //Reverse

ThrottleVal = map(ThrottleVal, (ServoCenter - 1000), (ServoCenter + 1000), MaxReversePotVal, MaxForwardPotVal); //Wheeled

digitalwrite(BrakeLightsOut, BrakeLightsVal);



//PIVOT CODE

If(VehicleSelection != 7){ //No pivot with Wheeled vehicle
If(PivotSteerVal < (ServoCenter + ServoSwitchDeadBand)){ //Is pivot switch pressed
PivotSound = 0; //No pivot sound
}

If(PivotSteerVal > (ServoCenter + ServoSwitchDeadBand)){ //Is pivot switch pressed

PivotPotBottomLimit = ServoCenter - MaxPivotPotVal; //Set bottom limit to center - pivot pot
PivotPotTopLimit = ServoCenter + MaxPivotPotVal; //Set top limit to center + pivot pot
SteeringVal = map(SteeringVal, (ServoCenter - 1000), (ServoCenter + 1000), PivotPotBottomLimit, PivotPotTopLimit); //Map Steering value to top and bottom limits

If(SteeringVal > (ServoCenter + ServoDeadBand)){ //Pivot Steer Right
LeftTrackVal = SteeringVal; //Run Left track forward
RightTrackVal = ServoCenter - (SteeringVal - ServoCenter); //Run Right track reverse
PivotSound = 1; //Pivot sound
}

If(SteeringVal < (ServoCenter - ServoDeadBand)){ //Pivot Steer Left
LeftTrackVal = SteeringVal; //Run Left track reverse
RightTrackVal = ServoCenter + (ServoCenter - SteeringVal); //Run Right track forward
PivotSound = 1; //Pivot sound
}}}



//MIXING CODE

If(VehicleSelection != 7){ //No Mixing with Wheeled vehicle
If(ThrottleVal > ServoCenter){ //Forward Throttle

If(SteeringVal < (ServoCenter - ServoDeadBand)){ //Steer Left
LeftTrackMulti = 1 - ((SteeringVal - ServoCenter) / 1000); //Steer Multiplier for Left track % of Steerval 0-1
RightTrackVal = ForwardTractionRamp; //Right Track Value
LeftTrackVal = (ServoCenter + ((ForwardTractionRamp - ServoCenter) * LeftTrackMulti)); //Left Track Value
}

If(SteeringVal > (ServoCenter + ServoDeadBand)){ //Steer Right
RightTrackMulti = 1 - ((ServoCenter - SteeringVal) / 1000); //Steer Multiplier for Right track % of Steerval 0-1
LeftTrackVal = ForwardTractionRamp; //Left Track Value
RightTrackVal = (ServoCenter + ((ForwardTractionRamp - ServoCenter) * RightTrackMulti)); //Right Track Value
}

If((ServoCenter - ServoDeadBand) < SteeringVal < (ServoCenter + ServoDeadBand)){ //No Steer
LeftTrackVal = ForwardTractionRamp; //Left Track Value
RightTrackVal = ForwardTractionRamp; //Right Track Value
}}

Else{

If(SteeringVal < (ServoCenter - ServoDeadBand)){ //Steer Left
LeftTrackMulti = 1 - ((SteeringVal - ServoCenter) / 1000); //Steer Multiplier for Left track % of Steerval 0-1
RightTrackVal = ReverseTractionRamp; //Right Track Value
LeftTrackVal = (ServoCenter - ((ServoCenter - ReverseTractionRamp) * LeftTrackMulti)); //Left Track Value
}

If(SteeringVal > (ServoCenter + ServoDeadBand)){ //Steer Right
RightTrackMulti = 1 - ((ServoCenter - SteeringVal) / 1000); //Steer Multiplier for Right track % of Steerval 0-1
LeftTrackVal = ReverseTractionRamp; //Left Track Value
RightTrackVal = (ServoCenter - ((ServoCenter - ReverseTractionRamp) * RightTrackMulti)); //Right Track Value
}

If((ServoCenter - ServoDeadBand) < SteeringVal < (ServoCenter + ServoDeadBand)){ //No Steer
LeftTrackVal = ReverseTractionRamp; //Left Track Value
RightTrackVal = ReverseTractionRamp; //Right Track Value
}}}

Else{

RightTrackVal = SteerVal; //Wheeled Vehicle Steer Value
LeftTrackVal = TractionRamp; //Wheeled Vehicle Throttle Value
}


myservo1.writeMicroseconds(LeftTrackVal);
myservo2.writeMicroseconds(RightTrackVal);



//STABILIZATION CODE

If(StabStatus = 0){ //Stabilization Status = E-Mode
If(StabSwitchVal = HIGH){ //Stabilization Switch ON
If(StartStopStabVal > (ServoCenter + ServoSwitchDeadBand)){ //Stabilization Software Switch pressed
StabStatus = 1; //Stabilization Normal Mode
}}}

If(StabStatus = 1){ //Stabilization Status = Normal Mode
If(StabSwitchVal = HIGH){ //Stabilization Switch ON
If(StartStopStabVal > (ServoCenter + ServoSwitchDeadBand)){ //Stabilization Software Switch pressed
StabStatus = 0; //Stabilization E-Mode
}}}

If(StabSwitchVal = LOW) || VehicleSelection < 4{ //Stabilization Switch OFF or Vehicle selection = WWII era vehicle
StabStatus = 0; //Stabilization E-Mode
}



//AZIMITH CODE

AziPotBottomLimit = ServoCenter - MaxAzimithPotVal; //Set bottom limit to center - Azimith pot

AziPotTopLimit = ServoCenter + MaxAzimithPotVal; //Set top limit to center + Azimith pot

AzimithVal = map(AzimithVal, (ServoCenter - 1000), (ServoCenter + 1000), AziPotBottomLimit, AziPotTopLimit);

If(StabStatus = 1){ //Stabilization Normal Mode
AzimithVal = AzimithVal + (ServoCenter - GryoVal); //Azimith Value with Stabilization
}

If((ServoCenter + ServoDeadBand) > AzimithVal > (ServoCenter - ServoDeadBand)){ //No Azimith Command
AzimithSound = 0; //No Azimith Sound
}
Else{
AzimithSound = 1; //Azimith Sound
}

myservo3.writeMicroseconds(AzimithVal);



//ELEVATION CODE

AccelerationX = ((pulseX / 10) - 500) * 8; // convert the pulse width into Acceleration in milli G's
AccelerationY = ((pulseY / 10) - 500) * 8; // convert the pulse width into Acceleration in milli G's

Y_AxisVal = (AccelerationY * ElevationRatioPotVal); //Multiply Elevation ratio by Acceleration counts
Y_AxisVal = constrain(Y_AxisVal, -1000, 1000); //Constrain Acceleration to +/- 1000 counts

If(StabStatus = 1){
ElevationVal = ElevationVal + (Y_AxisVal + (ElevationVal - ServoCenter));
}

If(DeckClearanceState = HIGH){
ElevationVal = 1500;
}

If((ServoCenter + ServoDeadBand) > ElevationVal > (ServoCenter - ServoDeadBand)){
ElevationSound = 0;
}
Else{
ElevationSound = 1;
}

myservo4.writeMicroseconds(ElevationVal);



//RECOIL CODE

If(Fire = 1){
Firing = 1;
RecoilVal = 2500;
myservo5.writeMicroseconds(RecoilVal);
Fire = 0;
}

If(Firing = 1){
If(RecoilPotVal < 100){
Recoil_Count_Delay++
If(Recoil_Count_Delay > 10){
Recoil_Count_Delay = 0;
RecoilVal = RecoilVal - 22;
myservo5.writeMicroseconds(RecoilVal);
If(RecoilVal < RecoilNeutral){
Fireing = 0;
}}}}

If(Firing = 1){
If(RecoilPotVal >= 100){
RecoilVal = 2500;
Recoil_Count_Delay++;
myservo5.writeMicroseconds(RecoilVal);
If(Recoil_Count_Delay > RecoilPotVal * 2){
Recoil_Count_Delay = 0;
Firing = 0;
}}}

If(Firing = 0){
RecoilVal = RecoilNeutral;
}



//CITV CODE

CITVRatioPotVal = Map(CITVRatioPotVal, 0, 1023, 0, 2);
CITVVal = CITVVal - (AzimithVal * CITVRatioPotVal);
myservo6.writeMicroseconds(CITVVal);



//GYRO REFERENCE CODE

myservo7.writeMicroseconds(1500);



//SMOKE MODULE CODE

If(PivotSteerVal > (ServoCenter + ServoSwitchDeadBand)){
If((ServoCenter + 1000) - SteerVal > (ServoCenter - 1000) + SteerVal){
SmokeVal = SteerVal;
SmokeModuleVal = SteerVal - SmokeVal;
}
Else{
SmokeVal = (ServoCenter - SteerVal) + ServoCenter;
SmokeModuleVal = SteerVal - SmokeVal;
}}
Else{
If(LeftTrackVal > RightTrackVal){
SmokeVal = LeftTrackVal;
SmokeModuleVal = ThrottleVal - SmokeVal;
}
Else{
SmokeVal = RightTrackVal;
SmokeModuleVal = ThrottleVal - SmokeVal;
}}

myservo8.writeMicroseconds(SmokeModuleVal);
Old 12-21-2009, 01:15 AM
  #3  
Perry S.
 
Perry S.'s Avatar
 
Join Date: Jan 2007
Location: Clifton Park, NY
Posts: 2,124
Likes: 0
Received 2 Likes on 2 Posts
Default RE: Open Source Battle System

It seems like much of your outputs are digital servo pwm signals. I guess the intent is to have your board power an ESC? ESC's for all the functions such as turret traverse, elevations, smoker, etc. Plus the board for under $100?

It's an ambitious project for sure and the Arduino is up to it. What are you proposing, a battle circuit or an entirely new tank electronics package? Open source is good but it looks like you are trying to design a system for your tanks for your needs which kinda kills the open source allure. Maybe you could back track a bit for us and tell us the scope of what you are trying to do. Why will this be better than El Mod? Cheaper? It is looking like it might not be.

It's a good project and a noble cause but maybe if you put a survey out to the forum members as to what they are looking for it might be more 'universal'

Perry
Old 12-21-2009, 01:54 AM
  #4  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

I figured this would be a "good start". Yes was intending on either an ESC or Servo to drive each function. This would allow people to select what ever they want to drive the functions from good sabortooth ESCs and futaba servos to cheap Chinese ESCs and servos. I got the idea from thinking the design could be used on a wide range of vehicles from wheeled to tracked, 1:24 to 1:4. I have some other ideas for i'm contemplating for it in the future depending on which micro it goes on. I'm thinking theres some room for further development of our battle systems.

If anyone has any ideas for features let me know. It would be great to have people list their wanted features.

It would also be interesting if Bill or David would be interested in collaborating in the hardware layout. Should be a fairly simple layout.

Adam
Old 12-21-2009, 06:58 AM
  #5  
philipat
 
Join Date: Dec 2007
Location: Okinawa, JAPAN
Posts: 2,898
Likes: 0
Received 4 Likes on 4 Posts
Default RE: Open Source Battle System

Sounds like some good ideas and I'm not techie enough to speak to the technical side, but if it's universal, I'd like to see a couple of things:

1) Ability to add sounds (microSD card maybe?)
2) Airsoft compatibility

Looks like you have the inertial feeds already. FETs should be really robust, too.
Old 12-22-2009, 03:43 AM
  #6  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Should be able to use Recoil output to fire airsoft. Recoil command uses a pot to set it to either a servo output following a curve to simulate recoil or as a full on servo output that is timed, based on pot value. Was intending on an SD card setup similar to the RCCOMMAND or ELMOD units. Haven't written the code for this as of yet and planning to use a different chip.

Anyone else with ideas?
Old 12-22-2009, 03:46 AM
  #7  
B/Man
 
Join Date: Nov 2008
Location: Yass NSW, AUSTRALIA
Posts: 208
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Good luck with the project, I really hope you manage to get it together. It would be great to have a cheaper alternative to El Mod.
Personally I'd be happy with something that would stop the HL recoil and super spin, provide momentum, and offer customisable sounds to replace the standard HL rubbish.
Old 12-22-2009, 04:10 AM
  #8  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Heres some more features I was thinking of adding

Gear selection delay
Azimuth Acceleration ramps
Machine gun flash
Channel input changes on vehicle type
Aux lighting
Shifting gears
long-range and close-range hit recognition
Old 12-22-2009, 08:04 AM
  #9  
Perry S.
 
Perry S.'s Avatar
 
Join Date: Jan 2007
Location: Clifton Park, NY
Posts: 2,124
Likes: 0
Received 2 Likes on 2 Posts
Default RE: Open Source Battle System

how would you implement the long/short range recognition?

Perry
Old 12-22-2009, 08:16 AM
  #10  
971wright
Senior Member
 
Join Date: Dec 2007
Location: nelson, UNITED KINGDOM
Posts: 679
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Hi Hope this works would be very interested in getting a better sound and function for some of my tanks.

regards pete
Old 12-22-2009, 08:42 AM
  #11  
YHR
Senior Member
 
YHR's Avatar
 
Join Date: Nov 2006
Location: Grande Prairie, AB, CANADA
Posts: 8,976
Likes: 0
Received 4 Likes on 4 Posts
Default RE: Open Source Battle System

Don't go too far. You have to remember the end user, and we are a simple lot. I don't want to have to spend hours programming in stuff, only to have it as a disadvantage out on the battlefield, when not many others have it. IF David's DBC had a decent sound card option that would replace the stock sounds on a Heng Long it would be golden. Lose the DIY and sell the boards stuffed and ready for installation, and I think you would sell a lot of them. I don't think people are looking for much more then that. Maybe a random destruct that could knock out a tank in one shot, just to throw in some luck might be nice. Sometimes a lucky shot would take out a tank. You know if a Sherman lobbed a shell at a Tiger and it just happend to go down the barrel to the breach and set off a loaded 88, it would have disasterous effects on the Tiger!!!!
Old 12-22-2009, 11:24 AM
  #12  
ksoc
 
ksoc's Avatar
 
Join Date: Jun 2006
Location: Dana Point, CA
Posts: 1,368
Received 1 Like on 1 Post
Default RE: Open Source Battle System

The "random effect" could also disable the tank without destroying it - loss of track (only one side works), loss of turret rotation, etc....

I've heard of IR systems that use coded signals, so you can ID who hits who - you just might find out your worst nemesis is on your own team ! I know this makes it more complicated, and you'd need a PC on the battlefield to take advantage of it, but we can always dream...
Old 12-22-2009, 12:31 PM
  #13  
Alan123
 
Alan123's Avatar
 
Join Date: Mar 2008
Location: Bremen, GERMANY
Posts: 273
Likes: 0
Received 1 Like on 1 Post
Default RE: Open Source Battle System


ORIGINAL: ksoc

The ''random effect'' could also disable the tank without destroying it - loss of track (only one side works), loss of turret rotation, etc....

I've heard of IR systems that use coded signals, so you can ID who hits who - you just might find out your worst nemesis is on your own team ! I know this makes it more complicated, and you'd need a PC on the battlefield to take advantage of it, but we can always dream...

What you need to build in is a friend or foe recognition feature. I have seen this done with some HL tanks however I do not know how it was done. Then there will be no more friendly fire danger.

It is impressive what you are doing, I wonder if it would be possible to use data from a computer game (say Close Combat or Theatre of War, for example) and input the relative armour and shot strengths on a per model basis so that what you have is a real life computer simulation with realistic gun and armour ratings, perhaps even hitting power adjusted for range. Skies the limit.

The data is already there (which is a huge job in its self) and it could be used for some very realistic model tank battling in the same way the computer games work (the realistic ones not the noddy Command and Conquer types).

Cheers

Alan
Old 12-23-2009, 05:16 AM
  #14  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Alan123, ksoc

I was intending on doing exactly what you are saying. Originally i was intending on having 128 different vehicle profiles including the three-four tamiya types and 124 (lots and lots and lots of research) specific famous/common vehicles from history. The intention is to use coding to simulate different cannon power levels, specific but dynamic power to weight ratios, and differing armor profiles for front, side and rear.

I still intend on experimenting with this in the future but do to complexity decided to start with 8 profiles that can be used within the tamiya type battle system. This includes: wheeled vehicle, very light, light, medium, heavy, eastern MBT, Western MBT, and IFV/APC. I intend on this first try to fire the same tamiya signal that all the other tamiya compatible systems use as well as add a new signal for the wheeled vehicle, IFV/APC profiles to simulate heavy machine gun fire. Intention is that these two vehicles could be destroyed by the standard signal and the machine gun signal. The machine gun signal however would not effect the other vehicle classes. Also I was thinking that the IFV class could fire the same main gun signal as the other classes to simulate a ATGW with a limit of maybe two rounds per rebirth.

A sensor could be mounted to the bottom of the hull to receive signals from a transmitter that is buried in the battle field and would either slow the tank down like a shot or in the case of this system could disable traction simulating the destruction of a track. This is what I love about the idea of making it open source, when someone comes up with an idea that is workable we can make the mod or write the code ourselves and give it a go. I have wondered why for some time no one has started something like this in the past. Many other hobbies (Hobby Robotics) have groups of people doing similar stuff.

Perry S.

I have a few ideas on this but don't want to say it till I get a chance to try it. I cant see why it couldn't be possible. Question is if it could be done with no calibration.

ksoc, YHR

Never thought of anything with random lucky shots.

That is exactly the kinds of ideas I'm looking for. Stuff that might be really easy to do but I haven't thought of. I'm really keyed on helping to use intelligent code to make the vehicles behave more like a real vehicle. Azimuth acceleration for example, I was sitting in a turret the other day trying to re-qual an azimuth test then it dawned on me that a 49,000 pound turret doesn't accelerate to full speed instantly, and I think simulating that ramp would look great. Stuff like after the main gun is fired the loader throws a switch and the breach drops down to a specific location so he can shove in the next round. A switch(M1A1) or the hull-turret postion sensor(M1A2) is used to raise the main gun up to clear the rear deck. This type of stuff is real easy to do.

Keep the ideas coming. Through anything out there.
Old 12-23-2009, 05:39 AM
  #15  
Alan123
 
Alan123's Avatar
 
Join Date: Mar 2008
Location: Bremen, GERMANY
Posts: 273
Likes: 0
Received 1 Like on 1 Post
Default RE: Open Source Battle System

Another thing I would like to see is a greater variety of battle damage, again a refer back to my computer tank simulator programmes where you get such things as:

Turret jams.
No elevation.
Canon does not fire but the tank can still move and has an MG.
Longer reload times due to downed crewman.
One track blown off but the vehicle can still pivot/turn with the remaining intact track.
Engine knocked out but the tank can still fight on as a bunker.

Perhaps even the opportunity to effect repairs and some of the functions return to simulate this after a period of time. (putting the track back on or unjamming the canon or turret)

The tamiya system is limited to merely going slower with each hit, until it stops and is finally destroyed, however all other functions remain intact.

Random ricochet hits would also be nice, instead of every hit being a killer it could simply rebound off with the nice clang sound and no damage.

Just thoughts.

Alan
Old 12-23-2009, 06:48 AM
  #16  
Perry S.
 
Perry S.'s Avatar
 
Join Date: Jan 2007
Location: Clifton Park, NY
Posts: 2,124
Likes: 0
Received 2 Likes on 2 Posts
Default RE: Open Source Battle System

I really like the idea of directional armor. One shot directly in the rear takes a tank out. Also, someone suggested that you can simulate a track out. That is a great idea.

This is an ambitious project but I am starting to like it.

Perry
Old 12-23-2009, 07:17 AM
  #17  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

Implementing the directional armor and cannon power levels isn't a hard problem. The research into armor levels and main gun penetrating levels for each vehicle is the hard part. I started looking into it a little and found this website. I think if we went down this path it would be important to maintain full compatibility with tamiya.

http://collinsj.tripod.com/protect.htm
Old 12-23-2009, 07:51 AM
  #18  
Alan123
 
Alan123's Avatar
 
Join Date: Mar 2008
Location: Bremen, GERMANY
Posts: 273
Likes: 0
Received 1 Like on 1 Post
Default RE: Open Source Battle System

Yes that website has a lot of info in it.

I was thinking of the weapons tables that some of the wargames have in them. There all the research has been done. I thinking of games such as:

The close combat series
Theatre of war
Steel Panthers

Plus lots of others I have never had a chance to look at.

I remember years ago opening the data tables in the Steel Panther games (is also open source) and having a look at them plus modding some of the values. The sheets open up and save in Excel and other types of spreadsheet software programmes.

AL
Old 12-23-2009, 10:36 AM
  #19  
ksoc
 
ksoc's Avatar
 
Join Date: Jun 2006
Location: Dana Point, CA
Posts: 1,368
Received 1 Like on 1 Post
Default RE: Open Source Battle System

Before all the German tankers start drooling too much about the 'one shot kills' from their 88's, you better throw in a variable for reliability - Panthers and Tigers becoming pill boxes when the drive train break all on its own Didn't I read somewhere that more Tigers were scuttled by their own crews (to avoid capture) than destroyed by the enemy? Part of it would be random, the other related to speed - the longer and closer to 100% throttle used, the more likely the tank is to break down.

What ever you come up with, it sounds like a great idea!
Old 12-24-2009, 10:39 AM
  #20  
heavyaslead
 
heavyaslead's Avatar
 
Join Date: Nov 2002
Location: Loganville, GA
Posts: 1,913
Likes: 0
Received 36 Likes on 25 Posts
Default RE: Open Source Battle System

BREED you were asking of the IR coding? As much as I know is the 38kHz carrier signal at 940nm and sends about 50 packets of signal per second. The IR pulse is about one second of repeated IR code.

The signal can be read with a programmable universal remote.
Old 12-24-2009, 10:54 AM
  #21  
YHR
Senior Member
 
YHR's Avatar
 
Join Date: Nov 2006
Location: Grande Prairie, AB, CANADA
Posts: 8,976
Likes: 0
Received 4 Likes on 4 Posts
Default RE: Open Source Battle System


ORIGINAL: ksoc

Before all the German tankers start drooling too much about the 'one shot kills' from their 88's, you better throw in a variable for reliability - Panthers and Tigers becoming pill boxes when the drive train break all on its own Didn't I read somewhere that more Tigers were scuttled by their own crews (to avoid capture) than destroyed by the enemy? Part of it would be random, the other related to speed - the longer and closer to 100% throttle used, the more likely the tank is to break down.

What ever you come up with, it sounds like a great idea!

Yes indeed. 50% of a King Tigers battle life should be sitting still. I'm all for making it real, but it has to work both ways. When all those heavy German tanks hit the battlefield , half of them should be pillboxes within the first 10 minutes!!!!!!!!

I really like the balistics idea. A Sherman Firefly with a 17 pdr should be able to take out heavy German armour in a shot or two. The ballistics on the 17 pdr showed they had better pentrating power then the legendary 88. So the current basic Tam Standard addresses the armour issue but does nothing to match the gun performance. A system that did that would be a lot of fun.

One thing to remember in all this development though. It has to be backwards compatible and dumbed dumb easily to emulate the current Tamiya system.
Old 12-25-2009, 02:54 AM
  #22  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

What you guys think about keeping count of number of rounds carried by each vehicle and requiring a resupply after ammunition runs out. Could just be a requirement to physically push a button to resupply.
Old 12-25-2009, 06:36 AM
  #23  
Alan123
 
Alan123's Avatar
 
Join Date: Mar 2008
Location: Bremen, GERMANY
Posts: 273
Likes: 0
Received 1 Like on 1 Post
Default RE: Open Source Battle System

Another thought is that not all ammo was the same. In my tank simulators most of the tanks carry at least 5 rounds of Special AT where sometimes the penetrating power is 50% more than the standard AT round.

If you were in a Sherman 76 and were taking on a panzer IV you would choose standard AT, however if you were up against, say a tiger, you would choose one of your magic bullets (Special AT) (armour piecing discarding sabot or tungsten core etc) and hope for a penetrating hit.

That would add spice to any combat, the germans too had special ammo for taking on the the Russian heavies.

Some anti tank dedicated units had half of their ammo loadout as special AT, eg the M10 and M36 units.

Merry Xmas

Alan
Old 12-25-2009, 09:15 AM
  #24  
ArmChairGeneral
 
ArmChairGeneral's Avatar
 
Join Date: Feb 2007
Location: Tallahassee, FL
Posts: 1,551
Likes: 0
Received 2 Likes on 2 Posts
Default RE: Open Source Battle System

I like the concept put forth here, I have tables on all the WWII armor ( hull front/side/rear, turret front/side/rear, glacis plate etc ) as used in a table top wargame and appear accurate. It also has tables for weapon penetration and hit percentages by range from all the guns used in the AFV's and towed. Let me know if you want a copy for this project.

Paul
Old 03-28-2010, 09:49 PM
  #25  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default RE: Open Source Battle System

I've gotten around to working on this again. Been too busy at work and home. Got the code done to my satisfaction for the control of the vehicle. All the mixing schemes are done and tested, the barrel stabilization is working and the various pot inputs that are used to adjust speeds are worked out. It's time for me to dig into the Battle system side of this project then on to the code for sound.

I currently do not have any information on the Tamiya compatible system. Does anyone have any specs on the pulse train transmitted by the system or any other useful information on its workings.

As far as the sound section goes I haven't even started looking at this code. Ive done some thinking about how the individual sounds would be selected. I've purchased an Adafruit sound shield for the Arduino and i'm intending on developing on this board.

My intentions at this point are to design a BattleTank Shield for the Arduino mega. This new board will take input from a bec to power servos, sound player with SD card, all the necessary pots, switches and connections. Ive started working on how this board will be laid out.

Thread Tools
Search this Thread

Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service -

Copyright © 2024 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.