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
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
54 changes: 54 additions & 0 deletions Deps/glog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# - Try to find Glog
#
# The following variables are optionally searched for defaults
# GLOG_ROOT_DIR: Base directory where all GLOG components are found
#
# The following are set after configuration is done:
# GLOG_FOUND
# GLOG_INCLUDE_DIRS
# GLOG_LIBRARIES
# GLOG_LIBRARYRARY_DIRS

include(FindPackageHandleStandardArgs)

set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")

if(WIN32)
find_path(GLOG_INCLUDE_DIR glog/logging.h
PATHS ${GLOG_ROOT_DIR}/src/windows)
else()
find_path(GLOG_INCLUDE_DIR glog/logging.h
PATHS ${GLOG_ROOT_DIR})
endif()

if(MSVC)
find_library(GLOG_LIBRARY_RELEASE libglog_static
PATHS ${GLOG_ROOT_DIR}
PATH_SUFFIXES Release)

find_library(GLOG_LIBRARY_DEBUG libglog_static
PATHS ${GLOG_ROOT_DIR}
PATH_SUFFIXES Debug)

set(GLOG_LIBRARY optimized ${GLOG_LIBRARY_RELEASE} debug ${GLOG_LIBRARY_DEBUG})
else()
find_library(GLOG_LIBRARY glog
PATHS ${GLOG_ROOT_DIR}
PATH_SUFFIXES lib lib64)
endif()

find_package_handle_standard_args(Glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)

if(GLOG_FOUND)
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
message(STATUS "Found glog (include: ${GLOG_INCLUDE_DIR}, library: ${GLOG_LIBRARY})")
mark_as_advanced(GLOG_ROOT_DIR GLOG_LIBRARY_RELEASE GLOG_LIBRARY_DEBUG
GLOG_LIBRARY GLOG_INCLUDE_DIR)
ELSE()
message(FATAL_ERROR "Google Logs is required (libgoogle-glog-dev)")
endif()



