Skip to content

Commit

Permalink
Remove steer angle conversion.
Browse files Browse the repository at this point in the history
This is basically the same as lgsvl/simulator#1372, except that the target wheel angle is left unmodified (assumed to be in range `[-1, 1]`) instead of treating it as radians.
While this is in conflict with the comment on the `lgsvl_msgs` repo, it seems to match the implementation of the `lgsvl_interface` in `AutowareAuto`.
  • Loading branch information
dvd-gaiaplatform committed Jan 12, 2022
1 parent f65f8a0 commit 597dde2
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions Ros2Conversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,34 +523,12 @@ public static Detected3DObjectArray ConvertTo(Detection3DArray data)

public static Data.VehicleControlData ConvertTo(Data.Lgsvl.VehicleControlData data)
{
float Deg2Rad = UnityEngine.Mathf.Deg2Rad;
float MaxSteeringAngle = 39.4f * Deg2Rad;
float wheelAngle = 0f;

if (data.target_wheel_angle > MaxSteeringAngle)
{
wheelAngle = MaxSteeringAngle;
}
else if (data.target_wheel_angle < -MaxSteeringAngle)
{
wheelAngle = -MaxSteeringAngle;
}
else
{
wheelAngle = data.target_wheel_angle;
}

// ratio between -MaxSteeringAngle and MaxSteeringAngle
var k = (float)(wheelAngle + MaxSteeringAngle) / (MaxSteeringAngle*2);

// target_gear are not supported on simulator side

return new Data.VehicleControlData()
{
TimeStampSec = Convert(data.header.stamp),
Acceleration = data.acceleration_pct,
Braking = data.braking_pct,
SteerAngle = UnityEngine.Mathf.Lerp(-1f, 1f, k),
SteerAngle = data.target_wheel_angle,
SteerInput = data.target_wheel_angular_rate,
TargetGear = (GearPosition)(int)data.target_gear,
};
Expand Down

0 comments on commit 597dde2

Please sign in to comment.