Apollo 11.0
自动驾驶开放平台
message_process.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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
18
19namespace apollo {
20namespace audio {
21
23
25 const AudioData& audio_data,
26 const std::string& respeaker_extrinsics_file,
27 AudioInfo* audio_info,
28 DirectionDetection* direction_detection,
29 MovingDetection* moving_detection,
30 SirenDetection* siren_detection,
31 AudioDetection* audio_detection) {
32 audio_info->Insert(audio_data);
33 auto direction_result =
34 direction_detection->EstimateSoundSource(
35 audio_info->GetSignals(audio_data.microphone_config().chunk()),
36 respeaker_extrinsics_file,
37 audio_data.microphone_config().sample_rate(),
38 audio_data.microphone_config().mic_distance());
39 *(audio_detection->mutable_position()) = direction_result.first;
40 audio_detection->set_source_degree(direction_result.second);
41
42 bool is_siren = siren_detection->Evaluate(audio_info->GetSignals(72000));
43 audio_detection->set_is_siren(is_siren);
44 auto signals =
45 audio_info->GetSignals(audio_data.microphone_config().chunk());
46 MovingResult moving_result = moving_detection->Detect(signals);
47 audio_detection->set_moving_result(moving_result);
48}
49
50} // namespace audio
51} // namespace apollo
std::vector< std::vector< double > > GetSignals(const int signal_length)
Definition audio_info.cc:60
void Insert(const apollo::drivers::microphone::config::AudioData &)
Definition audio_info.cc:31
std::pair< Point3D, double > EstimateSoundSource(std::vector< std::vector< double > > &&channels_vec, const std::string &respeaker_extrinsic_file, const int sample_rate, const double mic_distance)
static void OnMicrophone(const apollo::drivers::microphone::config::AudioData &audio_data, const std::string &respeaker_extrinsics_file, AudioInfo *audio_info, DirectionDetection *direction_detection, MovingDetection *moving_detection, SirenDetection *siren_detection, AudioDetection *audio_detection)
MovingResult Detect(const std::vector< std::vector< double > > &signals)
bool Evaluate(const std::vector< std::vector< double > > &signals)
class register implement
Definition arena_queue.h:37
optional MicrophoneConfig microphone_config
Definition audio.proto:15