CARLA
 
载入中...
搜索中...
未找到
DVSCamera.h
浏览该文件的文档.
1// Copyright (c) 2020 Robotics and Perception Group (GPR)
2// University of Zurich and ETH Zurich
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
12
13#include "DVSCamera.generated.h"
14
15namespace dvs
16{
17 /// DVS Configuration structure
18 struct Config
19 {
20 float Cp;
21 float Cm;
22 float sigma_Cp;
23 float sigma_Cm;
24 std::uint64_t refractory_period_ns;
25 bool use_log;
26 float log_eps;
27 };
28
29 inline constexpr std::int64_t secToNanosec(double seconds)
30 {
31 return static_cast<std::int64_t>(seconds * 1e9);
32 }
33
34 inline constexpr double nanosecToSecTrunc(std::int64_t nanoseconds)
35 {
36 return static_cast<double>(nanoseconds) / 1e9;
37 }
38
39} // namespace dvs
40
41/// Sensor that produce Dynamic Vision Events
42UCLASS()
43class CARLA_API ADVSCamera : public AShaderBasedSensor
44{
45 GENERATED_BODY()
46 using DVSEventArray = std::vector<::carla::sensor::data::DVSEvent>;
47
48public:
49 ADVSCamera(const FObjectInitializer &ObjectInitializer);
50 static FActorDefinition GetSensorDefinition();
51 void Set(const FActorDescription &ActorDescription) override;
52
53protected:
54 virtual void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime) override;
55 void ImageToGray(const TArray<FColor> &image);
56 void ImageToLogGray(const TArray<FColor> &image);
57 ADVSCamera::DVSEventArray Simulation (float DeltaTime);
58
59private:
60 /// Images containing last (current) and previous image
61 TArray<float> last_image, prev_image;
62
63 /// Image containing the last reference value to trigger event
64 TArray<float> ref_values;
65
66 /// Image containing time of last event in seconds
67 TArray<double> last_event_timestamp;
68
69 /// Current time in nanoseconds
70 std::int64_t current_time;
71
72 /// DVS simulation configuration
73 dvs::Config config;
74};
Sensor that produce Dynamic Vision Events
Definition DVSCamera.h:44
std::vector<::carla::sensor::data::DVSEvent > DVSEventArray
Definition DVSCamera.h:46
A sensor that produces data by applying post-process materials (shaders) to a scene capture image.
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
constexpr std::int64_t secToNanosec(double seconds)
Definition DVSCamera.h:29
constexpr double nanosecToSecTrunc(std::int64_t nanoseconds)
Definition DVSCamera.h:34
A definition of a Carla Actor with all the variation and attributes.
A description of a Carla Actor with all its variation.
DVS Configuration structure
Definition DVSCamera.h:19
float sigma_Cp
Definition DVSCamera.h:22
std::uint64_t refractory_period_ns
Definition DVSCamera.h:24
bool use_log
Definition DVSCamera.h:25
float log_eps
Definition DVSCamera.h:26
float sigma_Cm
Definition DVSCamera.h:23