base_hfl110dcu.cpp
Go to the documentation of this file.
1 // Copyright 2020 Continental AG
2 // All rights reserved.
3 //
4 // Software License Agreement (BSD 2-Clause Simplified License)
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 // POSSIBILITY OF SUCH DAMAGE.
29 
30 
36 #include <base_hfl110dcu.h>
37 
38 #include <string>
39 
40 namespace hfl
41 {
42 bool BaseHFL110DCU::getConfiguration(std::string model, std::string version)
43 {
44  std::string full_model = model + version;
45  // Return false if camera registers not found
46  if (REGS_OFFSET_ADDRS.find(model) == REGS_OFFSET_ADDRS.end())
47  {
48  std::cout << "[ERROR]" << model << " not available" << std::endl;
49  return false;
50  }
51  // Return false if model not found
52  if (CAMERA_MODELS.find(full_model) == CAMERA_MODELS.end())
53  {
54  std::cout << "[ERROR]"
55  << " configuration registers for " << version << " not available" << std::endl;
56  return false;
57  }
58  // Return false if mode register not found
59  if (MODE_REGISTERS.find(full_model) == MODE_REGISTERS.end())
60  {
61  std::cout << "[ERROR]" << full_model << " mode register not available" << std::endl;
62  return false;
63  }
64  // Set current model and version
65  model_ = model;
66  version_ = version;
67  // Set frame configurations
69  frame_->intensity_bits_ = INTENSITY_BITS;
70  frame_->range_bits_ = RANGE_BITS;
71  frame_->id_ = FRAME_ID;
72  // frame_ changed to frame_ as referenced in the hfl_interface.h class
73  return true;
74 }
75 
77 {
78  try {
79  global_offset_ = offset * 256;
80  return true;
81  } catch (const std::exception& e) {
82  return false;
83  }
84 }
85 } // namespace hfl
const uint8_t RANGE_BITS
Default bits used for range.
bool getConfiguration(std::string model, std::string version)
std::shared_ptr< hfl::Frame > frame_
Camera&#39;s frame configurations.
const uint16_t PIXEL_SLICES
Default frame cols.
const uint16_t FRAME_COLUMNS
Default frame cols.
const Configs_map REGS_OFFSET_ADDRS
HFL cameras register addresses.
Definition: hfl_configs.h:66
const Registers_map MODE_REGISTERS
HFL cameras mode registers.
Definition: hfl_configs.h:86
double global_offset_
global range offset
std::string version_
Current camera model.
const uint16_t PIXEL_RETURNS
Default frame cols.
const Setups_map CAMERA_MODELS
HFL cameras memory maps and parameters.
Definition: hfl_configs.h:71
const uint16_t FRAME_ROWS
Default frame rows.
bool setGlobalRangeOffset(double offset)
const uint8_t INTENSITY_BITS
Default bits used for intensity.
const char FRAME_ID[]
Default frame ID.
This file defines the HFL110DCU camera base class.
Handles camera&#39;s frame data.
Definition: hfl_frame.h:55
std::string model_
Current camera model.
Definition: hfl_interface.h:99


hfl_driver
Author(s): Evan Flynn , Maxton Ginier , Gerardo Bravo , Moises Diaz
autogenerated on Sat Mar 20 2021 02:27:31