From 3969c1440fe6356bc0da50d0177e380a7a78ec32 Mon Sep 17 00:00:00 2001 From: anindex Date: Tue, 18 Jun 2019 20:46:44 +0200 Subject: [PATCH 1/5] Initial hokuyoComp doc --- components/hokuyoComp/README.md | 119 ++- components/hokuyoComp/config | 28 + components/hokuyoComp/src/GenericBase.cpp | 590 +++++++++++++ components/hokuyoComp/src/GenericBase.h | 936 +++++++++++++++++++++ components/hokuyoComp/src/generichandler.h | 12 +- 5 files changed, 1658 insertions(+), 27 deletions(-) create mode 100644 components/hokuyoComp/config create mode 100644 components/hokuyoComp/src/GenericBase.cpp create mode 100644 components/hokuyoComp/src/GenericBase.h diff --git a/components/hokuyoComp/README.md b/components/hokuyoComp/README.md index 6e64a600..bdfc9b23 100644 --- a/components/hokuyoComp/README.md +++ b/components/hokuyoComp/README.md @@ -1,36 +1,117 @@ + +# hokuyo + +Hokuyo laser sensor family is a low-cost laser sensor applied in many areas in robotics research such as navigation, etc. It provides range data in short distance from 0.4~5 meters for basic localization or SLAM task in small indoor environment. +The hokuyoComp component provides a wrapper for accessing data from [Hokuyo urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and publish the laser data over RoboComp environment using Ice middleware framework. + +## Resolve dependencies +This section assumes user already installed RoboComp core library and pull Robolab's components according to this [README guide](https://github.com/robocomp/robocomp). + +Before compiling the component, we must first resolve its dependencies which are the Hokuyo driver packages: + +**For Ubuntu 14.04 Trusty Tahr** +``` +sudo apt-get install -y liburg0-dev ``` + +**For Ubuntu 16.04 Xenial Xerus onward** +Because `liburg0-dev` package does not exist in official PPA from Ubuntu 16.04 onward, we should download deb package directly from Trusty repo and install it by `dpkg`. ``` -# -``` hokuyo +sudo apt install -y libc6 libgcc1 libsdl-net1.2 libstdc++6 libsdl1.2debian +cd ~/Downloads +wget http://ftp.br.debian.org/debian/pool/main/u/urg/liburg0_0.8.18-2_amd64.deb +wget http://ftp.br.debian.org/debian/pool/main/u/urg/liburg0-dev_0.8.18-2_amd64.deb +sudo dpkg -i liburg0_0.8.18-2_amd64.deb liburg0-dev_0.8.18-2_amd64.deb ``` -Intro to component here +Then we can compile the `hokuyoComp` component: +``` +cd ~/robocomp/components/robocomp-robolab/components/hokuyoComp/ +cmake . +make +``` ## Configuration parameters -As any other component, -``` *hokuyo* ``` -needs a configuration file to start. In +Unlike any other component, `hokuyoComp` is under development and has not any config file yet. However, we can copy config file from `sickLaser` due to similarity of interfaces between laser sensors. + +``` +cp ../sickLaser/etc/config config +``` + +You can then add Hokuyo specific parameters according to `constants.h` file in the component folder. Example of the config file can be described as below: + +``` +CommonBehavior.Endpoints=tcp -p 10000 + + +# Endpoints for implemented interfaces +Laser.Endpoints=tcp -p 10003 + +# Hokuyo sensor specific parameters +Laser.Driver=HokuyoURG +Laser.Device=/dev/ttyACM0 +Laser.StartValue=0 +Laser.EndValue=768 +Laser.SkipValue=1 +Laser.SampleRate=100 +Laser.angleRes=0.00613593 +Laser.angleIni=-2.356197 +Laser.Cluster=1 +Laser.minRange=40 +Laser.maxRange=4094 +Laser.TalkToBase=false +Laser.maxDegrees=240 +Laser.staticConf=1 + + +Ice.Warn.Connections=0 +Ice.Trace.Network=0 +Ice.Trace.Protocol=0 +Ice.ACM.Client=10 +Ice.ACM.Server=10 +``` - etc/config +Note that the `Laser.Driver` and `Laser.Device` param can be different depended on your Hokuyo device name and current port that the sensor is connected to. For checking every USB ports that haveRoboCompGenericBase::TBaseState getBaseState() + { + RoboCompGenericBase::TBaseState b; -you can find an example of a configuration file. We can find there the following lines: + base->getBaseState(b); - EXAMPLE HERE + printf("seguimos...\n"); + return b; + } been connected: +``` +ls /dev/ttyACM* +``` +Then find the corresponding port that Hokuyo sensor is connected to. - ## Starting the component -To avoid changing the *config* file in the repository, we can copy it to the component's home directory, so changes will remain untouched by future git pulls: +After editing config file for matching with Hokuyo device name and desired parameters of your laser sensor, we plug the Hokuyo sensor in and start the component using these commands: - cd +``` +./bin/hokuyo --Ice.Config=config +``` -``` ``` +## Known issues - cp etc/config config - -After editing the new config file we can run the component: +The hokuyoComp is compiled error on Ubuntu 18.04 in file `generichandler.h` with the error: +``` +In member function 'RoboCompGenericBase::TBaseState GenericLaserHandler getBaseState()': +error: cannot declare catch parameter to be abstract class type 'IceUtil::Exception' + catch(IceUtil::Exception e) +``` +The simple workaround is bypassing the try-catch structure and just execute: + +```c++ +RoboCompGenericBase::TBaseState getBaseState() +{ + RoboCompGenericBase::TBaseState b; - bin/ + base->getBaseState(b); -```hokuyo ``` + printf("seguimos...\n"); + return b; +} +``` - --Ice.Config=config +Then the component is compiled successfully. diff --git a/components/hokuyoComp/config b/components/hokuyoComp/config new file mode 100644 index 00000000..bb28a513 --- /dev/null +++ b/components/hokuyoComp/config @@ -0,0 +1,28 @@ +CommonBehavior.Endpoints=tcp -p 10000 + + +# Endpoints for implemented interfaces +Laser.Endpoints=tcp -p 10003 + +# Hokuyo sensor specific parameters +Laser.Driver=HokuyoURG +Laser.Device=/dev/ttyACM0 +Laser.StartValue=0 +Laser.EndValue=768 +Laser.SkipValue=1 +Laser.SampleRate=100 +Laser.angleRes=0.00613593 +Laser.angleIni=-2.356197 +Laser.Cluster=1 +Laser.minRange=40 +Laser.maxRange=4094 +Laser.TalkToBase=false +Laser.maxDegrees=240 +Laser.staticConf=1 + + +Ice.Warn.Connections=0 +Ice.Trace.Network=0 +Ice.Trace.Protocol=0 +Ice.ACM.Client=10 +Ice.ACM.Server=10 diff --git a/components/hokuyoComp/src/GenericBase.cpp b/components/hokuyoComp/src/GenericBase.cpp new file mode 100644 index 00000000..6174d2ca --- /dev/null +++ b/components/hokuyoComp/src/GenericBase.cpp @@ -0,0 +1,590 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** +// +// Ice version 3.7.0 +// +// +// +// Generated from file `GenericBase.ice' +// +// Warning: do not edit this file. +// +// +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +# pragma warning(disable:4458) // declaration of ... hides class member +#elif defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + +#ifndef ICE_IGNORE_VERSION +# if ICE_INT_VERSION / 100 != 307 +# error Ice version mismatch! +# endif +# if ICE_INT_VERSION % 100 > 50 +# error Beta header file detected +# endif +# if ICE_INT_VERSION % 100 < 0 +# error Ice patch level mismatch! +# endif +#endif + +#ifdef ICE_CPP11_MAPPING // C++11 mapping + +namespace +{ + +const ::IceInternal::DefaultUserExceptionFactoryInit<::RoboCompGenericBase::HardwareFailedException> iceC_RoboCompGenericBase_HardwareFailedException_init("::RoboCompGenericBase::HardwareFailedException"); + +const ::std::string iceC_RoboCompGenericBase_GenericBase_ids[2] = +{ + "::Ice::Object", + "::RoboCompGenericBase::GenericBase" +}; +const ::std::string iceC_RoboCompGenericBase_GenericBase_ops[] = +{ + "getBasePose", + "getBaseState", + "ice_id", + "ice_ids", + "ice_isA", + "ice_ping" +}; +const ::std::string iceC_RoboCompGenericBase_GenericBase_getBaseState_name = "getBaseState"; +const ::std::string iceC_RoboCompGenericBase_GenericBase_getBasePose_name = "getBasePose"; + +} + +RoboCompGenericBase::HardwareFailedException::~HardwareFailedException() +{ +} + +const ::std::string& +RoboCompGenericBase::HardwareFailedException::ice_staticId() +{ + static const ::std::string typeId = "::RoboCompGenericBase::HardwareFailedException"; + return typeId; +} + +bool +RoboCompGenericBase::GenericBase::ice_isA(::std::string s, const ::Ice::Current&) const +{ + return ::std::binary_search(iceC_RoboCompGenericBase_GenericBase_ids, iceC_RoboCompGenericBase_GenericBase_ids + 2, s); +} + +::std::vector<::std::string> +RoboCompGenericBase::GenericBase::ice_ids(const ::Ice::Current&) const +{ + return ::std::vector<::std::string>(&iceC_RoboCompGenericBase_GenericBase_ids[0], &iceC_RoboCompGenericBase_GenericBase_ids[2]); +} + +::std::string +RoboCompGenericBase::GenericBase::ice_id(const ::Ice::Current&) const +{ + return ice_staticId(); +} + +const ::std::string& +RoboCompGenericBase::GenericBase::ice_staticId() +{ + static const ::std::string typeId = "::RoboCompGenericBase::GenericBase"; + return typeId; +} + +bool +RoboCompGenericBase::GenericBase::_iceD_getBaseState(::IceInternal::Incoming& inS, const ::Ice::Current& current) +{ + _iceCheckMode(::Ice::OperationMode::Normal, current.mode); + inS.readEmptyParams(); + ::RoboCompGenericBase::TBaseState iceP_state; + this->getBaseState(iceP_state, current); + auto ostr = inS.startWriteParams(); + ostr->writeAll(iceP_state); + inS.endWriteParams(); + return true; +} + +bool +RoboCompGenericBase::GenericBase::_iceD_getBasePose(::IceInternal::Incoming& inS, const ::Ice::Current& current) +{ + _iceCheckMode(::Ice::OperationMode::Normal, current.mode); + inS.readEmptyParams(); + int iceP_x; + int iceP_z; + float iceP_alpha; + this->getBasePose(iceP_x, iceP_z, iceP_alpha, current); + auto ostr = inS.startWriteParams(); + ostr->writeAll(iceP_x, iceP_z, iceP_alpha); + inS.endWriteParams(); + return true; +} + +bool +RoboCompGenericBase::GenericBase::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) +{ + ::std::pair r = ::std::equal_range(iceC_RoboCompGenericBase_GenericBase_ops, iceC_RoboCompGenericBase_GenericBase_ops + 6, current.operation); + if(r.first == r.second) + { + throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); + } + + switch(r.first - iceC_RoboCompGenericBase_GenericBase_ops) + { + case 0: + { + return _iceD_getBasePose(in, current); + } + case 1: + { + return _iceD_getBaseState(in, current); + } + case 2: + { + return _iceD_ice_id(in, current); + } + case 3: + { + return _iceD_ice_ids(in, current); + } + case 4: + { + return _iceD_ice_isA(in, current); + } + case 5: + { + return _iceD_ice_ping(in, current); + } + default: + { + assert(false); + throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); + } + } +} + +void +RoboCompGenericBase::GenericBasePrx::_iceI_getBaseState(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::RoboCompGenericBase::TBaseState>>& outAsync, const ::Ice::Context& context) +{ + _checkTwowayOnly(iceC_RoboCompGenericBase_GenericBase_getBaseState_name); + outAsync->invoke(iceC_RoboCompGenericBase_GenericBase_getBaseState_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, + nullptr, + [](const ::Ice::UserException& ex) + { + try + { + ex.ice_throw(); + } + catch(const ::RoboCompGenericBase::HardwareFailedException&) + { + throw; + } + catch(const ::Ice::UserException&) + { + } + }); +} + +void +RoboCompGenericBase::GenericBasePrx::_iceI_getBasePose(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::RoboCompGenericBase::GenericBase::GetBasePoseResult>>& outAsync, const ::Ice::Context& context) +{ + _checkTwowayOnly(iceC_RoboCompGenericBase_GenericBase_getBasePose_name); + outAsync->invoke(iceC_RoboCompGenericBase_GenericBase_getBasePose_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, + nullptr, + [](const ::Ice::UserException& ex) + { + try + { + ex.ice_throw(); + } + catch(const ::RoboCompGenericBase::HardwareFailedException&) + { + throw; + } + catch(const ::Ice::UserException&) + { + } + }, + [](::Ice::InputStream* istr) + { + ::RoboCompGenericBase::GenericBase::GetBasePoseResult v; + istr->readAll(v.x, v.z, v.alpha); + return v; + }); +} + +::std::shared_ptr<::Ice::ObjectPrx> +RoboCompGenericBase::GenericBasePrx::_newInstance() const +{ + return ::IceInternal::createProxy(); +} + +const ::std::string& +RoboCompGenericBase::GenericBasePrx::ice_staticId() +{ + return RoboCompGenericBase::GenericBase::ice_staticId(); +} + +namespace Ice +{ +} + +#else // C++98 mapping + +namespace +{ + +const ::std::string iceC_RoboCompGenericBase_GenericBase_getBaseState_name = "getBaseState"; + +const ::std::string iceC_RoboCompGenericBase_GenericBase_getBasePose_name = "getBasePose"; + +} + +namespace +{ + +const ::IceInternal::DefaultUserExceptionFactoryInit< ::RoboCompGenericBase::HardwareFailedException> iceC_RoboCompGenericBase_HardwareFailedException_init("::RoboCompGenericBase::HardwareFailedException"); + +} + +RoboCompGenericBase::HardwareFailedException::HardwareFailedException(const ::std::string& iceP_what) : + ::Ice::UserException(), + what(iceP_what) +{ +} + +RoboCompGenericBase::HardwareFailedException::~HardwareFailedException() throw() +{ +} + +::std::string +RoboCompGenericBase::HardwareFailedException::ice_id() const +{ + return "::RoboCompGenericBase::HardwareFailedException"; +} + +RoboCompGenericBase::HardwareFailedException* +RoboCompGenericBase::HardwareFailedException::ice_clone() const +{ + return new HardwareFailedException(*this); +} + +void +RoboCompGenericBase::HardwareFailedException::ice_throw() const +{ + throw *this; +} + +void +RoboCompGenericBase::HardwareFailedException::_writeImpl(::Ice::OutputStream* ostr) const +{ + ostr->startSlice("::RoboCompGenericBase::HardwareFailedException", -1, true); + Ice::StreamWriter< ::RoboCompGenericBase::HardwareFailedException, ::Ice::OutputStream>::write(ostr, *this); + ostr->endSlice(); +} + +void +RoboCompGenericBase::HardwareFailedException::_readImpl(::Ice::InputStream* istr) +{ + istr->startSlice(); + Ice::StreamReader< ::RoboCompGenericBase::HardwareFailedException, ::Ice::InputStream>::read(istr, *this); + istr->endSlice(); +} +::IceProxy::Ice::Object* ::IceProxy::RoboCompGenericBase::upCast(::IceProxy::RoboCompGenericBase::GenericBase* p) { return p; } + +void +::IceProxy::RoboCompGenericBase::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::RoboCompGenericBase::GenericBase>& v) +{ + ::Ice::ObjectPrx proxy; + istr->read(proxy); + if(!proxy) + { + v = 0; + } + else + { + v = new ::IceProxy::RoboCompGenericBase::GenericBase; + v->_copyFrom(proxy); + } +} + +::Ice::AsyncResultPtr +IceProxy::RoboCompGenericBase::GenericBase::_iceI_begin_getBaseState(const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) +{ + _checkTwowayOnly(iceC_RoboCompGenericBase_GenericBase_getBaseState_name, sync); + ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RoboCompGenericBase_GenericBase_getBaseState_name, del, cookie, sync); + try + { + result->prepare(iceC_RoboCompGenericBase_GenericBase_getBaseState_name, ::Ice::Normal, context); + result->writeEmptyParams(); + result->invoke(iceC_RoboCompGenericBase_GenericBase_getBaseState_name); + } + catch(const ::Ice::Exception& ex) + { + result->abort(ex); + } + return result; +} + +void +IceProxy::RoboCompGenericBase::GenericBase::end_getBaseState(::RoboCompGenericBase::TBaseState& iceP_state, const ::Ice::AsyncResultPtr& result) +{ + ::Ice::AsyncResult::_check(result, this, iceC_RoboCompGenericBase_GenericBase_getBaseState_name); + if(!result->_waitForResponse()) + { + try + { + result->_throwUserException(); + } + catch(const ::RoboCompGenericBase::HardwareFailedException&) + { + throw; + } + catch(const ::Ice::UserException& ex) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); + } + } + ::Ice::InputStream* istr = result->_startReadParams(); + istr->read(iceP_state); + result->_endReadParams(); +} + +::Ice::AsyncResultPtr +IceProxy::RoboCompGenericBase::GenericBase::_iceI_begin_getBasePose(const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) +{ + _checkTwowayOnly(iceC_RoboCompGenericBase_GenericBase_getBasePose_name, sync); + ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RoboCompGenericBase_GenericBase_getBasePose_name, del, cookie, sync); + try + { + result->prepare(iceC_RoboCompGenericBase_GenericBase_getBasePose_name, ::Ice::Normal, context); + result->writeEmptyParams(); + result->invoke(iceC_RoboCompGenericBase_GenericBase_getBasePose_name); + } + catch(const ::Ice::Exception& ex) + { + result->abort(ex); + } + return result; +} + +void +IceProxy::RoboCompGenericBase::GenericBase::end_getBasePose(::Ice::Int& iceP_x, ::Ice::Int& iceP_z, ::Ice::Float& iceP_alpha, const ::Ice::AsyncResultPtr& result) +{ + ::Ice::AsyncResult::_check(result, this, iceC_RoboCompGenericBase_GenericBase_getBasePose_name); + if(!result->_waitForResponse()) + { + try + { + result->_throwUserException(); + } + catch(const ::RoboCompGenericBase::HardwareFailedException&) + { + throw; + } + catch(const ::Ice::UserException& ex) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); + } + } + ::Ice::InputStream* istr = result->_startReadParams(); + istr->read(iceP_x); + istr->read(iceP_z); + istr->read(iceP_alpha); + result->_endReadParams(); +} + +::IceProxy::Ice::Object* +IceProxy::RoboCompGenericBase::GenericBase::_newInstance() const +{ + return new GenericBase; +} + +const ::std::string& +IceProxy::RoboCompGenericBase::GenericBase::ice_staticId() +{ + return ::RoboCompGenericBase::GenericBase::ice_staticId(); +} + +RoboCompGenericBase::GenericBase::~GenericBase() +{ +} + +::Ice::Object* RoboCompGenericBase::upCast(::RoboCompGenericBase::GenericBase* p) { return p; } + + +namespace +{ +const ::std::string iceC_RoboCompGenericBase_GenericBase_ids[2] = +{ + "::Ice::Object", + "::RoboCompGenericBase::GenericBase" +}; + +} + +bool +RoboCompGenericBase::GenericBase::ice_isA(const ::std::string& s, const ::Ice::Current&) const +{ + return ::std::binary_search(iceC_RoboCompGenericBase_GenericBase_ids, iceC_RoboCompGenericBase_GenericBase_ids + 2, s); +} + +::std::vector< ::std::string> +RoboCompGenericBase::GenericBase::ice_ids(const ::Ice::Current&) const +{ + return ::std::vector< ::std::string>(&iceC_RoboCompGenericBase_GenericBase_ids[0], &iceC_RoboCompGenericBase_GenericBase_ids[2]); +} + +const ::std::string& +RoboCompGenericBase::GenericBase::ice_id(const ::Ice::Current&) const +{ + return ice_staticId(); +} + +const ::std::string& +RoboCompGenericBase::GenericBase::ice_staticId() +{ +#ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC + static const ::std::string typeId = "::RoboCompGenericBase::GenericBase"; + return typeId; +#else + return iceC_RoboCompGenericBase_GenericBase_ids[1]; +#endif +} + +bool +RoboCompGenericBase::GenericBase::_iceD_getBaseState(::IceInternal::Incoming& inS, const ::Ice::Current& current) +{ + _iceCheckMode(::Ice::Normal, current.mode); + inS.readEmptyParams(); + ::RoboCompGenericBase::TBaseState iceP_state; + this->getBaseState(iceP_state, current); + ::Ice::OutputStream* ostr = inS.startWriteParams(); + ostr->write(iceP_state); + inS.endWriteParams(); + return true; +} + +bool +RoboCompGenericBase::GenericBase::_iceD_getBasePose(::IceInternal::Incoming& inS, const ::Ice::Current& current) +{ + _iceCheckMode(::Ice::Normal, current.mode); + inS.readEmptyParams(); + ::Ice::Int iceP_x; + ::Ice::Int iceP_z; + ::Ice::Float iceP_alpha; + this->getBasePose(iceP_x, iceP_z, iceP_alpha, current); + ::Ice::OutputStream* ostr = inS.startWriteParams(); + ostr->write(iceP_x); + ostr->write(iceP_z); + ostr->write(iceP_alpha); + inS.endWriteParams(); + return true; +} + +namespace +{ +const ::std::string iceC_RoboCompGenericBase_GenericBase_all[] = +{ + "getBasePose", + "getBaseState", + "ice_id", + "ice_ids", + "ice_isA", + "ice_ping" +}; + +} + +bool +RoboCompGenericBase::GenericBase::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) +{ + ::std::pair r = ::std::equal_range(iceC_RoboCompGenericBase_GenericBase_all, iceC_RoboCompGenericBase_GenericBase_all + 6, current.operation); + if(r.first == r.second) + { + throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); + } + + switch(r.first - iceC_RoboCompGenericBase_GenericBase_all) + { + case 0: + { + return _iceD_getBasePose(in, current); + } + case 1: + { + return _iceD_getBaseState(in, current); + } + case 2: + { + return _iceD_ice_id(in, current); + } + case 3: + { + return _iceD_ice_ids(in, current); + } + case 4: + { + return _iceD_ice_isA(in, current); + } + case 5: + { + return _iceD_ice_ping(in, current); + } + default: + { + assert(false); + throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); + } + } +} + +void +RoboCompGenericBase::GenericBase::_iceWriteImpl(::Ice::OutputStream* ostr) const +{ + ostr->startSlice(ice_staticId(), -1, true); + Ice::StreamWriter< ::RoboCompGenericBase::GenericBase, ::Ice::OutputStream>::write(ostr, *this); + ostr->endSlice(); +} + +void +RoboCompGenericBase::GenericBase::_iceReadImpl(::Ice::InputStream* istr) +{ + istr->startSlice(); + Ice::StreamReader< ::RoboCompGenericBase::GenericBase, ::Ice::InputStream>::read(istr, *this); + istr->endSlice(); +} + +void +RoboCompGenericBase::_icePatchObjectPtr(GenericBasePtr& handle, const ::Ice::ObjectPtr& v) +{ + handle = ::RoboCompGenericBase::GenericBasePtr::dynamicCast(v); + if(v && !handle) + { + IceInternal::Ex::throwUOE(::RoboCompGenericBase::GenericBase::ice_staticId(), v); + } +} + +namespace Ice +{ +} + +#endif diff --git a/components/hokuyoComp/src/GenericBase.h b/components/hokuyoComp/src/GenericBase.h new file mode 100644 index 00000000..2ba44325 --- /dev/null +++ b/components/hokuyoComp/src/GenericBase.h @@ -0,0 +1,936 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** +// +// Ice version 3.7.0 +// +// +// +// Generated from file `GenericBase.ice' +// +// Warning: do not edit this file. +// +// +// + +#ifndef __GenericBase_h__ +#define __GenericBase_h__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef ICE_IGNORE_VERSION +# if ICE_INT_VERSION / 100 != 307 +# error Ice version mismatch! +# endif +# if ICE_INT_VERSION % 100 > 50 +# error Beta header file detected +# endif +# if ICE_INT_VERSION % 100 < 0 +# error Ice patch level mismatch! +# endif +#endif + +#ifdef ICE_CPP11_MAPPING // C++11 mapping + +namespace RoboCompGenericBase +{ + +class GenericBase; +class GenericBasePrx; + +} + +namespace RoboCompGenericBase +{ + +class HardwareFailedException : public ::Ice::UserExceptionHelper +{ +public: + + virtual ~HardwareFailedException(); + + HardwareFailedException(const HardwareFailedException&) = default; + + HardwareFailedException() = default; + + HardwareFailedException(const ::std::string& iceP_what) : + what(::std::move(iceP_what)) + { + } + + std::tuple ice_tuple() const + { + return std::tie(what); + } + + static const ::std::string& ice_staticId(); + + ::std::string what; +}; + +static HardwareFailedException _iceS_HardwareFailedException_init; + +struct TBaseState +{ + bool isMoving; + float x; + float z; + float alpha; + float correctedX; + float correctedZ; + float correctedAlpha; + float advVx; + float advVz; + float rotV; + + std::tuple ice_tuple() const + { + return std::tie(isMoving, x, z, alpha, correctedX, correctedZ, correctedAlpha, advVx, advVz, rotV); + } +}; + +using Ice::operator<; +using Ice::operator<=; +using Ice::operator>; +using Ice::operator>=; +using Ice::operator==; +using Ice::operator!=; + +} + +namespace RoboCompGenericBase +{ + +class GenericBase : public virtual ::Ice::Object +{ +public: + + using ProxyType = GenericBasePrx; + + virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; + virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; + virtual ::std::string ice_id(const ::Ice::Current&) const override; + + static const ::std::string& ice_staticId(); + + virtual void getBaseState(::RoboCompGenericBase::TBaseState&, const ::Ice::Current&) = 0; + bool _iceD_getBaseState(::IceInternal::Incoming&, const ::Ice::Current&); + + struct GetBasePoseResult + { + int x; + int z; + float alpha; + }; + + virtual void getBasePose(int&, int&, float&, const ::Ice::Current&) = 0; + bool _iceD_getBasePose(::IceInternal::Incoming&, const ::Ice::Current&); + + virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; +}; + +} + +namespace RoboCompGenericBase +{ + +class GenericBasePrx : public virtual ::Ice::Proxy +{ +public: + + void getBaseState(::RoboCompGenericBase::TBaseState& iceP_state, const ::Ice::Context& context = Ice::noExplicitContext) + { + iceP_state = _makePromiseOutgoing<::RoboCompGenericBase::TBaseState>(true, this, &RoboCompGenericBase::GenericBasePrx::_iceI_getBaseState, context).get(); + } + + template class P = ::std::promise> + auto getBaseStateAsync(const ::Ice::Context& context = Ice::noExplicitContext) + -> decltype(::std::declval>().get_future()) + { + return _makePromiseOutgoing<::RoboCompGenericBase::TBaseState, P>(false, this, &RoboCompGenericBase::GenericBasePrx::_iceI_getBaseState, context); + } + + ::std::function + getBaseStateAsync(::std::function response, + ::std::function ex = nullptr, + ::std::function sent = nullptr, + const ::Ice::Context& context = Ice::noExplicitContext) + { + return _makeLamdaOutgoing<::RoboCompGenericBase::TBaseState>(response, ex, sent, this, &RoboCompGenericBase::GenericBasePrx::_iceI_getBaseState, context); + } + + void _iceI_getBaseState(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::RoboCompGenericBase::TBaseState>>&, const ::Ice::Context&); + + void getBasePose(int& iceP_x, int& iceP_z, float& iceP_alpha, const ::Ice::Context& context = Ice::noExplicitContext) + { + auto result = _makePromiseOutgoing<::RoboCompGenericBase::GenericBase::GetBasePoseResult>(true, this, &RoboCompGenericBase::GenericBasePrx::_iceI_getBasePose, context).get(); + iceP_x = result.x; + iceP_z = result.z; + iceP_alpha = result.alpha; + } + + template class P = ::std::promise> + auto getBasePoseAsync(const ::Ice::Context& context = Ice::noExplicitContext) + -> decltype(::std::declval>().get_future()) + { + return _makePromiseOutgoing<::RoboCompGenericBase::GenericBase::GetBasePoseResult, P>(false, this, &RoboCompGenericBase::GenericBasePrx::_iceI_getBasePose, context); + } + + ::std::function + getBasePoseAsync(::std::function response, + ::std::function ex = nullptr, + ::std::function sent = nullptr, + const ::Ice::Context& context = Ice::noExplicitContext) + { + auto responseCb = [response](::RoboCompGenericBase::GenericBase::GetBasePoseResult&& result) + { + response(result.x, result.z, result.alpha); + }; + return _makeLamdaOutgoing<::RoboCompGenericBase::GenericBase::GetBasePoseResult>(responseCb, ex, sent, this, &RoboCompGenericBase::GenericBasePrx::_iceI_getBasePose, context); + } + + void _iceI_getBasePose(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::RoboCompGenericBase::GenericBase::GetBasePoseResult>>&, const ::Ice::Context&); + + static const ::std::string& ice_staticId(); + +protected: + + GenericBasePrx() = default; + friend ::std::shared_ptr IceInternal::createProxy(); + + virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; +}; + +} + +namespace Ice +{ + +template +struct StreamReader<::RoboCompGenericBase::HardwareFailedException, S> +{ + static void read(S* istr, ::RoboCompGenericBase::HardwareFailedException& v) + { + istr->readAll(v.what); + } +}; + +template<> +struct StreamableTraits<::RoboCompGenericBase::TBaseState> +{ + static const StreamHelperCategory helper = StreamHelperCategoryStruct; + static const int minWireSize = 37; + static const bool fixedLength = true; +}; + +template +struct StreamReader<::RoboCompGenericBase::TBaseState, S> +{ + static void read(S* istr, ::RoboCompGenericBase::TBaseState& v) + { + istr->readAll(v.isMoving, v.x, v.z, v.alpha, v.correctedX, v.correctedZ, v.correctedAlpha, v.advVx, v.advVz, v.rotV); + } +}; + +} + +namespace RoboCompGenericBase +{ + +using GenericBasePtr = ::std::shared_ptr; +using GenericBasePrxPtr = ::std::shared_ptr; + +} + +#else // C++98 mapping + +namespace IceProxy +{ + +namespace RoboCompGenericBase +{ + +class GenericBase; +void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::RoboCompGenericBase::GenericBase>&); +::IceProxy::Ice::Object* upCast(::IceProxy::RoboCompGenericBase::GenericBase*); + +} + +} + +namespace RoboCompGenericBase +{ + +class GenericBase; +::Ice::Object* upCast(::RoboCompGenericBase::GenericBase*); +typedef ::IceInternal::Handle< ::RoboCompGenericBase::GenericBase> GenericBasePtr; +typedef ::IceInternal::ProxyHandle< ::IceProxy::RoboCompGenericBase::GenericBase> GenericBasePrx; +typedef GenericBasePrx GenericBasePrxPtr; +void _icePatchObjectPtr(GenericBasePtr&, const ::Ice::ObjectPtr&); + +} + +namespace RoboCompGenericBase +{ + +class HardwareFailedException : public ::Ice::UserException +{ +public: + + HardwareFailedException() {} + explicit HardwareFailedException(const ::std::string&); + virtual ~HardwareFailedException() throw(); + + virtual ::std::string ice_id() const; + virtual HardwareFailedException* ice_clone() const; + virtual void ice_throw() const; + + ::std::string what; + +protected: + + virtual void _writeImpl(::Ice::OutputStream*) const; + virtual void _readImpl(::Ice::InputStream*); +}; + +static HardwareFailedException _iceS_HardwareFailedException_init; + +struct TBaseState +{ + bool isMoving; + ::Ice::Float x; + ::Ice::Float z; + ::Ice::Float alpha; + ::Ice::Float correctedX; + ::Ice::Float correctedZ; + ::Ice::Float correctedAlpha; + ::Ice::Float advVx; + ::Ice::Float advVz; + ::Ice::Float rotV; + + bool operator==(const TBaseState& rhs_) const + { + if(this == &rhs_) + { + return true; + } + if(isMoving != rhs_.isMoving) + { + return false; + } + if(x != rhs_.x) + { + return false; + } + if(z != rhs_.z) + { + return false; + } + if(alpha != rhs_.alpha) + { + return false; + } + if(correctedX != rhs_.correctedX) + { + return false; + } + if(correctedZ != rhs_.correctedZ) + { + return false; + } + if(correctedAlpha != rhs_.correctedAlpha) + { + return false; + } + if(advVx != rhs_.advVx) + { + return false; + } + if(advVz != rhs_.advVz) + { + return false; + } + if(rotV != rhs_.rotV) + { + return false; + } + return true; + } + + bool operator<(const TBaseState& rhs_) const + { + if(this == &rhs_) + { + return false; + } + if(isMoving < rhs_.isMoving) + { + return true; + } + else if(rhs_.isMoving < isMoving) + { + return false; + } + if(x < rhs_.x) + { + return true; + } + else if(rhs_.x < x) + { + return false; + } + if(z < rhs_.z) + { + return true; + } + else if(rhs_.z < z) + { + return false; + } + if(alpha < rhs_.alpha) + { + return true; + } + else if(rhs_.alpha < alpha) + { + return false; + } + if(correctedX < rhs_.correctedX) + { + return true; + } + else if(rhs_.correctedX < correctedX) + { + return false; + } + if(correctedZ < rhs_.correctedZ) + { + return true; + } + else if(rhs_.correctedZ < correctedZ) + { + return false; + } + if(correctedAlpha < rhs_.correctedAlpha) + { + return true; + } + else if(rhs_.correctedAlpha < correctedAlpha) + { + return false; + } + if(advVx < rhs_.advVx) + { + return true; + } + else if(rhs_.advVx < advVx) + { + return false; + } + if(advVz < rhs_.advVz) + { + return true; + } + else if(rhs_.advVz < advVz) + { + return false; + } + if(rotV < rhs_.rotV) + { + return true; + } + else if(rhs_.rotV < rotV) + { + return false; + } + return false; + } + + bool operator!=(const TBaseState& rhs_) const + { + return !operator==(rhs_); + } + bool operator<=(const TBaseState& rhs_) const + { + return operator<(rhs_) || operator==(rhs_); + } + bool operator>(const TBaseState& rhs_) const + { + return !operator<(rhs_) && !operator==(rhs_); + } + bool operator>=(const TBaseState& rhs_) const + { + return !operator<(rhs_); + } +}; + +} + +namespace RoboCompGenericBase +{ + +class Callback_GenericBase_getBaseState_Base : public virtual ::IceInternal::CallbackBase { }; +typedef ::IceUtil::Handle< Callback_GenericBase_getBaseState_Base> Callback_GenericBase_getBaseStatePtr; + +class Callback_GenericBase_getBasePose_Base : public virtual ::IceInternal::CallbackBase { }; +typedef ::IceUtil::Handle< Callback_GenericBase_getBasePose_Base> Callback_GenericBase_getBasePosePtr; + +} + +namespace IceProxy +{ + +namespace RoboCompGenericBase +{ + +class GenericBase : public virtual ::Ice::Proxy +{ +public: + + void getBaseState(::RoboCompGenericBase::TBaseState& iceP_state, const ::Ice::Context& context = ::Ice::noExplicitContext) + { + end_getBaseState(iceP_state, _iceI_begin_getBaseState(context, ::IceInternal::dummyCallback, 0, true)); + } + + ::Ice::AsyncResultPtr begin_getBaseState(const ::Ice::Context& context = ::Ice::noExplicitContext) + { + return _iceI_begin_getBaseState(context, ::IceInternal::dummyCallback, 0); + } + + ::Ice::AsyncResultPtr begin_getBaseState(const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBaseState(::Ice::noExplicitContext, del, cookie); + } + + ::Ice::AsyncResultPtr begin_getBaseState(const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBaseState(context, del, cookie); + } + + ::Ice::AsyncResultPtr begin_getBaseState(const ::RoboCompGenericBase::Callback_GenericBase_getBaseStatePtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBaseState(::Ice::noExplicitContext, del, cookie); + } + + ::Ice::AsyncResultPtr begin_getBaseState(const ::Ice::Context& context, const ::RoboCompGenericBase::Callback_GenericBase_getBaseStatePtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBaseState(context, del, cookie); + } + + void end_getBaseState(::RoboCompGenericBase::TBaseState& iceP_state, const ::Ice::AsyncResultPtr&); + +private: + + ::Ice::AsyncResultPtr _iceI_begin_getBaseState(const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); + +public: + + void getBasePose(::Ice::Int& iceP_x, ::Ice::Int& iceP_z, ::Ice::Float& iceP_alpha, const ::Ice::Context& context = ::Ice::noExplicitContext) + { + end_getBasePose(iceP_x, iceP_z, iceP_alpha, _iceI_begin_getBasePose(context, ::IceInternal::dummyCallback, 0, true)); + } + + ::Ice::AsyncResultPtr begin_getBasePose(const ::Ice::Context& context = ::Ice::noExplicitContext) + { + return _iceI_begin_getBasePose(context, ::IceInternal::dummyCallback, 0); + } + + ::Ice::AsyncResultPtr begin_getBasePose(const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBasePose(::Ice::noExplicitContext, del, cookie); + } + + ::Ice::AsyncResultPtr begin_getBasePose(const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBasePose(context, del, cookie); + } + + ::Ice::AsyncResultPtr begin_getBasePose(const ::RoboCompGenericBase::Callback_GenericBase_getBasePosePtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBasePose(::Ice::noExplicitContext, del, cookie); + } + + ::Ice::AsyncResultPtr begin_getBasePose(const ::Ice::Context& context, const ::RoboCompGenericBase::Callback_GenericBase_getBasePosePtr& del, const ::Ice::LocalObjectPtr& cookie = 0) + { + return _iceI_begin_getBasePose(context, del, cookie); + } + + void end_getBasePose(::Ice::Int& iceP_x, ::Ice::Int& iceP_z, ::Ice::Float& iceP_alpha, const ::Ice::AsyncResultPtr&); + +private: + + ::Ice::AsyncResultPtr _iceI_begin_getBasePose(const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); + +public: + + static const ::std::string& ice_staticId(); + +protected: + + virtual ::IceProxy::Ice::Object* _newInstance() const; +}; + +} + +} + +namespace RoboCompGenericBase +{ + +class GenericBase : public virtual ::Ice::Object +{ +public: + + typedef GenericBasePrx ProxyType; + typedef GenericBasePtr PointerType; + + virtual ~GenericBase(); + + virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; + virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; + virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; + + static const ::std::string& ice_staticId(); + + virtual void getBaseState(::RoboCompGenericBase::TBaseState&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; + bool _iceD_getBaseState(::IceInternal::Incoming&, const ::Ice::Current&); + + virtual void getBasePose(::Ice::Int&, ::Ice::Int&, ::Ice::Float&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; + bool _iceD_getBasePose(::IceInternal::Incoming&, const ::Ice::Current&); + + virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); + +protected: + + virtual void _iceWriteImpl(::Ice::OutputStream*) const; + virtual void _iceReadImpl(::Ice::InputStream*); +}; + +inline bool operator==(const GenericBase& lhs, const GenericBase& rhs) +{ + return static_cast(lhs) == static_cast(rhs); +} + +inline bool operator<(const GenericBase& lhs, const GenericBase& rhs) +{ + return static_cast(lhs) < static_cast(rhs); +} + +} + +namespace Ice +{ + +template<> +struct StreamableTraits< ::RoboCompGenericBase::HardwareFailedException> +{ + static const StreamHelperCategory helper = StreamHelperCategoryUserException; +}; + +template +struct StreamWriter< ::RoboCompGenericBase::HardwareFailedException, S> +{ + static void write(S* ostr, const ::RoboCompGenericBase::HardwareFailedException& v) + { + ostr->write(v.what); + } +}; + +template +struct StreamReader< ::RoboCompGenericBase::HardwareFailedException, S> +{ + static void read(S* istr, ::RoboCompGenericBase::HardwareFailedException& v) + { + istr->read(v.what); + } +}; + +template<> +struct StreamableTraits< ::RoboCompGenericBase::TBaseState> +{ + static const StreamHelperCategory helper = StreamHelperCategoryStruct; + static const int minWireSize = 37; + static const bool fixedLength = true; +}; + +template +struct StreamWriter< ::RoboCompGenericBase::TBaseState, S> +{ + static void write(S* ostr, const ::RoboCompGenericBase::TBaseState& v) + { + ostr->write(v.isMoving); + ostr->write(v.x); + ostr->write(v.z); + ostr->write(v.alpha); + ostr->write(v.correctedX); + ostr->write(v.correctedZ); + ostr->write(v.correctedAlpha); + ostr->write(v.advVx); + ostr->write(v.advVz); + ostr->write(v.rotV); + } +}; + +template +struct StreamReader< ::RoboCompGenericBase::TBaseState, S> +{ + static void read(S* istr, ::RoboCompGenericBase::TBaseState& v) + { + istr->read(v.isMoving); + istr->read(v.x); + istr->read(v.z); + istr->read(v.alpha); + istr->read(v.correctedX); + istr->read(v.correctedZ); + istr->read(v.correctedAlpha); + istr->read(v.advVx); + istr->read(v.advVz); + istr->read(v.rotV); + } +}; + +} + +namespace RoboCompGenericBase +{ + +template +class CallbackNC_GenericBase_getBaseState : public Callback_GenericBase_getBaseState_Base, public ::IceInternal::TwowayCallbackNC +{ +public: + + typedef IceUtil::Handle TPtr; + + typedef void (T::*Exception)(const ::Ice::Exception&); + typedef void (T::*Sent)(bool); + typedef void (T::*Response)(const ::RoboCompGenericBase::TBaseState&); + + CallbackNC_GenericBase_getBaseState(const TPtr& obj, Response cb, Exception excb, Sent sentcb) + : ::IceInternal::TwowayCallbackNC(obj, cb != 0, excb, sentcb), _response(cb) + { + } + + virtual void completed(const ::Ice::AsyncResultPtr& result) const + { + ::RoboCompGenericBase::GenericBasePrx proxy = ::RoboCompGenericBase::GenericBasePrx::uncheckedCast(result->getProxy()); + ::RoboCompGenericBase::TBaseState iceP_state; + try + { + proxy->end_getBaseState(iceP_state, result); + } + catch(const ::Ice::Exception& ex) + { + ::IceInternal::CallbackNC::exception(result, ex); + return; + } + if(_response) + { + (::IceInternal::CallbackNC::_callback.get()->*_response)(iceP_state); + } + } + +private: + + Response _response; +}; + +template Callback_GenericBase_getBaseStatePtr +newCallback_GenericBase_getBaseState(const IceUtil::Handle& instance, void (T::*cb)(const ::RoboCompGenericBase::TBaseState&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_GenericBase_getBaseState(instance, cb, excb, sentcb); +} + +template Callback_GenericBase_getBaseStatePtr +newCallback_GenericBase_getBaseState(T* instance, void (T::*cb)(const ::RoboCompGenericBase::TBaseState&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_GenericBase_getBaseState(instance, cb, excb, sentcb); +} + +template +class Callback_GenericBase_getBaseState : public Callback_GenericBase_getBaseState_Base, public ::IceInternal::TwowayCallback +{ +public: + + typedef IceUtil::Handle TPtr; + + typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); + typedef void (T::*Sent)(bool , const CT&); + typedef void (T::*Response)(const ::RoboCompGenericBase::TBaseState&, const CT&); + + Callback_GenericBase_getBaseState(const TPtr& obj, Response cb, Exception excb, Sent sentcb) + : ::IceInternal::TwowayCallback(obj, cb != 0, excb, sentcb), _response(cb) + { + } + + virtual void completed(const ::Ice::AsyncResultPtr& result) const + { + ::RoboCompGenericBase::GenericBasePrx proxy = ::RoboCompGenericBase::GenericBasePrx::uncheckedCast(result->getProxy()); + ::RoboCompGenericBase::TBaseState iceP_state; + try + { + proxy->end_getBaseState(iceP_state, result); + } + catch(const ::Ice::Exception& ex) + { + ::IceInternal::Callback::exception(result, ex); + return; + } + if(_response) + { + (::IceInternal::Callback::_callback.get()->*_response)(iceP_state, CT::dynamicCast(result->getCookie())); + } + } + +private: + + Response _response; +}; + +template Callback_GenericBase_getBaseStatePtr +newCallback_GenericBase_getBaseState(const IceUtil::Handle& instance, void (T::*cb)(const ::RoboCompGenericBase::TBaseState&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_GenericBase_getBaseState(instance, cb, excb, sentcb); +} + +template Callback_GenericBase_getBaseStatePtr +newCallback_GenericBase_getBaseState(T* instance, void (T::*cb)(const ::RoboCompGenericBase::TBaseState&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_GenericBase_getBaseState(instance, cb, excb, sentcb); +} + +template +class CallbackNC_GenericBase_getBasePose : public Callback_GenericBase_getBasePose_Base, public ::IceInternal::TwowayCallbackNC +{ +public: + + typedef IceUtil::Handle TPtr; + + typedef void (T::*Exception)(const ::Ice::Exception&); + typedef void (T::*Sent)(bool); + typedef void (T::*Response)(::Ice::Int, ::Ice::Int, ::Ice::Float); + + CallbackNC_GenericBase_getBasePose(const TPtr& obj, Response cb, Exception excb, Sent sentcb) + : ::IceInternal::TwowayCallbackNC(obj, cb != 0, excb, sentcb), _response(cb) + { + } + + virtual void completed(const ::Ice::AsyncResultPtr& result) const + { + ::RoboCompGenericBase::GenericBasePrx proxy = ::RoboCompGenericBase::GenericBasePrx::uncheckedCast(result->getProxy()); + ::Ice::Int iceP_x; + ::Ice::Int iceP_z; + ::Ice::Float iceP_alpha; + try + { + proxy->end_getBasePose(iceP_x, iceP_z, iceP_alpha, result); + } + catch(const ::Ice::Exception& ex) + { + ::IceInternal::CallbackNC::exception(result, ex); + return; + } + if(_response) + { + (::IceInternal::CallbackNC::_callback.get()->*_response)(iceP_x, iceP_z, iceP_alpha); + } + } + +private: + + Response _response; +}; + +template Callback_GenericBase_getBasePosePtr +newCallback_GenericBase_getBasePose(const IceUtil::Handle& instance, void (T::*cb)(::Ice::Int, ::Ice::Int, ::Ice::Float), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_GenericBase_getBasePose(instance, cb, excb, sentcb); +} + +template Callback_GenericBase_getBasePosePtr +newCallback_GenericBase_getBasePose(T* instance, void (T::*cb)(::Ice::Int, ::Ice::Int, ::Ice::Float), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_GenericBase_getBasePose(instance, cb, excb, sentcb); +} + +template +class Callback_GenericBase_getBasePose : public Callback_GenericBase_getBasePose_Base, public ::IceInternal::TwowayCallback +{ +public: + + typedef IceUtil::Handle TPtr; + + typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); + typedef void (T::*Sent)(bool , const CT&); + typedef void (T::*Response)(::Ice::Int, ::Ice::Int, ::Ice::Float, const CT&); + + Callback_GenericBase_getBasePose(const TPtr& obj, Response cb, Exception excb, Sent sentcb) + : ::IceInternal::TwowayCallback(obj, cb != 0, excb, sentcb), _response(cb) + { + } + + virtual void completed(const ::Ice::AsyncResultPtr& result) const + { + ::RoboCompGenericBase::GenericBasePrx proxy = ::RoboCompGenericBase::GenericBasePrx::uncheckedCast(result->getProxy()); + ::Ice::Int iceP_x; + ::Ice::Int iceP_z; + ::Ice::Float iceP_alpha; + try + { + proxy->end_getBasePose(iceP_x, iceP_z, iceP_alpha, result); + } + catch(const ::Ice::Exception& ex) + { + ::IceInternal::Callback::exception(result, ex); + return; + } + if(_response) + { + (::IceInternal::Callback::_callback.get()->*_response)(iceP_x, iceP_z, iceP_alpha, CT::dynamicCast(result->getCookie())); + } + } + +private: + + Response _response; +}; + +template Callback_GenericBase_getBasePosePtr +newCallback_GenericBase_getBasePose(const IceUtil::Handle& instance, void (T::*cb)(::Ice::Int, ::Ice::Int, ::Ice::Float, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_GenericBase_getBasePose(instance, cb, excb, sentcb); +} + +template Callback_GenericBase_getBasePosePtr +newCallback_GenericBase_getBasePose(T* instance, void (T::*cb)(::Ice::Int, ::Ice::Int, ::Ice::Float, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_GenericBase_getBasePose(instance, cb, excb, sentcb); +} + +} + +#endif + +#include +#endif diff --git a/components/hokuyoComp/src/generichandler.h b/components/hokuyoComp/src/generichandler.h index aeda504d..17f3b6a0 100644 --- a/components/hokuyoComp/src/generichandler.h +++ b/components/hokuyoComp/src/generichandler.h @@ -55,19 +55,15 @@ Q_OBJECT private: virtual void run() = 0; virtual bool readLaserData() = 0; - + public slots: RoboCompGenericBase::TBaseState getBaseState() { RoboCompGenericBase::TBaseState b; - try{ - base->getBaseState(b); - } - catch(Ice::Exception e) - { - rError("Error talking to differentialRobot"); - } + + base->getBaseState(b); + printf("seguimos...\n"); return b; } From 372a52cb1b78bcec89cf16f5b3325a52e6772742 Mon Sep 17 00:00:00 2001 From: anindex Date: Tue, 18 Jun 2019 21:01:54 +0200 Subject: [PATCH 2/5] Update hokuyoComp doc --- components/hokuyoComp/README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/components/hokuyoComp/README.md b/components/hokuyoComp/README.md index bdfc9b23..789b4350 100644 --- a/components/hokuyoComp/README.md +++ b/components/hokuyoComp/README.md @@ -2,7 +2,8 @@ # hokuyo Hokuyo laser sensor family is a low-cost laser sensor applied in many areas in robotics research such as navigation, etc. It provides range data in short distance from 0.4~5 meters for basic localization or SLAM task in small indoor environment. -The hokuyoComp component provides a wrapper for accessing data from [Hokuyo urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and publish the laser data over RoboComp environment using Ice middleware framework. + +The hokuyoComp component provides a wrapper for accessing data from [Hokuyo c_urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and publish the laser data over RoboComp environment using Ice middleware framework. The component uses `Laser.idsl` interface. ## Resolve dependencies This section assumes user already installed RoboComp core library and pull Robolab's components according to this [README guide](https://github.com/robocomp/robocomp). @@ -10,12 +11,15 @@ This section assumes user already installed RoboComp core library and pull Robol Before compiling the component, we must first resolve its dependencies which are the Hokuyo driver packages: **For Ubuntu 14.04 Trusty Tahr** + ``` sudo apt-get install -y liburg0-dev ``` **For Ubuntu 16.04 Xenial Xerus onward** + Because `liburg0-dev` package does not exist in official PPA from Ubuntu 16.04 onward, we should download deb package directly from Trusty repo and install it by `dpkg`. + ``` sudo apt install -y libc6 libgcc1 libsdl-net1.2 libstdc++6 libsdl1.2debian cd ~/Downloads @@ -71,22 +75,14 @@ Ice.ACM.Client=10 Ice.ACM.Server=10 ``` -Note that the `Laser.Driver` and `Laser.Device` param can be different depended on your Hokuyo device name and current port that the sensor is connected to. For checking every USB ports that haveRoboCompGenericBase::TBaseState getBaseState() - { - RoboCompGenericBase::TBaseState b; - - base->getBaseState(b); - - printf("seguimos...\n"); - return b; - } been connected: +Note that the `Laser.Driver` and `Laser.Device` param can be different depended on your Hokuyo device name and current port that the sensor is connected to. For checking every USB ports that have been connected: ``` ls /dev/ttyACM* ``` Then find the corresponding port that Hokuyo sensor is connected to. ## Starting the component -After editing config file for matching with Hokuyo device name and desired parameters of your laser sensor, we plug the Hokuyo sensor in and start the component using these commands: +After editing config file for matching with Hokuyo device name and desired parameters of your laser sensor, we plug the Hokuyo sensor in any USB port and start the component using these commands: ``` ./bin/hokuyo --Ice.Config=config From 2d77c5a0e12d52227d542ce3baeb483b4b25cff0 Mon Sep 17 00:00:00 2001 From: anindex Date: Tue, 18 Jun 2019 21:04:01 +0200 Subject: [PATCH 3/5] Update hokuyoComp doc --- components/hokuyoComp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hokuyoComp/README.md b/components/hokuyoComp/README.md index 789b4350..77580ffa 100644 --- a/components/hokuyoComp/README.md +++ b/components/hokuyoComp/README.md @@ -96,7 +96,7 @@ In member function 'RoboCompGenericBase::TBaseState GenericLaserHandler getBaseS error: cannot declare catch parameter to be abstract class type 'IceUtil::Exception' catch(IceUtil::Exception e) ``` -The simple workaround is bypassing the try-catch structure and just execute: +The simple workaround is bypassing the try-catch structure in function `RoboCompGenericBase::TBaseState getBaseState()`: ```c++ RoboCompGenericBase::TBaseState getBaseState() From 42feba50c41565a6dd92f9eb1439899c331475a7 Mon Sep 17 00:00:00 2001 From: anindex Date: Sun, 1 Sep 2019 15:59:19 +0200 Subject: [PATCH 4/5] Revise hokuyoComp doc --- components/hokuyoComp/README.md | 34 +++------------------------------ 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/components/hokuyoComp/README.md b/components/hokuyoComp/README.md index 77580ffa..edd7607d 100644 --- a/components/hokuyoComp/README.md +++ b/components/hokuyoComp/README.md @@ -3,7 +3,7 @@ Hokuyo laser sensor family is a low-cost laser sensor applied in many areas in robotics research such as navigation, etc. It provides range data in short distance from 0.4~5 meters for basic localization or SLAM task in small indoor environment. -The hokuyoComp component provides a wrapper for accessing data from [Hokuyo c_urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and publish the laser data over RoboComp environment using Ice middleware framework. The component uses `Laser.idsl` interface. +The hokuyoComp component provides a wrapper for accessing data from [Hokuyo c_urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and publish the laser data over RoboComp environment using Ice middleware framework. The component uses `Laser.idsl` interface. Briefly, `Laser.idsl` interface provides method template `getLaserData()` to return laser measurements as type `TLaserData` and method `getLaserConfData()` to return specific laser configurations as type `LaserConfData`. ## Resolve dependencies This section assumes user already installed RoboComp core library and pull Robolab's components according to this [README guide](https://github.com/robocomp/robocomp). @@ -36,13 +36,7 @@ make ``` ## Configuration parameters -Unlike any other component, `hokuyoComp` is under development and has not any config file yet. However, we can copy config file from `sickLaser` due to similarity of interfaces between laser sensors. - -``` -cp ../sickLaser/etc/config config -``` - -You can then add Hokuyo specific parameters according to `constants.h` file in the component folder. Example of the config file can be described as below: +According to `Laser.idsl` interface, Hokuyo specific parameters are characterized as the config file described below: ``` CommonBehavior.Endpoints=tcp -p 10000 @@ -79,7 +73,7 @@ Note that the `Laser.Driver` and `Laser.Device` param can be different depended ``` ls /dev/ttyACM* ``` -Then find the corresponding port that Hokuyo sensor is connected to. +Then find the corresponding port that Hokuyo sensor is connected to. Regarding configuring Hokuyo hardware specific parameters, user should refer to this [link](https://devel.iri.upc.edu/docs/labrobotica/hokuyo_laser_2d/laser_specs.html). ## Starting the component After editing config file for matching with Hokuyo device name and desired parameters of your laser sensor, we plug the Hokuyo sensor in any USB port and start the component using these commands: @@ -89,25 +83,3 @@ After editing config file for matching with Hokuyo device name and desired param ``` ## Known issues - -The hokuyoComp is compiled error on Ubuntu 18.04 in file `generichandler.h` with the error: -``` -In member function 'RoboCompGenericBase::TBaseState GenericLaserHandler getBaseState()': -error: cannot declare catch parameter to be abstract class type 'IceUtil::Exception' - catch(IceUtil::Exception e) -``` -The simple workaround is bypassing the try-catch structure in function `RoboCompGenericBase::TBaseState getBaseState()`: - -```c++ -RoboCompGenericBase::TBaseState getBaseState() -{ - RoboCompGenericBase::TBaseState b; - - base->getBaseState(b); - - printf("seguimos...\n"); - return b; -} -``` - -Then the component is compiled successfully. From 07db7edc833d90d079e89392f8c6d11ce94aa5ec Mon Sep 17 00:00:00 2001 From: anindex Date: Sun, 1 Sep 2019 16:07:18 +0200 Subject: [PATCH 5/5] Revise hokuyoComp doc --- components/hokuyoComp/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/hokuyoComp/README.md b/components/hokuyoComp/README.md index edd7607d..6a8f5894 100644 --- a/components/hokuyoComp/README.md +++ b/components/hokuyoComp/README.md @@ -3,10 +3,10 @@ Hokuyo laser sensor family is a low-cost laser sensor applied in many areas in robotics research such as navigation, etc. It provides range data in short distance from 0.4~5 meters for basic localization or SLAM task in small indoor environment. -The hokuyoComp component provides a wrapper for accessing data from [Hokuyo c_urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and publish the laser data over RoboComp environment using Ice middleware framework. The component uses `Laser.idsl` interface. Briefly, `Laser.idsl` interface provides method template `getLaserData()` to return laser measurements as type `TLaserData` and method `getLaserConfData()` to return specific laser configurations as type `LaserConfData`. +The hokuyoComp component provides a wrapper for accessing data from [Hokuyo c_urg library](https://debian.pkgs.org/8/debian-main-amd64/liburg0-dev_0.8.18-2_amd64.deb.html) and serves the laser measurements over RoboComp environment using Ice middleware framework. The component uses `Laser.idsl` interface. Briefly, `Laser.idsl` interface provides method template `getLaserData()` to return laser measurements as type `TLaserData` and method `getLaserConfData()` to return specific laser configurations as type `LaserConfData`. ## Resolve dependencies -This section assumes user already installed RoboComp core library and pull Robolab's components according to this [README guide](https://github.com/robocomp/robocomp). +This section assumes user has already installed RoboComp core library and pull Robolab's components according to this [README guide](https://github.com/robocomp/robocomp). Before compiling the component, we must first resolve its dependencies which are the Hokuyo driver packages: @@ -69,11 +69,11 @@ Ice.ACM.Client=10 Ice.ACM.Server=10 ``` -Note that the `Laser.Driver` and `Laser.Device` param can be different depended on your Hokuyo device name and current port that the sensor is connected to. For checking every USB ports that have been connected: +Note that the `Laser.Driver` and `Laser.Device` parameters can be different depended on your Hokuyo device name and current port that the sensor is connected to. For checking every USB ports that have been connected: ``` ls /dev/ttyACM* ``` -Then find the corresponding port that Hokuyo sensor is connected to. Regarding configuring Hokuyo hardware specific parameters, user should refer to this [link](https://devel.iri.upc.edu/docs/labrobotica/hokuyo_laser_2d/laser_specs.html). +then user should be able to find the corresponding port that Hokuyo sensor is connected to. Regarding configuring Hokuyo hardware specific parameters, user should refer to this [link](https://devel.iri.upc.edu/docs/labrobotica/hokuyo_laser_2d/laser_specs.html). ## Starting the component After editing config file for matching with Hokuyo device name and desired parameters of your laser sensor, we plug the Hokuyo sensor in any USB port and start the component using these commands: