Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] comment out calibration from manager for now #95

Closed
wants to merge 10 commits into from
109 changes: 56 additions & 53 deletions camera_calibration_parsers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,83 +1,86 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)

project(camera_calibration_parsers)

find_package(catkin REQUIRED sensor_msgs rosconsole roscpp roscpp_serialization)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake_ros REQUIRED)

find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(yaml-cpp REQUIRED)

find_package(PythonLibs REQUIRED)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
find_package(Boost REQUIRED COMPONENTS filesystem python)
else()
find_package(Boost REQUIRED COMPONENTS filesystem python3)
endif()
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})

catkin_python_setup()

catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS sensor_msgs
)

find_package(PkgConfig)


if (ANDROID)
find_package(yaml-cpp)
add_definitions(-DHAVE_NEW_YAMLCPP)
else()
pkg_check_modules(YAML_CPP yaml-cpp)
if(${YAML_CPP_VERSION} VERSION_GREATER 0.5)
add_definitions(-DHAVE_NEW_YAMLCPP)
endif()
link_directories(${YAML_CPP_LIBRARY_DIRS})
endif()
include_directories(${YAML_CPP_INCLUDE_DIRS})
include_directories(include)

# define the library
add_library(${PROJECT_NAME}
src/parse.cpp
src/parse_ini.cpp
src/parse_yml.cpp
)
ament_target_dependencies(${PROJECT_NAME}
"rclcpp"
"sensor_msgs"
)
target_link_libraries(${PROJECT_NAME} ${Boost_FILESYSTEM_LIBRARY} ${YAML_CPP_LIBRARIES})

# TODO: Reenable Python Wrapper with new serialization technique.
#add_library(${PROJECT_NAME}_wrapper
# src/parse_wrapper.cpp)
#ament_target_dependencies(${PROJECT_NAME}_wrapper
# "rclcpp"
# "sensor_msgs"
#)
#target_include_directories(${PROJECT_NAME}_wrapper PUBLIC ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
#target_link_libraries(${PROJECT_NAME}_wrapper ${PROJECT_NAME} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${YAML_CPP_LIBRARIES})

add_library(${PROJECT_NAME}_wrapper
src/parse_wrapper.cpp)

target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${YAML_CPP_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries(${PROJECT_NAME}_wrapper ${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})

# Don't prepend wrapper library name with lib and add to Python libs.
set_target_properties(${PROJECT_NAME}_wrapper PROPERTIES
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}
)

add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
# define the exe to convert
add_executable(convert src/convert.cpp)
target_link_libraries(convert ${PROJECT_NAME})

install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
COMPONENT main
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

# define the exe to convert
add_executable(convert src/convert.cpp)
target_link_libraries(convert ${PROJECT_NAME} ${rosconsole_LIBRARIES})

