Skip to content

Commit 7ad9d84

Browse files
committed
smooth override
1 parent c6c2700 commit 7ad9d84

7 files changed

Lines changed: 38 additions & 15 deletions

File tree

Assets/Awsim/Scenes/AutowareSimulationDemo.unity

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83932,13 +83932,13 @@ MonoBehaviour:
8393283932
m_Name:
8393383933
m_EditorClassIdentifier:
8393483934
_devicePath: /dev/input/event3
83935-
_kp: 5
83935+
_kp: 4
8393683936
_ki: 0.2
8393783937
_kd: 0.05
8393883938
_minNormalizedSteeringTorque: 0.17
8393983939
_selfAligningTorqueSpeedCoeff: 5.2
8394083940
_selfAligningTorqueSteerCoeff: 1.8
83941-
_stationarySteeringResistance: 0.1
83941+
_stationarySteeringResistance: 0.011
8394283942
_readonlyVehicleComponent: {fileID: 8966377323996319312}
8394383943
_controlModeBasedInputProvider: {fileID: 5265622565273616511}
8394483944
--- !u!23 &1336751533137462666
@@ -97559,7 +97559,7 @@ MonoBehaviour:
9755997559
m_Name:
9756097560
m_EditorClassIdentifier:
9756197561
serviceName: input/control_mode_request
97562-
_controlModeBasedInputter: {fileID: 0}
97562+
_controlModeBasedInputter: {fileID: 5265622565273616511}
9756397563
--- !u!33 &1871169427814900695
9756497564
MeshFilter:
9756597565
m_ObjectHideFlags: 0
@@ -122567,7 +122567,19 @@ MonoBehaviour:
122567122567
m_ActionId: c62302a3-1cde-4005-9c97-e21e9e62ad2f
122568122568
m_ActionName: 'Vehicle/OverrideSteering[/LogitechG29DrivingForceRacingWheel/Base2]'
122569122569
- m_PersistentCalls:
122570-
m_Calls: []
122570+
m_Calls:
122571+
- m_Target: {fileID: 1336311105983438457}
122572+
m_TargetAssemblyTypeName: Awsim.Entity.AccelVehicleLogitechG29Input, Assembly-CSharp
122573+
m_MethodName: OnSwitchAutonomous
122574+
m_Mode: 0
122575+
m_Arguments:
122576+
m_ObjectArgument: {fileID: 0}
122577+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
122578+
m_IntArgument: 0
122579+
m_FloatArgument: 0
122580+
m_StringArgument:
122581+
m_BoolArgument: 0
122582+
m_CallState: 2
122571122583
m_ActionId: 7e213b94-be27-45c6-a1b8-b1c481019402
122572122584
m_ActionName: 'Vehicle/OnSwitchAutonomous[/LogitechG29DrivingForceRacingWheel/Base6]'
122573122585
m_NeverAutoSwitchControlSchemes: 0

Assets/Awsim/Scripts/Entity/Vehicle/AccelVehicle/Input/AccelVehicleControlModeBasedInputter.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ public void OnUpdate()
5353

5454
if (_hasManuallyInputs)
5555
{
56-
var manuallyInput = ManuallyInputs[_activeManuallyInputIndex];
57-
_isOverridden = manuallyInput.UpdateInputs();
58-
_isSwitchAutonomous = manuallyInput.UpdateInputs();
56+
for (int i = 0; i < ManuallyInputs.Length; i++)
57+
{
58+
59+
var tempOverriden = ManuallyInputs[i].UpdateInputs();
60+
if (i == _activeManuallyInputIndex)
61+
_isOverridden = tempOverriden;
62+
}
5963
}
6064
}
6165

Assets/Awsim/Scripts/Entity/Vehicle/AccelVehicle/Input/AccelVehicleKeyboardInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class AccelVehicleKeyboardInput : MonoBehaviour, IAccelVehicleInput
3636
public string Name => "Keyboard";
3737
public float AccelerationInput { get; private set; }
3838
public float SteerAngleInput { get; private set; }
39-
public Gear GearInput { get; private set; }
39+
public Gear GearInput { get; private set; } = Gear.Drive;
4040
public TurnIndicators TurnIndicatorsInput { get; private set; }
4141
public HazardLights HazardLightsInput { get; private set; }
4242
public bool SwitchAutonomous { get; private set; }

Assets/Awsim/Scripts/Entity/Vehicle/AccelVehicle/Input/AccelVehicleLogitechG29Input.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Settings(string devicePath, float selfAligningTorqueCoeff)
4646
public string Name => "Logitech G29";
4747
public float AccelerationInput { get; private set; } = 0;
4848
public float SteerAngleInput { get; private set; } = 0;
49-
public Gear GearInput { get; private set; } = Gear.Parking;
49+
public Gear GearInput { get; private set; } = Gear.Drive;
5050
public TurnIndicators TurnIndicatorsInput { get; private set; } = TurnIndicators.None;
5151
public HazardLights HazardLightsInput { get; private set; } = HazardLights.Disable;
5252
public bool SwitchAutonomous { get; private set; } = false;

docs/DeveloperGuide/Layer/Entity/Vehicle/AccelVehicle/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ By default, each key is assigned to the following classes.
4141
|R|Switch to move reverse gear.|
4242
|N|Switch to neutral gear.|
4343
|P|Switch to parking gear.|
44-
|C|Switch control mode to AUTONOMOUS.|
4544
|Up arrow|Forward acceleration.|
4645
|Down arrow|Reverse acceleration.|
4746
|Left arrow|Left turning.|
@@ -50,6 +49,7 @@ By default, each key is assigned to the following classes.
5049
|2|Turn right blinker on.|
5150
|3|Turn on hazard lights.|
5251
|4|Turn off blinker or hazard lights.|
52+
|C|Switch control mode `MANUAL` to `AUTONOMOUS`|
5353

5454
- AccelVehicleLogitechG29Input
5555

@@ -59,15 +59,15 @@ By default, each key is assigned to the following classes.
5959
|Square|Switch to move reverse gear.|
6060
|Circle|Switch to neutral gear.|
6161
|Cross|Switch to parking gear.|
62-
|L2|Swtich control mode to MANUAL.|
63-
|L3|Switch control mode to AUTONOMOUS.|
6462
|Throttle pedal|Forward acceleration.|
6563
|Brake pedal|Reverse acceleration.|
6664
|Steering wheel|Turning.|
6765
|Left paddle|Turn left blinker on.|
6866
|Right paddle|Turn right blinker on.|
6967
|R2|Turn on hazard lights.|
7068
|R3|Turn off blinker or hazard lights.|
69+
|L2|Switch control mode `AUTONOMOUS` to `MANUAL`|
70+
|L3|Switch control mode `MANUAL` to `AUTONOMOUS`|
7171

7272
## Create custom vehicle
7373

