CARLA
LibCarla/source/carla/rpc/AckermannControllerSettings.h
Go to the documentation of this file.
1 // Copyright (c) 2021 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "carla/MsgPack.h"
10 
11 #ifdef LIBCARLA_INCLUDED_FROM_UE4
13 #endif // LIBCARLA_INCLUDED_FROM_UE4
14 
15 namespace carla {
16 namespace rpc {
17 
19  public:
20 
21  AckermannControllerSettings() = default;
22 
24  float speed_kp,
25  float speed_ki,
26  float speed_kd,
27  float accel_kp,
28  float accel_ki,
29  float accel_kd)
30  : speed_kp(speed_kp),
31  speed_ki(speed_ki),
32  speed_kd(speed_kd),
33  accel_kp(accel_kp),
34  accel_ki(accel_ki),
35  accel_kd(accel_kd) {}
36 
37  float speed_kp = 0.0f;
38  float speed_ki = 0.0f;
39  float speed_kd = 0.0f;
40  float accel_kp = 0.0f;
41  float accel_ki = 0.0f;
42  float accel_kd = 0.0f;
43 
44 #ifdef LIBCARLA_INCLUDED_FROM_UE4
45 
47  : speed_kp(Settings.SpeedKp),
48  speed_ki(Settings.SpeedKi),
49  speed_kd(Settings.SpeedKd),
50  accel_kp(Settings.AccelKp),
51  accel_ki(Settings.AccelKi),
52  accel_kd(Settings.AccelKd) {}
53 
54  operator FAckermannControllerSettings() const {
56  Settings.SpeedKp = speed_kp;
57  Settings.SpeedKi = speed_ki;
58  Settings.SpeedKd = speed_kd;
59  Settings.AccelKp = accel_kp;
60  Settings.AccelKi = accel_ki;
61  Settings.AccelKd = accel_kd;
62  return Settings;
63  }
64 
65 #endif // LIBCARLA_INCLUDED_FROM_UE4
66 
67  bool operator!=(const AckermannControllerSettings &rhs) const {
68  return
69  speed_kp != rhs.speed_kp ||
70  speed_ki != rhs.speed_ki ||
71  speed_kd != rhs.speed_kd ||
72  accel_kp != rhs.accel_kp ||
73  accel_ki != rhs.accel_ki ||
74  accel_kd != rhs.accel_kd;
75  }
76 
77  bool operator==(const AckermannControllerSettings &rhs) const {
78  return !(*this != rhs);
79  }
80 
82  speed_kp,
83  speed_ki,
84  speed_kd,
85  accel_kp,
86  accel_ki,
87  accel_kd
88  );
89  };
90 
91 } // namespace rpc
92 } // namespace carla
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
MSGPACK_DEFINE_ARRAY(speed_kp, speed_ki, speed_kd, accel_kp, accel_ki, accel_kd)
bool operator==(const AckermannControllerSettings &rhs) const
bool operator!=(const AckermannControllerSettings &rhs) const
AckermannControllerSettings(float speed_kp, float speed_ki, float speed_kd, float accel_kp, float accel_ki, float accel_kd)