Hello Everyone,
I am trying to send yaw (hdg from global_position_int) to set_position_target_local_ned.
The yaw angle i get from global position int message is in the range 0-360. Shall I need to convert to in -pi to pi range so as to send this message?
I am trying to align my drone’s heading angle to my staionary vehicle’s heading angle. However, it is not realigning.
pub async fn set_traj_target_local_ned(
&mut self,
pos: Vector3<f64>,
vel: Vector3<f64>,
yaw: f64,
) -> Result<()> {
// accepts position / yaw in Tular Frame
println!("THE TARGETTED VELOCITY IS -----------------------------------------{:?}",vel);
let type_mask = PositionTargetTypemask::POSITION_TARGET_TYPEMASK_AX_IGNORE
| PositionTargetTypemask::POSITION_TARGET_TYPEMASK_AY_IGNORE
| PositionTargetTypemask::POSITION_TARGET_TYPEMASK_AZ_IGNORE
| PositionTargetTypemask::POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE;
let msg = MavMessage::common(MavCommon::SET_POSITION_TARGET_LOCAL_NED(
common::SET_POSITION_TARGET_LOCAL_NED_DATA {
time_boot_ms: 0,
x: pos.x as f32, //
y: pos.y as f32, //
z: pos.z as f32, //
vx: vel.x as f32,
vy: vel.y as f32,
vz: vel.z as f32,
afx: 0.0,
afy: 0.0,
afz: 0.0,
yaw: yaw as f32,
yaw_rate: 0.0,
type_mask,
target_system: 1,
target_component: 1,
coordinate_frame: common::MavFrame::MAV_FRAME_LOCAL_NED,
},
));
self.send_mavlink(msg).await?;
Ok(())
}
call = self.set_traj_target_local_ned(gps_target_pos,target_vel,tular_yaw).await?; `