install(
TARGETS convert
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

install(TARGETS ${PROJECT_NAME}_wrapper
DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
install(
DIRECTORY include/
DESTINATION include
)

if(CATKIN_ENABLE_TESTING)
add_subdirectory(test)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(rclcpp)
ament_export_dependencies(sensor_msgs)

if(ENABLE_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

# TODO: Fix tests
# add_subdirectory(test)
endif()

ament_package()

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
*
* Copyright (c) 2009, Willow Garage, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
Expand All @@ -17,7 +17,7 @@
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Expand All @@ -36,10 +36,13 @@
#define CAMERA_CALIBRATION_PARSERS_PARSE_H

#include <string>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/msg/camera_info.hpp>

/// @todo: use stream-based API, so no read/parse distinction
namespace camera_calibration_parsers {
namespace camera_calibration_parsers
{

using CameraInfo = sensor_msgs::msg::CameraInfo;

/**
* \brief Write calibration parameters to a file.
Expand All @@ -50,8 +53,9 @@ namespace camera_calibration_parsers {
* \param camera_name Name of the camera
* \param cam_info Camera parameters
*/
bool writeCalibration(const std::string& file_name, const std::string& camera_name,
const sensor_msgs::CameraInfo& cam_info);
bool writeCalibration(
const std::string & file_name, const std::string & camera_name,
const CameraInfo & cam_info);

/**
* \brief Read calibration parameters from a file.
Expand All @@ -62,8 +66,9 @@ bool writeCalibration(const std::string& file_name, const std::string& camera_na
* \param[out] camera_name Name of the camera
* \param[out] cam_info Camera parameters
*/
bool readCalibration(const std::string& file_name, std::string& camera_name,
sensor_msgs::CameraInfo& cam_info);
bool readCalibration(
const std::string & file_name, std::string & camera_name,
CameraInfo & cam_info);

/**
* \brief Parse calibration parameters from a string in memory.
Expand All @@ -73,8 +78,9 @@ bool readCalibration(const std::string& file_name, std::string& camera_name,
* \param[out] camera_name Name of the camera
* \param[out] cam_info Camera parameters
*/
bool parseCalibration(const std::string& buffer, const std::string& format,
std::string& camera_name, sensor_msgs::CameraInfo& cam_info);
bool parseCalibration(
const std::string & buffer, const std::string & format,
std::string & camera_name, CameraInfo & cam_info);

} //namespace camera_calibration_parsers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
*
* Copyright (c) 2009, Willow Garage, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
Expand All @@ -17,7 +17,7 @@
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Expand All @@ -36,9 +36,12 @@
#define CAMERA_CALIBRATION_PARSERS_PARSE_INI_H

#include <string>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/msg/camera_info.hpp>

namespace camera_calibration_parsers {
namespace camera_calibration_parsers
{

using CameraInfo = sensor_msgs::msg::CameraInfo;

/**
* \brief Write calibration parameters to a file in INI format.
Expand All @@ -47,8 +50,9 @@ namespace camera_calibration_parsers {
* \param camera_name Name of the camera
* \param cam_info Camera parameters
*/
bool writeCalibrationIni(std::ostream& out, const std::string& camera_name,
const sensor_msgs::CameraInfo& cam_info);
bool writeCalibrationIni(
std::ostream & out, const std::string & camera_name,
const CameraInfo & cam_info);

/**
* \brief Read calibration parameters from an INI file.
Expand All @@ -57,7 +61,9 @@ bool writeCalibrationIni(std::ostream& out, const std::string& camera_name,
* \param[out] camera_name Name of the camera
* \param[out] cam_info Camera parameters
*/
bool readCalibrationIni(std::istream& in, std::string& camera_name, sensor_msgs::CameraInfo& cam_info);
bool readCalibrationIni(
std::istream & in, std::string & camera_name,
CameraInfo & cam_info);

/**
* \brief Write calibration parameters to a file in INI format.
Expand All @@ -66,8 +72,9 @@ bool readCalibrationIni(std::istream& in, std::string& camera_name, sensor_msgs:
* \param camera_name Name of the camera
* \param cam_info Camera parameters
*/
bool writeCalibrationIni(const std::string& file_name, const std::string& camera_name,
const sensor_msgs::CameraInfo& cam_info);
bool writeCalibrationIni(
const std::string & file_name, const std::string & camera_name,
const CameraInfo & cam_info);

/**
* \brief Read calibration parameters from an INI file.
Expand All @@ -76,8 +83,9 @@ bool writeCalibrationIni(const std::string& file_name, const std::string& camera
* \param[out] camera_name Name of the camera
* \param[out] cam_info Camera parameters
*/
bool readCalibrationIni(const std::string& file_name, std::string& camera_name,
sensor_msgs::CameraInfo& cam_info);
bool readCalibrationIni(
const std::string & file_name, std::string & camera_name,
CameraInfo & cam_info);

/**
* \brief Parse calibration parameters from a string in memory of INI format.
Expand All @@ -86,8 +94,9 @@ bool readCalibrationIni(const std::string& file_name, std::string& camera_name,
* \param[out] camera_name Name of the camera
* \param[out] cam_info Camera parameters
*/
bool parseCalibrationIni(const std::string& buffer, std::string& camera_name,
sensor_msgs::CameraInfo& cam_info);
bool parseCalibrationIni(
const std::string & buffer, std::string & camera_name,
CameraInfo & cam_info);

//bool readCalibrationIni

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
Expand All @@ -14,7 +14,7 @@
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Expand All @@ -35,9 +35,10 @@
#include <string>
#include <boost/python.hpp>

namespace camera_calibration_parsers {
namespace camera_calibration_parsers
{

boost::python::tuple readCalibrationWrapper(const std::string& file_name);
boost::python::tuple readCalibrationWrapper(const std::string & file_name);

} //namespace camera_calibration_parsers

Expand Down
Loading