File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,39 +72,9 @@ MAV_STATE GCS_MAVLINK_Rover::vehicle_system_status() const
7272 return MAV_STATE_ACTIVE ;
7373}
7474
75- void GCS_MAVLINK_Rover::send_position_target_global_int ()
75+ bool GCS_MAVLINK_Rover::get_target_location (Location &target) const
7676{
77- Location target;
78- if (!rover.control_mode ->get_desired_location (target)) {
79- return ;
80- }
81-
82- // get altitude as AMSL (this may use the terrain database)
83- float alt_amsl_m;
84- if (!target.get_alt_m (Location::AltFrame::ABSOLUTE , alt_amsl_m)) {
85- return ;
86- }
87-
88- static constexpr uint16_t POSITION_TARGET_TYPEMASK_LAST_BYTE = 0xF000 ;
89- static constexpr uint16_t TYPE_MASK = POSITION_TARGET_TYPEMASK_VX_IGNORE | POSITION_TARGET_TYPEMASK_VY_IGNORE | POSITION_TARGET_TYPEMASK_VZ_IGNORE |
90- POSITION_TARGET_TYPEMASK_AX_IGNORE | POSITION_TARGET_TYPEMASK_AY_IGNORE | POSITION_TARGET_TYPEMASK_AZ_IGNORE |
91- POSITION_TARGET_TYPEMASK_YAW_IGNORE | POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE | POSITION_TARGET_TYPEMASK_LAST_BYTE ;
92- mavlink_msg_position_target_global_int_send (
93- chan,
94- AP_HAL::millis (), // time_boot_ms
95- MAV_FRAME_GLOBAL , // targets are always global altitude
96- TYPE_MASK , // ignore everything except the x/y/z components
97- target.lat , // latitude as 1e7
98- target.lng , // longitude as 1e7
99- alt_amsl_m, // altitude AMSL in metres
100- 0 .0f , // vx
101- 0 .0f , // vy
102- 0 .0f , // vz
103- 0 .0f , // afx
104- 0 .0f , // afy
105- 0 .0f , // afz
106- 0 .0f , // yaw
107- 0 .0f ); // yaw_rate
77+ return rover.control_mode ->get_desired_location (target);
10878}
10979
11080void GCS_MAVLINK_Rover::send_nav_controller_output () const
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class GCS_MAVLINK_Rover : public GCS_MAVLINK
2222 MAV_RESULT handle_command_int_do_reposition (const mavlink_command_int_t &packet);
2323 MAV_RESULT handle_command_nav_set_yaw_speed (const mavlink_command_int_t &packet, const mavlink_message_t &msg);
2424
25- void send_position_target_global_int () override ;
25+ bool get_target_location (Location &loc) const override ;
2626
2727 uint64_t capabilities () const override ;
2828
Original file line number Diff line number Diff line change @@ -6206,7 +6206,7 @@ void GCS_MAVLINK::send_position_target_global_int()
62066206 if (!get_target_location (target)) {
62076207 return ;
62086208 }
6209- if (!target_location .initialised ()) {
6209+ if (!target .initialised ()) {
62106210 return ;
62116211 }
62126212 float alt_amsl_m;
You can’t perform that action at this time.
0 commit comments