Apollo  6.0
Open source self driving car software
util.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 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 
17 #pragma once
18 
19 #include <cmath>
20 #include <fstream>
21 #include <string>
22 
23 namespace apollo {
24 namespace drivers {
25 namespace velodyne {
26 
27 template <typename T>
28 void dump_msg(const T& msg, const std::string& file_path) {
29  // std::ofstream ofs(file_path.c_str(),
30  // std::ofstream::out | std::ofstream::binary);
31  // uint32_t serial_size = ros::serialization::serializationLength(msg);
32  // boost::shared_array<uint8_t> obuffer(new uint8_t[serial_size]);
33  // ros::serialization::OStream ostream(obuffer.get(), serial_size);
34  // ros::serialization::serialize(ostream, msg);
35  // ofs.write((char*)obuffer.get(), serial_size);
36  // ofs.close();
37 }
38 
39 template <class T>
40 void load_msg(const std::string& file_path, T* msg) {
41  // std::ifstream ifs(file_path.c_str(),
42  // std::ifstream::in | std::ifstream::binary);
43  // ifs.seekg(0, std::ios::end);
44  // std::streampos end = ifs.tellg();
45  // ifs.seekg(0, std::ios::beg);
46  // std::streampos begin = ifs.tellg();
47  //
48  // uint32_t file_size = end - begin;
49  // boost::shared_array<uint8_t> ibuffer(new uint8_t[file_size]);
50  // ifs.read((char*)ibuffer.get(), file_size);
51  // ros::serialization::IStream istream(ibuffer.get(), file_size);
52  // ros::serialization::deserialize(istream, *msg);
53  // ifs.close();
54 }
55 
56 void init_sin_cos_rot_table(float* sin_rot_table, float* cos_rot_table,
57  uint16_t rotation, float rotation_resolution);
58 
59 } // namespace velodyne
60 } // namespace drivers
61 } // namespace apollo
void init_sin_cos_rot_table(float *sin_rot_table, float *cos_rot_table, uint16_t rotation, float rotation_resolution)
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void load_msg(const std::string &file_path, T *msg)
Definition: util.h:40
void dump_msg(const T &msg, const std::string &file_path)
Definition: util.h:28