![]() |
VSM C++ SDK
Vehicle Specific Modules SDK
|
Base class for user-defined vehicles. More...
#include <vehicle.h>
Classes | |
class | Command_map |
class | Hasher |
Hasher for Vehicle shared pointer. More... | |
Public Types | |
typedef std::shared_ptr< Vehicle > | Ptr |
Pointer type. | |
typedef std::weak_ptr< Vehicle > | Weak_ptr |
Pointer type. | |
![]() | |
typedef std::shared_ptr< Device > | Ptr |
Pointer type. | |
typedef std::weak_ptr< Device > | Weak_ptr |
Pointer type. | |
typedef Callback_proxy< void, std::vector< Property::Ptr > > | Command_handler |
typedef Callback_proxy< void, uint32_t, Proto_msg_ptr > | Response_sender |
Completion handler type of the request. More... | |
Public Member Functions | |
Vehicle (proto::Device_type type=proto::DEVICE_TYPE_VEHICLE, Request_processor::Ptr processor=nullptr, Request_completion_context::Ptr completion_ctx=nullptr) | |
Constructor for a base class. More... | |
virtual | ~Vehicle () |
Make sure class is polymorphic. More... | |
Vehicle (const Vehicle &)=delete | |
Disable copying. More... | |
void | Process_requests () |
Process requests assigned to vehicle in user thread, i.e. More... | |
void | Set_serial_number (const std::string &) |
Set serial number. | |
const std::string & | Get_serial_number () const |
Get serial number of the vehicle. More... | |
const std::string & | Get_model_name () const |
Get model name of the vehicle. | |
void | Set_model_name (const std::string &) |
Set model name of the vehicle. | |
void | Set_port_name (const std::string &) |
Set port name. | |
const std::string & | Get_port_name () const |
Get port name the vehicle is connected to. More... | |
const std::string & | Get_frame_type () const |
Get frame type of the vehicle. | |
void | Set_frame_type (const std::string &) |
Set frame type of the vehicle. | |
proto::Vehicle_type | Get_vehicle_type () const |
void | Set_vehicle_type (proto::Vehicle_type) |
bool | Is_vehicle_type (proto::Vehicle_type type) |
bool | Is_copter () |
![]() | |
Device (proto::Device_type type, Request_processor::Ptr processor=nullptr, Request_completion_context::Ptr completion_ctx=nullptr) | |
void | Enable () |
Enable the instance. More... | |
void | Disable () |
Disable the instance. More... | |
bool | Is_enabled () |
Vehicle enable/disable status. More... | |
Device (const Device &)=delete | |
Disable copying. More... | |
void | On_ucs_message (ugcs::vsm::proto::Vsm_message message, Response_sender completion_handler=Response_sender(), ugcs::vsm::Request_completion_context::Ptr completion_ctx=nullptr) |
Command has arrived from UCS and should be executed by the vehicle. | |
void | Register (ugcs::vsm::proto::Vsm_message &) |
template<typename Type > | |
Property::Ptr | Set_property (const std::string &name, Type value, proto::Field_semantic semantic=proto::FIELD_SEMANTIC_DEFAULT) |
uint32_t | Get_session_id () |
Request_completion_context::Ptr | Get_completion_ctx () |
Get default completion context of the device. More... | |
void | Register () |
Register device instance to UCS processor. More... | |
void | Unregister () |
Unregister device instance from UCS processor. More... | |
bool | Is_registered () |
Returns true if vehicle is registered with cucs_processor. More... | |
std::string | Dump_command (const ugcs::vsm::proto::Device_command &) |
Subsystem::Ptr | Add_subsystem (proto::Subsystem_type) |
Request_processor::Ptr | Get_processing_ctx () |
Get default processing context of the vehicle. More... | |
virtual void | Handle_ucs_info (std::vector< Ucs_info >) |
Called when number of ucs connections change. More... | |
Static Public Member Functions | |
template<typename... Args> | |
static Ptr | Create (Args &&...args) |
Create an instance. More... | |
![]() | |
template<typename... Args> | |
static Ptr | Create (Args &&...args) |
Create an instance. More... | |
static void | Set_failsafe_actions (Property::Ptr p, std::initializer_list< proto::Failsafe_action > actions) |
Protected Member Functions | |
virtual void | On_enable () |
Vehicle enable event handler. More... | |
virtual void | On_disable () |
Vehicle disable event handler. More... | |
void | Set_rc_loss_actions (std::initializer_list< proto::Failsafe_action > actions) |
void | Set_gps_loss_actions (std::initializer_list< proto::Failsafe_action > actions) |
void | Set_low_battery_actions (std::initializer_list< proto::Failsafe_action > actions) |
void | Set_rth_actions (std::initializer_list< proto::Rth_action > actions) |
void | Reset_altitude_origin () |
Tell server that current altitude origin must be dropped. More... | |
void | Set_altitude_origin (float altitude_amsl) |
Tell server that Vehicle knows its altitude_origin. More... | |
virtual void | Handle_ucs_command (Ucs_request::Ptr ucs_request) |
Message from ucs arrived. | |
void | Command_completed (Vehicle_request::Result result, const std::string &status_text, Ucs_request::Ptr ucs_request) |
void | Command_failed (Ucs_request::Ptr ucs_request, const std::string &status_text, proto::Status_code code=proto::STATUS_FAILED) |
void | Command_succeeded (Ucs_request::Ptr ucs_request) |
virtual void | Handle_vehicle_request (Vehicle_task_request::Handle request) |
Task has arrived from UCS and should be uploaded to the vehicle. | |
virtual void | Handle_vehicle_request (Vehicle_command_request::Handle request) |
UCS sending a command to the vehicle. | |
bool | Is_flight_mode (proto::Flight_mode) |
bool | Is_control_mode (proto::Control_mode m) |
void | Set_autopilot_type (const std::string &) |
void | Set_autopilot_serial (const std::string &) |
![]() | |
void | Report_progress (Ucs_request::Ptr request, float progress=-1.0, const std::string &description=std::string()) |
Sends Device_response with status code==STATUS_IN_PROGRESS with optional progress and description. More... | |
void | Send_ucs_message (Proto_msg_ptr msg) |
Vsm_command::Ptr | Get_command (int id) |
void | Add_status_message (const std::string &m) |
void | Commit_to_ucs (bool log_message=false) |
Protected Attributes | |
Optional< proto::Flight_mode > | current_flight_mode |
Property::Ptr | t_control_mode = nullptr |
Property::Ptr | t_is_armed = nullptr |
Property::Ptr | t_uplink_present = nullptr |
Property::Ptr | t_downlink_present = nullptr |
Property::Ptr | t_main_voltage = nullptr |
Property::Ptr | t_main_current = nullptr |
Property::Ptr | t_gcs_link_quality = nullptr |
Property::Ptr | t_rc_link_quality = nullptr |
Property::Ptr | t_latitude = nullptr |
Property::Ptr | t_longitude = nullptr |
Property::Ptr | t_altitude_raw = nullptr |
Property::Ptr | t_altitude_amsl = nullptr |
Property::Ptr | t_altitude_agl = nullptr |
Property::Ptr | t_ground_speed = nullptr |
Property::Ptr | t_air_speed = nullptr |
Property::Ptr | t_course = nullptr |
Property::Ptr | t_vertical_speed = nullptr |
Property::Ptr | t_pitch = nullptr |
Property::Ptr | t_roll = nullptr |
Property::Ptr | t_heading = nullptr |
Property::Ptr | t_gps_fix = nullptr |
Property::Ptr | t_satellite_count = nullptr |
Property::Ptr | t_altitude_origin = nullptr |
Property::Ptr | t_home_altitude_amsl = nullptr |
Property::Ptr | t_home_altitude_raw = nullptr |
Property::Ptr | t_home_latitude = nullptr |
Property::Ptr | t_home_longitude = nullptr |
Property::Ptr | t_target_altitude_amsl = nullptr |
Property::Ptr | t_target_altitude_raw = nullptr |
Property::Ptr | t_target_latitude = nullptr |
Property::Ptr | t_target_longitude = nullptr |
Property::Ptr | t_current_command = nullptr |
Property::Ptr | t_current_mission_id = nullptr |
Property::Ptr | t_flight_mode = nullptr |
Property::Ptr | t_autopilot_status = nullptr |
Property::Ptr | t_native_flight_mode = nullptr |
Property::Ptr | t_fence_enabled = nullptr |
Property::Ptr | t_vibration_x = nullptr |
Property::Ptr | t_vibration_y = nullptr |
Property::Ptr | t_vibration_z = nullptr |
Vsm_command::Ptr | c_mission_upload = nullptr |
Vsm_command::Ptr | c_auto = nullptr |
Vsm_command::Ptr | c_arm = nullptr |
Vsm_command::Ptr | c_disarm = nullptr |
Vsm_command::Ptr | c_waypoint = nullptr |
Vsm_command::Ptr | c_guided = nullptr |
Vsm_command::Ptr | c_manual = nullptr |
Vsm_command::Ptr | c_pause = nullptr |
Vsm_command::Ptr | c_resume = nullptr |
Vsm_command::Ptr | c_rth = nullptr |
Vsm_command::Ptr | c_land_command = nullptr |
Vsm_command::Ptr | c_joystick = nullptr |
Vsm_command::Ptr | c_direct_vehicle_control = nullptr |
Vsm_command::Ptr | c_takeoff_command = nullptr |
Vsm_command::Ptr | c_emergency_land = nullptr |
Vsm_command::Ptr | c_camera_trigger_command = nullptr |
Vsm_command::Ptr | c_adsb_set_ident = nullptr |
Vsm_command::Ptr | c_adsb_set_mode = nullptr |
Vsm_command::Ptr | c_direct_payload_control = nullptr |
Vsm_command::Ptr | c_camera_power = nullptr |
Vsm_command::Ptr | c_camera_video_source = nullptr |
Vsm_command::Ptr | c_adsb_set_parameter = nullptr |
Vsm_command::Ptr | c_set_servo = nullptr |
Vsm_command::Ptr | c_repeat_servo = nullptr |
Vsm_command::Ptr | c_set_fence = nullptr |
Vsm_command::Ptr | c_trigger_calibration = nullptr |
Vsm_command::Ptr | c_trigger_reboot = nullptr |
Vsm_command::Ptr | c_get_native_route = nullptr |
Vsm_command::Ptr | c_set_relative_heading = nullptr |
Vsm_command::Ptr | c_write_parameter = nullptr |
Vsm_command::Ptr | c_mission_clear = nullptr |
Vsm_command::Ptr | c_wait = nullptr |
Vsm_command::Ptr | c_move = nullptr |
Vsm_command::Ptr | c_set_speed = nullptr |
Vsm_command::Ptr | c_set_home = nullptr |
Vsm_command::Ptr | c_set_poi = nullptr |
Vsm_command::Ptr | c_set_heading = nullptr |
Vsm_command::Ptr | c_panorama = nullptr |
Vsm_command::Ptr | c_camera_trigger_mission = nullptr |
Vsm_command::Ptr | c_camera_by_time = nullptr |
Vsm_command::Ptr | c_camera_by_distance = nullptr |
Vsm_command::Ptr | c_land_mission = nullptr |
Vsm_command::Ptr | c_takeoff_mission = nullptr |
Vsm_command::Ptr | c_set_parameter = nullptr |
Vsm_command::Ptr | c_payload_control = nullptr |
Vsm_command::Ptr | c_transition_fixed = nullptr |
Vsm_command::Ptr | c_transition_vtol = nullptr |
Vsm_command::Ptr | c_wait_until = nullptr |
Property::Ptr | p_rc_loss_action = nullptr |
Property::Ptr | p_gps_loss_action = nullptr |
Property::Ptr | p_low_battery_action = nullptr |
Property::Ptr | p_rth_action = nullptr |
Property::Ptr | p_wp_turn_type = nullptr |
int | command_try_count = DEFAULT_COMMAND_TRY_COUNT |
std::chrono::milliseconds | command_timeout = DEFAULT_COMMAND_TIMEOUT |
Subsystem::Ptr | flight_controller |
Subsystem::Ptr | primary_camera |
Subsystem::Ptr | primary_gimbal |
Subsystem::Ptr | adsb_transponder |
Subsystem::Ptr | winch_controller |
![]() | |
const proto::Device_type | device_type |
Request_processor::Ptr | processor |
Request_completion_context::Ptr | completion_ctx |
std::chrono::time_point < std::chrono::system_clock > | begin_of_epoch |
std::vector< Subsystem::Ptr > | subsystems |
Friends | |
class | Ucs_vehicle_ctx |
class | Ucs_transaction |
class | Ucs_mission_clear_all_transaction |
class | Ucs_task_upload_transaction |
class | Ucs_vehicle_command_transaction |
class | Cucs_processor |
Base class for user-defined vehicles.
It contains interface to SDK services which can be used as base class methods calls, and abstract interface which must be implemented by the device. Instance creation should be done by Vehicle::Create() method.
ugcs::vsm::Vehicle::Vehicle | ( | proto::Device_type | type = proto::DEVICE_TYPE_VEHICLE , |
Request_processor::Ptr | processor = nullptr , |
||
Request_completion_context::Ptr | completion_ctx = nullptr |
||
) |
Constructor for a base class.
Create common telemetry fields and commands.
create_thread | If true, then separate thread is automatically created for vehicle instance which allows to using blocking methods in the context of this vehicle without blocking other vehicles, otherwise vehicle instance thread is not created and user is supposed to call Vehicle::Process_requests method to process requests pending for this vehicle. It is recommended to leave this value as default, i.e. "true". |
|
inlinevirtual |
Make sure class is polymorphic.
|
delete |
Disable copying.
|
inlinestatic |
Create an instance.
const std::string& ugcs::vsm::Vehicle::Get_port_name | ( | ) | const |
Get port name the vehicle is connected to.
const std::string& ugcs::vsm::Vehicle::Get_serial_number | ( | ) | const |
Get serial number of the vehicle.
|
inlineprotectedvirtual |
Vehicle disable event handler.
Can be overridden by derived class, if necessary.
Reimplemented from ugcs::vsm::Device.
|
inlineprotectedvirtual |
Vehicle enable event handler.
Can be overridden by derived class, if necessary.
Reimplemented from ugcs::vsm::Device.
void ugcs::vsm::Vehicle::Process_requests | ( | ) |
Process requests assigned to vehicle in user thread, i.e.
the thread which calls this method. Supposed to be called only when vehicle is created without its own thread.
|
protected |
Tell server that current altitude origin must be dropped.
(calibration needed to match reported altitude to real world)
Use this when VSM knows that currently reported Rel_altitude changed unexpectedly. For example if vehicle resets the reported altitude on ARM.
|
protected |
Tell server that Vehicle knows its altitude_origin.
Use this when VSM knows that reported Rel_altitude origin has changed. Ardupilot does that on home location change.