Mission: support do-digicam-control parameters

This commit is contained in:
Randy Mackay 2015-03-28 18:29:21 -07:00
parent a27f383612
commit 888c2289ce
2 changed files with 59 additions and 2 deletions

View File

@ -603,8 +603,23 @@ bool AP_Mission::mavlink_to_mission_cmd(const mavlink_mission_item_t& packet, AP
cmd.p1 = packet.param1; // 0 = no roi, 1 = next waypoint, 2 = waypoint number, 3 = fixed location, 4 = given target (not supported)
break;
case MAV_CMD_DO_DIGICAM_CONFIGURE: // MAV ID: 202
cmd.content.digicam_configure.shooting_mode = packet.param1;
cmd.content.digicam_configure.shutter_speed = packet.param2;
cmd.content.digicam_configure.aperture = packet.param3;
cmd.content.digicam_configure.ISO = packet.param4;
cmd.content.digicam_configure.exposure_type = packet.x;
cmd.content.digicam_configure.cmd_id = packet.y;
cmd.content.digicam_configure.engine_cutoff_time = packet.z;
break;
case MAV_CMD_DO_DIGICAM_CONTROL: // MAV ID: 203
// command takes no parameters
cmd.content.digicam_control.session = packet.param1;
cmd.content.digicam_control.zoom_pos = packet.param2;
cmd.content.digicam_control.zoom_step = packet.param3;
cmd.content.digicam_control.focus_lock = packet.param4;
cmd.content.digicam_control.shooting_cmd = packet.x;
cmd.content.digicam_control.cmd_id = packet.y;
break;
case MAV_CMD_DO_MOUNT_CONTROL: // MAV ID: 205
@ -881,8 +896,23 @@ bool AP_Mission::mission_cmd_to_mavlink(const AP_Mission::Mission_Command& cmd,
packet.param1 = cmd.p1; // 0 = no roi, 1 = next waypoint, 2 = waypoint number, 3 = fixed location, 4 = given target (not supported)
break;
case MAV_CMD_DO_DIGICAM_CONFIGURE: // MAV ID: 202
packet.param1 = cmd.content.digicam_configure.shooting_mode;
packet.param2 = cmd.content.digicam_configure.shutter_speed;
packet.param3 = cmd.content.digicam_configure.aperture;
packet.param4 = cmd.content.digicam_configure.ISO;
packet.x = cmd.content.digicam_configure.exposure_type;
packet.y = cmd.content.digicam_configure.cmd_id;
packet.z = cmd.content.digicam_configure.engine_cutoff_time;
break;
case MAV_CMD_DO_DIGICAM_CONTROL: // MAV ID: 203
// these commands takes no parameters
packet.param1 = cmd.content.digicam_control.session;
packet.param2 = cmd.content.digicam_control.zoom_pos;
packet.param3 = cmd.content.digicam_control.zoom_step;
packet.param4 = cmd.content.digicam_control.focus_lock;
packet.x = cmd.content.digicam_control.shooting_cmd;
packet.y = cmd.content.digicam_control.cmd_id;
break;
case MAV_CMD_DO_MOUNT_CONTROL: // MAV ID: 205

View File

@ -113,6 +113,27 @@ public:
float yaw; // yaw angle (relative to vehicle heading) in degrees
};
// digicam control command structure
struct PACKED Digicam_Configure {
uint8_t shooting_mode; // ProgramAuto = 1, AV = 2, TV = 3, Man=4, IntelligentAuto=5, SuperiorAuto=6
uint16_t shutter_speed;
uint8_t aperture; // F stop number * 10
uint16_t ISO; // 80, 100, 200, etc
uint8_t exposure_type;
uint8_t cmd_id;
float engine_cutoff_time; // seconds
};
// digicam control command structure
struct PACKED Digicam_Control {
uint8_t session; // 1 = on, 0 = off
uint8_t zoom_pos;
uint8_t zoom_step;
uint8_t focus_lock;
uint8_t shooting_cmd;
uint8_t cmd_id;
};
// set cam trigger distance command structure
struct PACKED Cam_Trigg_Distance {
float meters; // distance
@ -163,6 +184,12 @@ public:
// mount control
Mount_Control mount_control;
// camera configure
Digicam_Configure digicam_configure;
// camera control
Digicam_Control digicam_control;
// cam trigg distance
Cam_Trigg_Distance cam_trigg_dist;