You're looking for the "pitch" value of your robot.
For example, this relatively simple code segment finds the nearest TargetBot and then uses the pitch value plus some basic trigonometry to feed the correct value into aim()
//our variables
object KillMe;
float range;
float ZDif;
float absoluteElevation;
float correctedElevation;
//calculate the angle we need to adjust our cannon
range = distance(this.position, KillMe.position);
absoluteElevation = atan((KillMe.position.z - position.z)/distance(this.position,KillMe.position));
correctedElevation = absoluteElevation - pitch;
aim(correctedElevation);
fire(0.1);
Obviously, it doesn't take into account the min/max elevations for the particular bot weapon you're using, or the min-max range of it.