docs/GettingStarted/Advanced/LogitechG29/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ The `AWSIM-demo.x86-64` simulation (included in [AWSIM-demo.zip](../../../Downlo
7272
|Right paddle|Turn right blinker on.|
7373
|R2|Turn on hazard lights.|
7474
|R3|Turn off blinker or hazard lights.|
75-
|L2|Switch control mode `MANUAL` to `AUTONOMOUS`|
75+
|L2|Switch control mode `AUTONOMOUS` to `MANUAL`|
76+
|L3|Switch control mode `MANUAL` to `AUTONOMOUS`|

docs/GettingStarted/DemoDetails/index.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ This vehicle dynamics model was created for Autoware simulation, and assuming th
4444

4545
- Keyboard
4646

47+
!!! info
48+
Keyboard input for throttle and steering instantly switches the control mode from `AUTONOMOUS` to `MANUAL`.
49+
4750
|Key|Feature|
4851
|:--|:--|
4952
|D|Switch to move drive gear.|
@@ -58,6 +61,7 @@ This vehicle dynamics model was created for Autoware simulation, and assuming th
5861
|2|Turn right blinker on.|
5962
|3|Turn on hazard lights.|
6063
|4|Turn off blinker or hazard lights.|
64+
|C|Switch control mode `MANUAL` to `AUTONOMOUS`|
6165

6266
- Logitech G29 steering wheel
6367

@@ -74,6 +78,8 @@ This vehicle dynamics model was created for Autoware simulation, and assuming th
7478
|Right paddle|Turn right blinker on.|
7579
|R2|Turn on hazard lights.|
7680
|R3|Turn off blinker or hazard lights.|
81+
|L2|Switch control mode `AUTONOMOUS` to `MANUAL`|
82+
|L3|Switch control mode `MANUAL` to `AUTONOMOUS`|
7783

7884
### Control mode
7985

@@ -116,7 +122,7 @@ Demo simulation has a total of four sensors.
116122
<popup-img src="image_5.png" width="500" alt="image_5"></popup-img>
117123

118124
Lidar sensor is the component that simulates the *LiDAR* (*Light Detection and Ranging*) sensor.
119-
*LiDAR* works by emitting laser beams that bounce off objects in the environment, and then measuring the time it takes for the reflected beams to return, allowing the sensor to create a *3D* map of the surroundings.
125+
*LiDAR* works by emitting laser beams that bounc e off objects in the environment, and then measuring the time it takes for the reflected beams to return, allowing the sensor to create a *3D* map of the surroundings.
120126
This data is used for object detection, localization, and mapping.
121127

122128
Publish ROS2 topics.
@@ -330,7 +336,7 @@ For performance, the pointcloud topic output from the LiDAR sensor is published
330336
| Topic | Message type | `frame_id` | `Hz` | `QoS` |
331337
|--:------------------------------------------|--:---------------------------------------------------------------------------------------------------------------------------------------------------------------|--:--------------------------------------|--:-:--|--:------------------------------------------------------------------|
332338
| `/clock` | [`rosgraph_msgs/Clock`](https://docs.ros.org/en/api/rosgraph_msgs/html/msg/Clock.html) | - | `100` | <ul><li>`Best effort`</li><li>`Volatile`</li><li>`Keep last/1`</li> |
333-
| `/sensing/camera/traffic_light/camera_info` | [`sensor_msgs/CameraInfo`](https://docs.ros.org/en/api/sensor_msgs/html/msg/CameraInfo.html) | `traffic_light_left_camera/camera_link` | `10` | <ul><li>`Best effort`</li><li>`Volatile`</li><li>`Keep last/1`</li> |
339+
| `/sensing/camera/traffic_light/camera_info` | [`sensor_msgs/C ameraInfo`](https://docs.ros.org/en/api/sensor_msgs/html/msg/CameraInfo.html) | `traffic_light_left_camera/camera_link` | `10` | <ul><li>`Best effort`</li><li>`Volatile`</li><li>`Keep last/1`</li> |
334340
| `/sensing/camera/traffic_light/image_raw` | [`sensor_msgs/Image`](https://docs.ros.org/en/api/sensor_msgs/html/msg/Image.html) | `traffic_light_left_camera/camera_link` | `10` | <ul><li>`Best effort`</li><li>`Volatile`</li><li>`Keep last/1`</li> |
335341
| `/sensing/gnss/pose` | [`geometry_msgs/Pose`](https://docs.ros.org/en/api/geometry_msgs/html/msg/Pose.html) | `gnss_link` | `1` | <ul><li>`Reliable`</li><li>`Volatile`</li><li>`Keep last/1`</li> |
336342
| `/sensing/gnss/pose_with_covariance` | [`geometry_msgs/PoseWithCovarianceStamped`](https://docs.ros.org/en/api/geometry_msgs/html/msg/PoseWithCovarianceStamped.html) | `gnss_link` | `1` | <ul><li>`Reliable`</li><li>`Volatile`</li><li>`Keep last/1`</li> |

0 commit comments

Comments
 (0)