ArduPilot / ArduPilot/MissionPlanner
SET_POSITION_TARGET_LOCAL_NED (84)
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 2.9k
- Avg merge
- 19h 16m
- Merged PRs (30d)
- 4
Description
Now,Already receive setMode method and control uav move. However, the steering function is not currently available.
```
public void droneControl(String sn, float x, float y, float h, float w) throws Exception {
isConnection(sn);
setOldUavMode(sn, 1); // change offboard mode
float currentYawRad = 0.0f;
if (w != 0) {
UavDataCacheManager cacheManager = UavDataCacheManager.getInstance();
Map uavDataBySn = cacheManager.getUavDataBySn(sn);
if (ObjectUtil.isNotEmpty(uavDataBySn) && ObjectUtil.isNotEmpty(uavDataBySn.get("yaw"))) {
currentYawRad = (float) uavDataBySn.get("yaw");
}
float deltaYaw = (float) Math.toRadians(-w); // Convert degrees to radians
currentYawRad += deltaYaw;
currentYawRad = (float) ((currentYawRad + Math.PI) % (2 * Math.PI) - Math.PI);
}
MavlinkUav uav = getMavlinkUav(sn);
SetPositionTargetLocalNed message = SetPositionTargetLocalNed.builder()
.targetSystem(uav.getTargetSystem())
.targetComponent(uav.getTargetComponent())
.coordinateFrame(MavFrame.MAV_FRAME_BODY_FRD)
.typeMask(PositionTargetTypemask.POSITION_TARGET_TYPEMASK_VX_IGNORE,
PositionTargetTypemask.POSITION_TARGET_TYPEMASK_VY_IGNORE,
PositionTargetTypemask.POSITION_TARGET_TYPEMASK_VZ_IGNORE,
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)
.x(x)
.y(y)
.z(-h)
.vx(0.0f)
.vy(0.0f)
.vz(0.0f)
.afx(0.0f)
.afy(0.0f)
.afz(0.0f)
.yaw(currentYawRad)
.yawRate(0.0f)
.build();
MavlinkConnection connection = uav.getMavlinkConnection();
logger.info("The command sent by the command flight is", message);
connection.send2(
uav.getTargetSystem(),
uav.getTargetComponent(),
message);
}
```
This method can be used to control the movement of the drone, including up, down, left, and right.But it cannot be redirected. The redirection log is as follows
`2025-06-13 16:44:16.373 - [MQTT Call: re62834ba80076e952617679e966aa23b3][] INFO com.yuefei.uav.mavlink.service.MavlinkService -SetPositionTargetLocalNed{timeBootMs=0, targetSystem=6, targetComponent=1, coordinateFrame=EnumValue{value=12, entry=MAV_FRAME_BODY_FRD}, typeMask=EnumValue{value=2552, entry=null}, x=0.0, y=0.0, z=-0.0, vx=0.0, vy=0.0, vz=0.0, afx=0.0, afy=0.0, afz=0.0, yaw=-0.24230176, yawRate=0.0}`
Is there something wrong with the method?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied droneControl method and its SetPositionTargetLocalNed construction, then compare the logged typeMask, coordinateFrame, and yaw with the MAVLink handling for SET_POSITION_TARGET_LOCAL_NED. Reproduce the redirection case and verify that a yaw change is accepted by the target vehicle; done means the vehicle redirects while translation behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- robotics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100