Apollo  6.0
Open source self driving car software
object_sequence.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <map>
19 #include <memory>
20 #include <mutex>
21 #include <vector>
22 
23 #include "gtest/gtest_prod.h"
24 
27 
28 namespace apollo {
29 namespace perception {
30 namespace lidar {
31 
33  public:
34  typedef int TrackIdKey;
35  typedef double TimeStampKey;
36  typedef std::map<TimeStampKey,
37  std::shared_ptr<apollo::perception::base::Object>>
39 
40  public:
41  ObjectSequence() = default;
42  ~ObjectSequence() = default;
43 
45  const std::vector<std::shared_ptr<perception::base::Object>>& objects,
46  TimeStampKey timestamp);
47 
48  bool GetTrackInTemporalWindow(TrackIdKey track_id, TrackedObjects* track,
49  TimeStampKey window_time);
50 
51  protected:
52  FRIEND_TEST(FusedClassifierTest, test_one_sequence_fusion);
53  FRIEND_TEST(FusedClassifierTest, test_one_sequence_fusion_bad_timestamp);
54  void RemoveStaleTracks(TimeStampKey current_stamp);
55 
56  TimeStampKey current_;
57  std::map<TrackIdKey, TrackedObjects> sequence_;
58  std::mutex mutex_;
59  static constexpr TimeStampKey kMaxTimeOut = 5.0; // 5 second
60 };
61 
62 } // namespace lidar
63 } // namespace perception
64 } // namespace apollo
Definition: object_sequence.h:32
TimeStampKey current_
Definition: object_sequence.h:56
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::mutex mutex_
Definition: object_sequence.h:58
int TrackIdKey
Definition: object_sequence.h:34
bool AddTrackedFrameObjects(const std::vector< std::shared_ptr< perception::base::Object >> &objects, TimeStampKey timestamp)
std::map< TrackIdKey, TrackedObjects > sequence_
Definition: object_sequence.h:57
static constexpr TimeStampKey kMaxTimeOut
Definition: object_sequence.h:59
std::map< TimeStampKey, std::shared_ptr< apollo::perception::base::Object > > TrackedObjects
Definition: object_sequence.h:38
bool GetTrackInTemporalWindow(TrackIdKey track_id, TrackedObjects *track, TimeStampKey window_time)
FRIEND_TEST(FusedClassifierTest, test_one_sequence_fusion)
double TimeStampKey
Definition: object_sequence.h:35
void RemoveStaleTracks(TimeStampKey current_stamp)