CARLA
pytorch.h
Go to the documentation of this file.
1 // Copyright (c) 2022 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB).
2 // This work is licensed under the terms of the MIT license.
3 // For a copy, see <https://opensource.org/licenses/MIT>.
4 
5 #pragma once
6 #define _GLIBCXX_USE_CXX11_ABI 0
7 
8 #include <memory>
9 #include <vector>
10 
11 namespace carla {
12 namespace learning {
13 
14  void test_learning();
15 
16  struct NeuralModelImpl;
17 
18  struct WheelInput {
19  public:
20  int num_particles = 0;
27  };
28 
29  struct Inputs {
30  public:
35  float steering = 0;
36  float throttle = 0;
37  float braking = 0;
38  int terrain_type = 0;
39  bool verbose = false;
40  };
41 
42  struct WheelOutput {
43  public:
44  float wheel_forces_x = 0;
45  float wheel_forces_y = 0;
46  float wheel_forces_z = 0;
47  float wheel_torque_x = 0;
48  float wheel_torque_y = 0;
49  float wheel_torque_z = 0;
50  std::vector<float> _particle_forces;
51  };
52  struct Outputs {
53  public:
58  };
59 
60  // Interface with the torch implementation
61  class NeuralModel {
62  public:
63 
64  NeuralModel();
65  void LoadModel(char* filename, int device);
66 
67  void SetInputs(Inputs input);
68  void Forward();
69  void ForwardDynamic();
70  void ForwardCUDATensors();
71  Outputs& GetOutputs();
72 
73  ~NeuralModel();
74 
75  private:
76  std::unique_ptr<NeuralModelImpl> Model;
79  };
80 
81 }
82 }
std::unique_ptr< NeuralModelImpl > Model
Definition: pytorch.h:76
std::vector< float > _particle_forces
Definition: pytorch.h:50
WheelInput wheel3
Definition: pytorch.h:34
void test_learning()
Definition: pytorch.cpp:27
WheelInput wheel2
Definition: pytorch.h:33
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
WheelOutput wheel2
Definition: pytorch.h:56
WheelInput wheel1
Definition: pytorch.h:32
WheelInput wheel0
Definition: pytorch.h:31
WheelOutput wheel0
Definition: pytorch.h:54
float * wheel_angular_velocity
Definition: pytorch.h:26
WheelOutput wheel3
Definition: pytorch.h:57
WheelOutput wheel1
Definition: pytorch.h:55