Skip to content

Commit

Permalink
Merge commit 'af3455a294571e95cdff030232d90d753e73c8f3' into Allow-wa…
Browse files Browse the repository at this point in the history
…ypoint-hsa-alternating
  • Loading branch information
EyesWider committed Jun 6, 2024
2 parents 93289b0 + af3455a commit 7b1d797
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 65 deletions.
14 changes: 7 additions & 7 deletions ArduSub/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("RAW_SENS", 0, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_RAW_SENSORS], 0),
AP_GROUPINFO("RAW_SENS", 0, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_RAW_SENSORS], 2),

// @Param: EXT_STAT
// @DisplayName: Extended status stream rate to ground station
Expand All @@ -279,7 +279,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("EXT_STAT", 1, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTENDED_STATUS], 0),
AP_GROUPINFO("EXT_STAT", 1, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTENDED_STATUS], 2),

// @Param: RC_CHAN
// @DisplayName: RC Channel stream rate to ground station
Expand All @@ -289,7 +289,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("RC_CHAN", 2, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_RC_CHANNELS], 0),
AP_GROUPINFO("RC_CHAN", 2, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_RC_CHANNELS], 2),

// @Param: POSITION
// @DisplayName: Position stream rate to ground station
Expand All @@ -299,7 +299,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("POSITION", 4, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_POSITION], 0),
AP_GROUPINFO("POSITION", 4, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_POSITION], 3),

// @Param: EXTRA1
// @DisplayName: Extra data type 1 stream rate to ground station
Expand All @@ -309,7 +309,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("EXTRA1", 5, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTRA1], 0),
AP_GROUPINFO("EXTRA1", 5, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTRA1], 10),

// @Param: EXTRA2
// @DisplayName: Extra data type 2 stream rate to ground station
Expand All @@ -319,7 +319,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("EXTRA2", 6, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTRA2], 0),
AP_GROUPINFO("EXTRA2", 6, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTRA2], 10),

// @Param: EXTRA3
// @DisplayName: Extra data type 3 stream rate to ground station
Expand All @@ -329,7 +329,7 @@ const AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
// @Increment: 1
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("EXTRA3", 7, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTRA3], 0),
AP_GROUPINFO("EXTRA3", 7, GCS_MAVLINK_Parameters, streamRates[GCS_MAVLINK::STREAM_EXTRA3], 3),

// @Param: PARAMS
// @DisplayName: Parameter stream rate to ground station
Expand Down
1 change: 0 additions & 1 deletion Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,6 @@ def get_sim_parameter_documentation_get_whitelist(self):
"SIM_WAVE_LENGTH",
"SIM_WAVE_SPEED",
"SIM_WIND_DIR_Z",
"SIM_WIND_T",
])

vinfo_key = self.vehicleinfo_key()
Expand Down
39 changes: 39 additions & 0 deletions libraries/AP_Camera/AP_Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#if AP_CAMERA_ENABLED

#include <GCS_MAVLink/GCS.h>
#include <AP_Math/AP_Math.h>
#include <AP_HAL/AP_HAL.h>
#include <SRV_Channel/SRV_Channel.h>
Expand Down Expand Up @@ -432,6 +433,44 @@ MAV_RESULT AP_Camera::handle_command(const mavlink_command_int_t &packet)
}
}

// send a mavlink message; returns false if there was not space to
// send the message, true otherwise
bool AP_Camera::send_mavlink_message(GCS_MAVLINK &link, const enum ap_message msg_id)
{
const auto chan = link.get_chan();

switch (msg_id) {
case MSG_CAMERA_FEEDBACK:
CHECK_PAYLOAD_SIZE2(CAMERA_FEEDBACK);
send_feedback(chan);
break;
case MSG_CAMERA_INFORMATION:
CHECK_PAYLOAD_SIZE2(CAMERA_INFORMATION);
send_camera_information(chan);
break;
case MSG_CAMERA_SETTINGS:
CHECK_PAYLOAD_SIZE2(CAMERA_SETTINGS);
send_camera_settings(chan);
break;
#if AP_CAMERA_SEND_FOV_STATUS_ENABLED
case MSG_CAMERA_FOV_STATUS:
CHECK_PAYLOAD_SIZE2(CAMERA_FOV_STATUS);
send_camera_fov_status(chan);
break;
#endif
case MSG_CAMERA_CAPTURE_STATUS:
CHECK_PAYLOAD_SIZE2(CAMERA_CAPTURE_STATUS);
send_camera_capture_status(chan);
break;

default:
// should not reach this; should only be called for specific IDs
break;
}

return true;
}

