calibration_data_helpers.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Michael Ferguson
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 // Author: Michael Ferguson
18 
19 #ifndef ROBOT_CALIBRATION_CERES_CALIBRATION_DATA_HELPERS_H
20 #define ROBOT_CALIBRATION_CERES_CALIBRATION_DATA_HELPERS_H
21 
22 #include <robot_calibration_msgs/CalibrationData.h>
23 
24 namespace robot_calibration
25 {
26 
31  const robot_calibration_msgs::CalibrationData& msg,
32  const std::string& sensor)
33 {
34  for (size_t i = 0; i < msg.observations.size(); i++)
35  {
36  if (msg.observations[i].sensor_name == sensor)
37  {
38  return i;
39  }
40  }
41  return -1;
42 }
43 
47 bool hasSensor(
48  const robot_calibration_msgs::CalibrationData& msg,
49  const std::string& sensor)
50 {
51  return getSensorIndex(msg, sensor) >= 0;
52 }
53 
54 } // namespace robot_calibration
55 
56 #endif // ROBOT_CALIBRATION_CERES_CALIBRATION_DATA_HELPERS_H
int getSensorIndex(const robot_calibration_msgs::CalibrationData &msg, const std::string &sensor)
Determine which observation index corresponds to a particular sensor name.
Calibration code lives under this namespace.
bool hasSensor(const robot_calibration_msgs::CalibrationData &msg, const std::string &sensor)
Determine if a sample of data has an observation from the desired sensor.


robot_calibration
Author(s): Michael Ferguson
autogenerated on Tue Nov 3 2020 17:30:30