list(APPEND DEPS libgoogle-glog-dev)
1 change: 1 addition & 0 deletions src/drivers/cameraserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ TARGET_LINK_LIBRARIES(cameraserver
logger
crypto
ns
${GLOG_LIBRARIES}
)
2 changes: 1 addition & 1 deletion src/drivers/cameraserver/cameraserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int main(int argc, char** argv)
}
catch (Ice::ConnectionRefusedException& ex)
{
jderobot::Logger::getInstance()->error("Impossible to connect with NameService!");
LOG(ERROR) << "Impossible to connect with NameService!";
exit(-1);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/drivers/openniServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ IF(OPENNI2_LIB)
${LIBXML2_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
${GLOG_LIBRARIES}
)
endif()
ENDIF()
38 changes: 19 additions & 19 deletions src/drivers/openniServer/OpenNiServerLib/ConcurrentDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ConcurrentDevice::ConcurrentDevice(int fps, int cameraIdx, DeviceConfig config,
openni::Status nRetVal = openni::OpenNI::initialize();
if (nRetVal != openni::STATUS_OK)
{
jderobot::Logger::getInstance()->error("Cannot initialize openni");
LOG(ERROR) << "Cannot initialize openni";
return;
}

Expand All @@ -32,15 +32,15 @@ ConcurrentDevice::ConcurrentDevice(int fps, int cameraIdx, DeviceConfig config,

for (int i = 0; i < deviceList.getSize(); ++i)
{
jderobot::Logger::getInstance()->info("[" + boost::lexical_cast<std::string>(i) + "]" + deviceList[i].getName() + " [" + deviceList[i].getVendor() + "] " + "(" + deviceList[i].getUri() + ")");
LOG(INFO) << "[" + boost::lexical_cast<std::string>(i) + "]" + deviceList[i].getName() + " [" + deviceList[i].getVendor() + "] " + "(" + deviceList[i].getUri() + ")";
}



//checking the number off connected devices
if (deviceList.getSize() < 1)
{
jderobot::Logger::getInstance()->error( "Missing devices" );
LOG(ERROR) << "Missing devices";
openni::OpenNI::shutdown();
}

Expand All @@ -52,7 +52,7 @@ ConcurrentDevice::ConcurrentDevice(int fps, int cameraIdx, DeviceConfig config,
nRetVal = g_device.open(deviceUri);
if (nRetVal != openni::STATUS_OK)
{
jderobot::Logger::getInstance()->error("Error openning device");
LOG(ERROR) << "Error openning device";
return;
}

Expand All @@ -63,7 +63,7 @@ ConcurrentDevice::ConcurrentDevice(int fps, int cameraIdx, DeviceConfig config,

if (0 != openCommon())
{
jderobot::Logger::getInstance()->error("Error openning streams");
LOG(ERROR) << "Error openning streams";
}

// this->changeRegistration(1); image registered over rgb
Expand All @@ -72,7 +72,7 @@ ConcurrentDevice::ConcurrentDevice(int fps, int cameraIdx, DeviceConfig config,
cycle=(float)(1/(float)fps)*1000000;


jderobot::Logger::getInstance()->info("Device initialized");
LOG(INFO) << "Device initialized";
return;


Expand All @@ -92,7 +92,7 @@ void ConcurrentDevice::run() {
int process = IceUtil::Time::now().toMicroSeconds() - lastIT.toMicroSeconds();

if (process > (int)cycle ){
jderobot::Logger::getInstance()->warning("-------- openniServer: RGB openni timeout-" );
DLOG(WARNING) << "-------- openniServer: RGB openni timeout-" ;
}
else{
int delay = (int)cycle - process;
Expand Down Expand Up @@ -130,7 +130,7 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType
{
if (openType == SENSOR_ON)
{
jderobot::Logger::getInstance()->error("No " + std::string(name) + " sensor available");
LOG(ERROR) << "No " + std::string(name) + " sensor available";
return -1;
}
else
Expand All @@ -144,7 +144,7 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType
{
if (openType == SENSOR_ON)
{
jderobot::Logger::getInstance()->error("Failed to create " + std::string(openni::OpenNI::getExtendedError()) + " " + std::string(name));
LOG(ERROR) << "Failed to create " + std::string(openni::OpenNI::getExtendedError()) + " " + std::string(name);
return -2;
}
else
Expand All @@ -160,7 +160,7 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType

if (openType == SENSOR_ON)
{
jderobot::Logger::getInstance()->error("Failed to start depth stream: " + std::string(openni::OpenNI::getExtendedError()));
LOG(ERROR) << "Failed to start depth stream: " + std::string(openni::OpenNI::getExtendedError());
return -3;
}
else
Expand All @@ -171,7 +171,7 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType


if ((*ppSensorInfo)->getSupportedVideoModes().getSize()==1){
jderobot::Logger::getInstance()->warning("Only one mode is avialable image will be post processed is the mode does not match with the device output");
LOG(WARNING) << "Only one mode is avialable image will be post processed is the mode does not match with the device output";
if (stream.getVideoMode().getResolutionX()== workingSize.width && stream.getVideoMode().getResolutionY() == workingSize.height) {
this->videoMode = VideoMode(workingSize.width,workingSize.height);
this->videoMode.setValid(true);
Expand All @@ -187,14 +187,14 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType
for(int i=0;i < (*ppSensorInfo)->getSupportedVideoModes().getSize();i++)
{
openni::VideoMode videoMode = (*ppSensorInfo)->getSupportedVideoModes()[i];
jderobot::Logger::getInstance()->info("[" + boost::lexical_cast<std::string>(i) + "]: fps: " + boost::lexical_cast<std::string>(videoMode.getFps()) + "x: " + boost::lexical_cast<std::string>(videoMode.getResolutionX()) + " x " + boost::lexical_cast<std::string>(videoMode.getResolutionY()));
LOG(INFO) << "[" + boost::lexical_cast<std::string>(i) + "]: fps: " + boost::lexical_cast<std::string>(videoMode.getFps()) + "x: " + boost::lexical_cast<std::string>(videoMode.getResolutionX()) + " x " + boost::lexical_cast<std::string>(videoMode.getResolutionY());
if (workingSize.width == videoMode.getResolutionX() && workingSize.height == videoMode.getResolutionY()){
id_fpsbyWorkingResolution.push_back(std::make_pair(videoMode.getFps(),i));
}
}

if (id_fpsbyWorkingResolution.size() ==0){
jderobot::Logger::getInstance()->error("No videomode supported with the selected configutation: " + boost::lexical_cast<std::string>(workingSize.width) + " x " + boost::lexical_cast<std::string>(workingSize.height));
LOG(ERROR) << "No videomode supported with the selected configutation: " + boost::lexical_cast<std::string>(workingSize.width) + " x " + boost::lexical_cast<std::string>(workingSize.height);
exit(2);
}

Expand All @@ -210,8 +210,8 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType
}
}

jderobot::Logger::getInstance()->info("Setting video mode to:");
jderobot::Logger::getInstance()->info("[" + boost::lexical_cast<std::string>(bestId) + "]: fps: " + boost::lexical_cast<std::string>((*ppSensorInfo)->getSupportedVideoModes()[bestId].getFps()) + "x: " + boost::lexical_cast<std::string>((*ppSensorInfo)->getSupportedVideoModes()[bestId].getResolutionX()) + " x " + boost::lexical_cast<std::string>((*ppSensorInfo)->getSupportedVideoModes()[bestId].getResolutionY()));
LOG(INFO) << "Setting video mode to:";
LOG(INFO) << "[" + boost::lexical_cast<std::string>(bestId) + "]: fps: " + boost::lexical_cast<std::string>((*ppSensorInfo)->getSupportedVideoModes()[bestId].getFps()) + "x: " + boost::lexical_cast<std::string>((*ppSensorInfo)->getSupportedVideoModes()[bestId].getResolutionX()) + " x " + boost::lexical_cast<std::string>((*ppSensorInfo)->getSupportedVideoModes()[bestId].getResolutionY());



Expand All @@ -222,7 +222,7 @@ int ConcurrentDevice::openStream(const char* name, openni::SensorType sensorType

if (openType == SENSOR_ON)
{
jderobot::Logger::getInstance()->error("Failed to change video mode: " + std::string(openni::OpenNI::getExtendedError()));
LOG(ERROR) << "Failed to change video mode: " + std::string(openni::OpenNI::getExtendedError());
return -3;
}
else
Expand Down Expand Up @@ -280,7 +280,7 @@ void ConcurrentDevice::readFrame()
case 2:
g_irStream.readFrame(&g_irFrame); break;
default:
jderobot::Logger::getInstance()->error("Error in wait");
LOG(ERROR) << "Error in wait";

}
mutex.unlock();
Expand All @@ -295,13 +295,13 @@ int ConcurrentDevice::openCommon()

int ret;

jderobot::Logger::getInstance()->info("-------------------------- DEPTH ------------------------");
LOG(INFO) << "-------------------------- DEPTH ------------------------";
ret = openStream( "depth", openni::SENSOR_DEPTH, config.openDepth, g_depthStream, &g_depthSensorInfo, &g_bIsDepthOn);
if (ret != 0)
{
return ret;
}
jderobot::Logger::getInstance()->info("-------------------------- COLOR ------------------------");
LOG(INFO) << "-------------------------- COLOR ------------------------";
ret = openStream( "color", openni::SENSOR_COLOR, config.openColor, g_colorStream, &g_colorSensorInfo, &g_bIsColorOn);
if (ret != 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/openniServer/OpenNiServerLib/DepthCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace openniServer{
std::string fmtStr = prop->getPropertyWithDefault(prefix+"Format","YUY2");//default format YUY2
imageFmt = colorspaces::Image::Format::searchFormat(fmtStr);
if (!imageFmt)
jderobot::Logger::getInstance()->warning( "Format " + fmtStr + " unknown" );
LOG(WARNING) <<"Format " + fmtStr + " unknown" ;
imageDescription->size = imageDescription->width * imageDescription->height * CV_ELEM_SIZE(imageFmt->cvType);
imageDescription->format = imageFmt->name;

jderobot::Logger::getInstance()->info( "Starting thread for camera: " + cameraDescription->name );
LOG(INFO) << "Starting thread for camera: " + cameraDescription->name ;
replyTask = new ReplyTask(this, framerateN, device);

this->control=replyTask->start();//my own thread
Expand All @@ -32,7 +32,7 @@ namespace openniServer{
}

DepthCamera::~DepthCamera() {
jderobot::Logger::getInstance()->info( "Stopping and joining thread for Depth Camera" );
LOG(INFO) << "Stopping and joining thread for Depth Camera" ;
replyTask->destroy();
}

Expand Down
4 changes: 2 additions & 2 deletions src/drivers/openniServer/OpenNiServerLib/PointCloudServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace openniServer {
}

PointCloudServer::~PointCloudServer() {
jderobot::Logger::getInstance()->info("Stopping and joining thread for pointCloud");
LOG(INFO) << "Stopping and joining thread for pointCloud";
replyCloud->destroy();
this->control.join();

Expand Down Expand Up @@ -134,7 +134,7 @@ namespace openniServer {

int delay = IceUtil::Time::now().toMicroSeconds() - lastIT.toMicroSeconds();
if (delay > cycle) {
jderobot::Logger::getInstance()->warning("-------- openniServer: POINTCLOUD openni timeout-");
LOG(WARNING) << "-------- openniServer: POINTCLOUD openni timeout-";
} else {
if (delay < 1 || delay > cycle)
delay = 1;
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/openniServer/OpenNiServerLib/RGBCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace openniServer{
std::string fmtStr = prop->getPropertyWithDefault(prefix+"Format","YUY2");//default format YUY2
imageFmt = colorspaces::Image::Format::searchFormat(fmtStr);
if (!imageFmt)
jderobot::Logger::getInstance()->warning( "Format " + fmtStr + " unknown" );
LOG(WARNING) << "Format " + fmtStr + " unknown" ;
imageDescription->size = imageDescription->width * imageDescription->height * CV_ELEM_SIZE(imageFmt->cvType);
imageDescription->format = imageFmt->name;

jderobot::Logger::getInstance()->info( "Starting thread for camera: " + cameraDescription->name );
LOG(INFO) << "Starting thread for camera: " + cameraDescription->name ;
replyTask = new ReplyTask(this, framerateN, device);

this->control=replyTask->start();//my own thread
Expand All @@ -32,7 +32,7 @@ namespace openniServer{
}

RGBCamera::~RGBCamera() {
jderobot::Logger::getInstance()->info( "Stopping and joining thread for color camera" );
LOG(INFO) << "Stopping and joining thread for color camera" ;
replyTask->destroy();
this->control.join();
}
Expand Down
38 changes: 9 additions & 29 deletions src/drivers/openniServer/openniServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,7 @@ int main(int argc, char** argv){


// Analyze LOG section

std::string logFile = prop->getProperty(componentPrefix + ".Log.File.Name");
if (logFile.size()==0)
jderobot::Logger::getInstance()->warning("You didn't set log file!");
else
jderobot::Logger::getInstance()->setFileLog(logFile);

std::string logLevel = prop->getProperty(componentPrefix + ".Log.File.Level");
if (logLevel.size()==0)
jderobot::Logger::getInstance()->warning("You didn't set *.Log.File.Level key!");
else
jderobot::Logger::getInstance()->setFileLevel(jderobot::Levels(boost::lexical_cast<int>(logLevel)));

std::string screenLevel = prop->getProperty(componentPrefix + ".Log.Screen.Level");
if (screenLevel.size()==0)
jderobot::Logger::getInstance()->warning("You didn't set *.Log.Screen.Level key!");
else
jderobot::Logger::getInstance()->setScreenLevel(jderobot::Levels(boost::lexical_cast<int>(screenLevel)));

jderobot::Logger::getInstance()->info("Logger:: screenLevel=" + screenLevel + " logLevel=" + logLevel + " LogFile=" + logFile);

jderobot::Logger::initialize(argv[0],prop,componentPrefix);


bool cameraR = prop->getPropertyAsIntWithDefault(componentPrefix + ".CameraRGB",0);
Expand All @@ -124,7 +104,7 @@ int main(int argc, char** argv){
Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints(componentPrefix, Endpoints);

int cameraID = prop->getPropertyAsIntWithDefault(componentPrefix + ".deviceId",0);
jderobot::Logger::getInstance()->info( "OpenniServer: Selected device: " + cameraID );
LOG(INFO) << "OpenniServer: Selected device: " + cameraID;
int nCameras=0;


Expand Down Expand Up @@ -158,7 +138,7 @@ int main(int argc, char** argv){
}
catch (Ice::ConnectionRefusedException& ex)
{
jderobot::Logger::getInstance()->error("Impossible to connect with NameService!");
LOG(ERROR) << "Impossible to connect with NameService!";
exit(-1);
}
}
Expand All @@ -170,10 +150,10 @@ int main(int argc, char** argv){
cameraName = "cameraR";
prop->setProperty(objPrefix + "Name",cameraName);//set the value
}
jderobot::Logger::getInstance()->info("Creating camera " + cameraName );
LOG(INFO) << "Creating camera " + cameraName ;
camRGB = new openniServer::RGBCamera(objPrefix,ic,device);
adapter->add(camRGB, ic->stringToIdentity(cameraName));
jderobot::Logger::getInstance()->info(" -------- openniServer: Component: CameraRGB created successfully(" + Endpoints + "@" + cameraName );
LOG(INFO) << " -------- openniServer: Component: CameraRGB created successfully(" + Endpoints + "@" + cameraName ;


if (namingService)
Expand All @@ -190,11 +170,11 @@ int main(int argc, char** argv){
cameraName = "cameraD";
prop->setProperty(objPrefix + "Name",cameraName);//set the value
}
jderobot::Logger::getInstance()->info( "Creating camera " + cameraName );
LOG(INFO) << "Creating camera " + cameraName ;
camDEPTH = new openniServer::DepthCamera(objPrefix,ic,device);
adapter->add(camDEPTH, ic->stringToIdentity(cameraName));
//test camera ok
jderobot::Logger::getInstance()->info(" -------- openniServer: Component: CameraDEPTH created successfully(" + Endpoints + "@" + cameraName );
LOG(INFO) << " -------- openniServer: Component: CameraDEPTH created successfully(" + Endpoints + "@" + cameraName;

if (namingService)
namingService->bind(cameraName, Endpoints, camDEPTH->ice_staticId());
Expand All @@ -204,10 +184,10 @@ int main(int argc, char** argv){
if (pointCloud){
std::string objPrefix(componentPrefix + ".PointCloud.");
std::string Name = prop->getProperty(objPrefix + "Name");
jderobot::Logger::getInstance()->info( "Creating pointcloud1 " + Name );
LOG(INFO) << "Creating pointcloud1 " + Name ;
pc1 = new openniServer::PointCloudServer(objPrefix,prop,device);
adapter->add(pc1 , ic->stringToIdentity(Name));
jderobot::Logger::getInstance()->info(" -------- openniServer: Component: PointCloud created successfully(" + Endpoints + "@" + Name );
LOG(INFO) << " -------- openniServer: Component: PointCloud created successfully(" + Endpoints + "@" + Name ;
}
adapter->activate();
ic->waitForShutdown();
Expand Down
Loading