// set camera trigger distance in a mission
void AP_Camera::set_trigger_distance(uint8_t instance, float distance_m)
{
Expand Down
37 changes: 21 additions & 16 deletions libraries/AP_Camera/AP_Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <AP_Param/AP_Param.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
#include <GCS_MAVLink/ap_message.h>
#include "AP_Camera_Params.h"
#include "AP_Camera_shareddefs.h"

Expand Down Expand Up @@ -86,22 +87,9 @@ class AP_Camera {
// handle MAVLink command from GCS to control the camera
MAV_RESULT handle_command(const mavlink_command_int_t &packet);

// send camera feedback message to GCS
void send_feedback(mavlink_channel_t chan);

// send camera information message to GCS
void send_camera_information(mavlink_channel_t chan);

// send camera settings message to GCS
void send_camera_settings(mavlink_channel_t chan);

#if AP_CAMERA_SEND_FOV_STATUS_ENABLED
// send camera field of view status
void send_camera_fov_status(mavlink_channel_t chan);
#endif

// send camera capture status message to GCS
void send_camera_capture_status(mavlink_channel_t chan);
// send a mavlink message; returns false if there was not space to
// send the message, true otherwise
bool send_mavlink_message(class GCS_MAVLINK &link, const enum ap_message id);

// configure camera
void configure(float shooting_mode, float shutter_speed, float aperture, float ISO, int32_t exposure_type, int32_t cmd_id, float engine_cutoff_time);
Expand Down Expand Up @@ -232,6 +220,23 @@ class AP_Camera {
// perform any required parameter conversion
void convert_params();

// send camera feedback message to GCS
void send_feedback(mavlink_channel_t chan);

// send camera information message to GCS
void send_camera_information(mavlink_channel_t chan);

// send camera settings message to GCS
void send_camera_settings(mavlink_channel_t chan);

#if AP_CAMERA_SEND_FOV_STATUS_ENABLED
// send camera field of view status
void send_camera_fov_status(mavlink_channel_t chan);
#endif

// send camera capture status message to GCS
void send_camera_capture_status(mavlink_channel_t chan);

HAL_Semaphore _rsem; // semaphore for multi-thread access
AP_Camera_Backend *primary; // primary camera backed
bool _is_in_auto_mode; // true if in AUTO mode
Expand Down
42 changes: 2 additions & 40 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6014,58 +6014,20 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)

#if AP_CAMERA_ENABLED
case MSG_CAMERA_FEEDBACK:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_FEEDBACK);
camera->send_feedback(chan);
}
break;
case MSG_CAMERA_INFORMATION:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_INFORMATION);
camera->send_camera_information(chan);
}
break;
case MSG_CAMERA_SETTINGS:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_SETTINGS);
camera->send_camera_settings(chan);
}
break;
#if AP_CAMERA_SEND_FOV_STATUS_ENABLED
case MSG_CAMERA_FOV_STATUS:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_FOV_STATUS);
camera->send_camera_fov_status(chan);
}
break;
#endif
case MSG_CAMERA_CAPTURE_STATUS:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_CAPTURE_STATUS);
camera->send_camera_capture_status(chan);
return camera->send_mavlink_message(*this, id);
}
break;
#endif
#endif // AP_CAMERA_ENABLED

case MSG_SYSTEM_TIME:
CHECK_PAYLOAD_SIZE(SYSTEM_TIME);
Expand Down
2 changes: 1 addition & 1 deletion libraries/SITL/SITL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const AP_Param::GroupInfo SIM::var_info2[] = {
AP_GROUPINFO("TEMP_BFACTOR", 4, SIM, temp_baro_factor, 0),

AP_GROUPINFO("WIND_DIR_Z", 10, SIM, wind_dir_z, 0),
// @Param: WIND_T_
// @Param: WIND_T
// @DisplayName: Wind Profile Type
// @Description: Selects how wind varies from surface to WIND_T_ALT
// @Values: 0:square law,1: none, 2:linear-see WIND_T_COEF
Expand Down

0 comments on commit 7b1d797

Please sign in to comment.