Predator Drone Project
A Product of ChronoShift Industries
Background Information:
The Predator Mk.II Drone is latest UAV from ChronoShift Industries. The Predator is the culmination of several years of research into Anti-Gravity Technology, Plasma Thrusters, Adaptable Hunter-Killer AI, and Advanced Modular Weapon Systems (AMWS).
The Predator is an aerial-class attack drone. It can perform aerial attack, point defense, and hunter-seeker sweeps completely autonomously. Using the advanced Anti-Gravity Stabilization System, the drone can find and maintain any desired altitude easily and quickly. It can also maintain proper attitude and keep it self level at all times, ready to fire on a moment's notice. Once a proper attack altitude has been reached, the drone quickly aligns itself with its target and begins pursuit. It keeps a steady distance to the target, which varies depending on what weapons PODS (Portable Ordinance Delivery System) are used.
Construction
The overall design of the Drone involves several plates and an armoured Hull, with two stubs near the rear that house the PODS connections. It stays airborne thanks to 5 hoverballs and 3 GPS receivers. The GPS receivers, being in separate corners of the bot, help keep it level (since each hoverball group is controlled by its nearby GPS reciever). There are no fussy Rangers, nor is there any math involved in trying to calculate the height of a certain map.
Six thrusters (2 on the sides and 1 in the front in back) help the drone position itself and chase targets. It can move all directions, turn, and strafe.
The wing stubs will soon have ports for connecting the Weapons PODS to, which will use a standardized protocol, allowing for a myriad of weapons to be used.
The entire drone will be controlled by a set of 6 E2 chips (the current prototype uses 3), with each chip dedicated to a certain function of the bot. This provides some redundancy and removes a single point of failure for the bot.
Coding:
The entire bot runs by itself, as in it generally receives no input from a human operator (although it can be over-ridden by a ground controller). On boot-up, the drone hovers about 25 feet from the ground, waiting for orders. Once you press a key to tell it to go into attack mode, the drone heads for its attack altitude, and once there chases down the target to destroy. Once the target is gone, the drone can either hover at-altitude, waiting for hostiles, or it can return to standby, waiting for orders from the operator.
Eventually the drone will have advanced Threat Detection and Target Acquisition Features. It will be able to differentiate between friends and foes, and will be able to prioritize certain targetsover your average NPC.
Here's the code I've got so far for the three E2 chips (Propulsion, Targeting, and Control), feel free to critique it. I'm sure I'm going to need to optimize it later.
Control E2:
Code:
@name P-D Drone Control System (v.1)
@inputs Keypad0 Keypad1 Keypad2 Keypad3
@outputs State
@persist
@trigger all
timer("control", 10)
if(clk("control")){
#State0 is PowerOff
if(Keypad0 == 1){
Keypad1 = 0
Keypad2 = 0
Keypad3 = 0
State = 0
}
#State1 is Standby
if(Keypad1 == 1){
Keypad0 = 0
Keypad2 = 0
Keypad3 = 0
State = 1
}
#State2 is Hold
if(Keypad2 == 1){
Keypad0 = 0
Keypad1 = 0
Keypad3 = 0
State = 2
}
#State3 is Search and Destroy
if(Keypad3 == 1){
Keypad0 = 0
Keypad1 = 0
Keypad2 = 0
State = 3
}
}
Targeting E2:
Code:
@name P-D Drone Targeting Subsystem (v.1)
@inputs BS1Dist BS1Bear BS1Elev
@outputs TargetDist TargetBear TargetElev
@persist
@trigger all
#This subsystem will eventually be able to intelligently identify targets
#Right now it just passes the data along from the target finder and beacon sensor,
#and simply outputs it to the propulsion subsystem for manuevering
#Start
timer("control",10)
if(clk("control")){TargetDist=BS1Dist, TargetBear=BS1Bear, TargetElev=BS1Elev}
Propulsion E2:
Code:
@name P-D Drone Propulsion Subsystem (v.3)
@inputs GPSZRL GPSZRR GPSZF TargetDist TargetBear TargetElev State
@outputs HovRL HovRR HovF HovMode FLThrust FRThrust RLThrust RRThrust RearThrust FrontThrust GroundDist
@persist
@trigger all
# This is the propulsion subsystem for the Predator drone
# It controls the drone's altitude and attitude (orientation)
# It also aligns itself with and chases the target (passed from targeting subsystem)
#Declare Constants, Start Timers
timer("control",10)
AltConst = 700 #Altitude Constant: this changes per map, currently set to gm_construct
Fudge = 5 #Fudge Factor: this is our fudge number, it allows for some error in altitude/attitude
EngageDist = 750 #Engagement Distance: this is how close we want the drone to get to its target
ThrustMult = 10 #Thrust Multiplier: this is how much to multiply positional thrusters by
#Start the control timer
if(clk("control")){
#PowerOff State
if(State == 0){
HovMode = 0
FRThrust = 0
FLThrust = 0
RLThrust = 0
RRThrust = 0
RearThrust = 0
FrontThrust = 0
}
#Standby State
if(State == 1){
AltConst = 25
HovMode = 1
#rear left Hoverballs
if(GPSZRL < AltConst - Fudge){HovRL = 1}
elseif(GPSZRL > AltConst + Fudge){HovRL = -1}
else{HovRL = 0}
#rear right Hoverballs
if(GPSZRR < AltConst - Fudge){HovRR = 1}
elseif(GPSZRR > AltConst + Fudge){HovRR = -1}
else{HovRR = 0}
#front Hoverballs
if(GPSZF < AltConst - Fudge){HovF = 1}
elseif(GPSZF > AltConst + Fudge){HovF = -1}
else{HovF = 0}
}
#Hold State
if(State == 2){
AltConst = 750
HovMode = 1
#rear left Hoverballs
if(GPSZRL < AltConst - Fudge){HovRL = 1}
elseif(GPSZRL > AltConst + Fudge){HovRL = -1}
else{HovRL = 0}
#rear right Hoverballs
if(GPSZRR < AltConst - Fudge){HovRR = 1}
elseif(GPSZRR > AltConst + Fudge){HovRR = -1}
else{HovRR = 0}
#front Hoverballs
if(GPSZF < AltConst - Fudge){HovF = 1}
elseif(GPSZF > AltConst + Fudge){HovF = -1}
else{HovF = 0}
}
#Search and Destroy State
if(State == 3){
HovMode = 1
#begin altitude/attitude control
#rear left Hoverballs
if(GPSZRL < AltConst - Fudge){HovRL = 1}
elseif(GPSZRL > AltConst + Fudge){HovRL = -1}
else{HovRL = 0}
#rear right Hoverballs
if(GPSZRR < AltConst - Fudge){HovRR = 1}
elseif(GPSZRR > AltConst + Fudge){HovRR = -1}
else{HovRR = 0}
#front Hoverballs
if(GPSZF < AltConst - Fudge){HovF = 1}
elseif(GPSZF > AltConst + Fudge){HovF = -1}
else{HovF = 0}
#begin target tracking & chasing
#only begin once we reach altitude
if(HovF == 0 & HovRL == 0 & HovRR == 0){
#align drone with target
# 0 to -180 is left side, 0 to 180 is right side
if(TargetBear < 0 - Fudge){
FRThrust = ThrustMult
FLThrust = -ThrustMult
RLThrust = ThrustMult
RRThrust = -ThrustMult
}
elseif(TargetBear > 0 + Fudge){
FRThrust = -ThrustMult
FLThrust = ThrustMult
RLThrust = -ThrustMult
RRThrust = ThrustMult
}
#if we are lined up we don't want to move
else{
FRThrust = 0
FLThrust = 0
RLThrust = 0
RRThrust = 0
}
#calculate ground distance to target, yea trigeometry!
GroundDist = sin(TargetElev) * TargetDist
if(GroundDist > EngageDist + 35 ){
RearThrust = ThrustMult
FrontThrust = 0
}
elseif(GroundDist < EngageDist - 35 & GroundDist != 0){
FrontThrust = ThrustMult * (1/2)
RearThrust = 0
}
#if we are close enough we don't want to move
else{
RearThrust = 0
FrontThrust = 0
}
}
#if we are not at altitude we don't want to engage positional thrusters
else{
FRThrust = 0
FLThrust = 0
RLThrust = 0
RRThrust = 0
RearThrust = 0
FrontThrust = 0
}
}
}
I'll be posting more as I progress on this project, and hopefully we will get to see some drone-on-drone combat soon.
Bookmarks