Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6fa5aea
[issue #655] Created laser internal type
aitormf Dec 23, 2016
71c242e
[issue #655] Adapted kobukiviewer to new laser type
aitormf Dec 23, 2016
2b3431d
[issue #652] added vector include in jderobot_types:laserData
aitormf Dec 26, 2016
51d2628
[issue #655] Created JdeRobotCom lib to separate communications of to…
aitormf Dec 26, 2016
9b2ed4b
[issue #655] Adapted kobukiViewer to use JdeRobotCom for laser interface
aitormf Dec 26, 2016
4e3c9ce
[issue #644] Prepared JdeRobotCom to listen ROS laser messages
aitormf Dec 29, 2016
4aedba0
[issue #644] Prepared kobukiViewer to use ROS in Laser
aitormf Dec 29, 2016
8b2153a
[issue #644] updated jderobotcom to use threads in ros and added more…
aitormf Dec 30, 2016
a6d7420
changed laseData timestamp to double
aitormf Jan 11, 2017
9b245d9
renamed jderobotcom as jderobotcomm
aitormf Jan 11, 2017
ac13670
[issue #644] added time_stamp to trnaslators
aitormf Jan 12, 2017
1a6b374
[issues #644 #655] finalized laser part of jderobotcomm
aitormf Jan 12, 2017
f698eff
[issue #662] Created image internal type
aitormf Jan 12, 2017
4a98d4e
[issue 662] first version of JdeRobotCom CameraClient
aitormf Jan 12, 2017
3b125f3
[issue #662] cleaned cameraIceClient
aitormf Jan 13, 2017
0e45b76
[issue #662] cameraClient of jderobotComm works with ICE
aitormf Jan 13, 2017
8902f23
[issue #662] first version of cameraClient with ROS
aitormf Jan 13, 2017
bebd2df
[issue 665] Created pose3d Internal type
aitormf Jan 16, 2017
bee8de0
[issue 665] first version of pose3dClient of Jderobotcomm
aitormf Jan 16, 2017
82ef152
[issue 665] solved errors in jderobotcomm pose3dClient
aitormf Jan 16, 2017
10e6f79
[issue #665] prepared kobukiViewer to use jderobotcomm pose3dClient
aitormf Jan 16, 2017
762f6bb
[issue #665] Added ROS support to Jderobotcomm pose3dClient and solve…
aitormf Jan 16, 2017
5ea0d93
[issue #666] Created cmdvel internal type
aitormf Jan 23, 2017
d17174f
[issue #666] first version of motorsClient of Jderobotcomm
aitormf Jan 23, 2017
4720dec
[issue #666] prepared kobukiViewer to use jderobotcomm motorsClient
aitormf Jan 23, 2017
390e23a
[issue #666] Added ROS support to Jderobotcomm motorsClient
aitormf Jan 24, 2017
f05068b
[issue 666] adapted jderobotcomm ice client to new logger
aitormf Feb 6, 2017
8f0d219
[issue #654] Deleted roscompat library because is replaced by JdeRobo…
aitormf Feb 6, 2017
4497e47
Merge remote-tracking branch 'jderobot/master' into libs/jderobotcomm…
aitormf Feb 15, 2017
2453c37
[issue #666] Added cmake modules to can use python3 and python2 in th…
aitormf Feb 15, 2017
a71ac4b
[issue 666] added FindPython2Interp and FindPython3Interp
aitormf Feb 15, 2017
dbb93a5
[issue 666] solved bug in Macro usePython
aitormf Feb 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ endif()
include(buildpresets.cmake)


# include Modules
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")

#check compiller
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -86,6 +89,31 @@ macro(list_subdirectories2 retval curdir return_relative)
set(${retval} ${list_of_dirs})
endmacro()

#macro to switch pythonInterp
macro(usePython ver)
if (${ver} EQUAL 2 AND ${PYTHON2INTERP_FOUND})
set(PYTHON_EXECUTABLE ${PYTHON2_EXECUTABLE})
set(PYTHON_VERSION_STRING ${PYTHON2_VERSION_STRING})
set(PYTHON_VERSION_MAJOR ${PYTHON2_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR})
set(PYTHON_VERSION_PATCH ${PYTHON2_VERSION_PATCH})
set(PYTHONINTERP_FOUND TRUE)
elseif(${ver} EQUAL 3 AND ${PYTHON3INTERP_FOUND})
set(PYTHON_EXECUTABLE ${PYTHON3_EXECUTABLE})
set(PYTHON_VERSION_STRING ${PYTHON3_VERSION_STRING})
set(PYTHON_VERSION_MAJOR ${PYTHON3_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR})
set(PYTHON_VERSION_PATCH ${PYTHON3_VERSION_PATCH})
set(PYTHONINTERP_FOUND TRUE)
else(${ver} EQUAL 2 AND ${PYTHON2INTERP_FOUND})
unset(PYTHON_EXECUTABLE)
unset(PYTHON_VERSION_STRING)
unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR)
unset(PYTHON_VERSION_PATCH)
set(PYTHONINTERP_FOUND FALSE)
endif(${ver} EQUAL 2 AND ${PYTHON2INTERP_FOUND})
endmacro()



Expand Down
5 changes: 4 additions & 1 deletion Deps/python3/CMakeLists.txt → Deps/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
find_package(PythonInterp 3 REQUIRED)
find_package(Python3Interp)
find_package(Python2Interp)

usePython(3)

execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import os;print(os.path.dirname(os.__file__))"
Expand Down
4 changes: 4 additions & 0 deletions Deps/ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ find_package(roscpp QUIET)
if(roscpp_FOUND)

MESSAGE("*** ROS LIBRARIES FOUND : ${roscpp_INCLUDE_DIRS}")

SET (CMAKE_PREFIX_PATH /opt/ros/kinetic)

list(APPEND DEPS ros-jade-roscpp ros-jade-std-msgs ros-jade-message-generation ros-jade-cv-bridge ros-jade-image-transport ros-jade-roscpp-core)

# list(APPEND DEPS_DEV )
else()
MESSAGE("*** ROS LIBRARIES NOT FOUND")
Expand Down
38 changes: 38 additions & 0 deletions cmake/modules/FindPython2Interp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Find the Python2 interpreter.
#
# NB: Generally, FindPythonInterp.cmake is able to find a python3
# interpreter by working with version numbers. This find module
# does some gymnastics to be able to find BOTH python2 and python3
# interpreters within the same project, which does not seem possible
# with the modules provided from upstream.
#
# This is designed to look for the Python2 interpreter, if you
# also use FindPython3Interp.cmake to look for a Python3 interpreter.
# In all other cases, the shipped module FindPythonInterp.cmake
# does the trick.
#
# PYTHON2INTERP_FOUND - Was the Python executable found
# PYTHON2_EXECUTABLE - path to the Python interpreter
#
# PYTHON2_VERSION_STRING - Python version found e.g. 2.5.2
# PYTHON2_VERSION_MAJOR - Python major version found e.g. 2
# PYTHON2_VERSION_MINOR - Python minor version found e.g. 5
# PYTHON2_VERSION_PATCH - Python patch version found e.g. 2
#
# Nuke the cache, somebody might have looked for Python 2...
# copy from: https://gitlab.dune-project.org/quality/dune-python/blob/694ae69fe57de42b1a87373ed9eea8d76a1ebfd3/cmake/modules/FindPython2Interp.cmake
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
find_package(PythonInterp 2)
find_package_handle_standard_args(Python2Interp
REQUIRED_VARS PYTHONINTERP_FOUND)
# Set all those variables that we promised
set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE})
set(PYTHON2_VERSION_STRING ${PYTHON_VERSION_STRING})
set(PYTHON2_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
set(PYTHON2_VERSION_MINOR ${PYTHON_VERSION_MINOR})
set(PYTHON2_VERSION_PATCH ${PYTHON_VERSION_PATCH})
# Now nuke the cache to allow later rerunning of find_package(PythonInterp)
# with a different required version number.
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
40 changes: 40 additions & 0 deletions cmake/modules/FindPython3Interp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Find the Python3 interpreter.
#
# NB: Generally, FindPythonInterp.cmake is able to find a python3
# interpreter by working with version numbers. This find module
# does some gymnastics to be able to find BOTH python2 and python3
# interpreters within the same project, which does not seem possible
# with the modules provided from upstream.
#
# When using this to look for Python3, you should use
# FindPython2Interp.cmake to look for the Python2 interpreter.
#
# This module sets the following variables:
#
# PYTHON3INTERP_FOUND - Was the Python executable found
# PYTHON3_EXECUTABLE - path to the Python interpreter
#
# PYTHON3_VERSION_STRING - Python version found e.g. 2.5.2
# PYTHON3_VERSION_MAJOR - Python major version found e.g. 2
# PYTHON3_VERSION_MINOR - Python minor version found e.g. 5
# PYTHON3_VERSION_PATCH - Python patch version found e.g. 2
#
# Nuke the cache, somebody might have looked for Python 2...
# copy from: https://gitlab.dune-project.org/quality/dune-python/blob/694ae69fe57de42b1a87373ed9eea8d76a1ebfd3/cmake/modules/FindPython3Interp.cmake


unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
find_package(PythonInterp 3)
find_package_handle_standard_args(Python3Interp
REQUIRED_VARS PYTHONINTERP_FOUND)
# Set all those variables that we promised
set(PYTHON3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(PYTHON3_VERSION_STRING ${PYTHON_VERSION_STRING})
set(PYTHON3_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
set(PYTHON3_VERSION_MINOR ${PYTHON_VERSION_MINOR})
set(PYTHON3_VERSION_PATCH ${PYTHON_VERSION_PATCH})
# Now nuke the cache to allow later rerunning of find_package(PythonInterp)
# with a different required version number.
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/interfaces)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/types)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/libs)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/tools)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/drivers)
2 changes: 2 additions & 0 deletions src/interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,6 @@ if (build_interfaces_cpp)
target_link_libraries(JderobotInterfaces ${ice2_LIBRARIES})
endif()

set(ice_interfaces_INCLUDE_DIRS "${SLICE_CPP_DIR}" CACHE PATH "Find(ice_interfaces)")

endif(NOT DEFINED SLICE_NEW_STYLE)
104 changes: 104 additions & 0 deletions src/libs/jderobotcomm_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
cmake_minimum_required(VERSION 2.8)
if(roscpp_FOUND)
project(jderobotcomm)

usePython(2)

list(APPEND Ice_LIBRARIES Ice IceUtil)

SET (CATKIN_DEVEL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})

find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
cv_bridge
image_transport
nav_msgs
geometry_msgs
)

catkin_package(
CATKIN_DEPENDS roscpp std_msgs message_runtime
)

set(binname ${PROJECT_NAME})

### Project config
include_directories(
include
${jderobottypes_INCLUDE_DIRS}
${Ice_INCLUDE_DIR}
${LIBS_DIR}
${catkin_INCLUDE_DIRS}
${roscpp_INCLUDE_DIRS}
${ice_interfaces_INCLUDE_DIRS}
)


set(HEADERS
include/jderobot/comm/laserClient.hpp
include/jderobot/comm/interfaces/laserClient.hpp
include/jderobot/comm/ice/laserIceClient.hpp
include/jderobot/comm/ros/translators.hpp
include/jderobot/comm/ros/listenerLaser.hpp
include/jderobot/comm/cameraClient.hpp
include/jderobot/comm/interfaces/cameraClient.hpp
include/jderobot/comm/ice/cameraIceClient.hpp
include/jderobot/comm/ros/listenerCamera.hpp
include/jderobot/comm/pose3dClient.hpp
include/jderobot/comm/interfaces/pose3dClient.hpp
include/jderobot/comm/ice/pose3dIceClient.hpp
include/jderobot/comm/ros/listenerPose.hpp
include/jderobot/comm/motorsClient.hpp
include/jderobot/comm/interfaces/motorsClient.hpp
include/jderobot/comm/ice/motorsIceClient.hpp
include/jderobot/comm/ros/publisherMotors.hpp
)

set(SOURCES
src/laserClient.cpp
src/ice/laserIceClient.cpp
src/ros/translators.cpp
src/ros/listenerLaser.cpp
src/cameraClient.cpp
src/ice/cameraIceClient.cpp
src/ros/listenerCamera.cpp
src/pose3dClient.cpp
src/ice/pose3dIceClient.cpp
src/ros/listenerPose.cpp
src/motorsClient.cpp
src/ice/motorsIceClient.cpp
src/ros/publisherMotors.cpp
)

## Adding shared library for common usage
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
target_link_libraries(${PROJECT_NAME} ${Ice_LIBRARIES} logger ${Boost_LIBRARIES} colorspacesmm JderobotInterfaces ${catkin_LIBRARIES})

## Adding static library for single .so configurations
# since target is a shared library, -fPIC must be provided
add_library(${PROJECT_NAME}-embedded STATIC ${SOURCES} ${HEADERS})
target_link_libraries(${PROJECT_NAME}-embedded ${Ice_LIBRARIES} logger ${Boost_LIBRARIES} colorspacesmm JderobotInterfaces)
set_property(TARGET ${PROJECT_NAME}-embedded PROPERTY POSITION_INDEPENDENT_CODE 1)



## Export library variables (like find_package)
set(${PROJECT_NAME}_FOUND 1 CACHE BOOL "Find(${PROJECT_NAME})")
set(${PROJECT_NAME}_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE PATH "Find(${PROJECT_NAME})")
set(${PROJECT_NAME}_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "Find(${PROJECT_NAME})")
set(${PROJECT_NAME}_LIBRARIES "${PROJECT_NAME}" CACHE STRINGS "Find(${PROJECT_NAME})")



### Install
install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/jderobot
COMPONENT core
)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
COMPONENT core
)

endif() ## roscpp_FOUND
50 changes: 50 additions & 0 deletions src/libs/jderobotcomm_cpp/include/jderobot/comm/cameraClient.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 1997-2016 JDE Developers Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
* Authors :
* Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
*/

#ifndef JDEROBOTCOMM_CAMERACLIENT_H
#define JDEROBOTCOMM_CAMERACLIENT_H

#include <jderobot/types/image.h>
#include <Ice/Communicator.h>
#include <Ice/Properties.h>
#include <jderobot/comm/interfaces/cameraClient.hpp>
#include <jderobot/comm/ice/cameraIceClient.hpp>
#include <jderobot/comm/ros/listenerCamera.hpp>




namespace JdeRobotComm {

/**
* @brief make a CameraClient using propierties
*
*
* @param communicator that contains properties
* @param prefix of client Propierties (example: "kobukiViewer.Camera")
*
*
* @return null if propierties are wrong
*/
CameraClient* getCameraClient(Ice::CommunicatorPtr ic, std::string prefix);


} //NS

#endif // JDEROBOTCOMM_CAMERACLIENT_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
* Author : Jose María Cañas <jmplaza@gsyc.es>
Francisco Miguel Rivas Montero <franciscomiguel.rivas@urjc.es>

*/

#ifndef JDEROBOTCOMM_CAMERAICECLIENT_H_
#define JDEROBOTCOMM_CAMERAICECLIENT_H_

#include <IceUtil/IceUtil.h>
#include <Ice/Ice.h>
#include <visionlib/colorspaces/colorspacesmm.h>
#include <jderobot/camera.h>
#include <cv.h>
#include <logger/Logger.h>
#include <jderobot/types/image.h>
#include <jderobot/comm/interfaces/cameraClient.hpp>
#include <zlib.h>

namespace JdeRobotComm {

class CameraIceClient: public IceUtil::Thread, public JdeRobotComm::CameraClient {
public:
CameraIceClient(Ice::CommunicatorPtr ic, std::string prefix);
virtual ~CameraIceClient();
virtual void run();

//callbacks
virtual JdeRobotTypes::Image getImage();
virtual int getRefreshRate();


void pause();
void resume();
void reset();
void stop_thread();
bool getPause(){return pauseStatus;};

jderobot::ImageFormat getImageFormat();
void setImageFormat (std::string format);


private:
jderobot::CameraPrx prx;
long long int cycle;

IceUtil::Mutex controlMutex;
std::string prefix;

bool pauseStatus;

IceUtil::Cond semWait;
std::string mImageFormat;

};

} /* namespace JdeRobotComm */
#endif /* JDEROBOTCOMM_CAMERAICECLIENT_H_ */
Loading