diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 9c9e92a58..9da8baae7 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -7,7 +7,7 @@ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C sudo apt-get update -sudo apt install -y ros-kinetic-roscpp ros-kinetic-std-msgs ros-kinetic-cv-bridge ros-kinetic-image-transport ros-kinetic-roscpp-core ros-kinetic-rospy ros-kinetic-nav-msgs ros-kinetic-geometry-msgs ros-kinetic-opencv3 ros-kinetic-kobuki-gazebo +sudo apt install -y ros-kinetic-roscpp ros-kinetic-std-msgs ros-kinetic-cv-bridge ros-kinetic-image-transport ros-kinetic-roscpp-core ros-kinetic-rospy ros-kinetic-nav-msgs ros-kinetic-geometry-msgs ros-kinetic-opencv3 ros-kinetic-kobuki-gazebo ros-kinetic-usb_cam sudo apt-get install -y libpcl-dev @@ -41,7 +41,7 @@ sudo apt-get install -y libdc1394-22 libdc1394-22-dev sudo apt-get install -y libusb-1.0-0 libusb-1.0-0-dev -sudo apt-get install -y python-matplotlib python-pyqt5 python-pip python-numpy python-pyqt5.qtsvg +sudo apt-get install -y python-matplotlib python-pyqt5 python-pip python-numpy python-pyqt5.qtsvg python-pyqt5.qsci sudo apt-get install -y qfi @@ -55,7 +55,7 @@ sudo apt install -y libzeroc-ice3.6 zeroc-ice-utils libzeroc-icestorm3.6 zeroc-i sudo apt-get install -y libssl-dev libbz2-dev sudo pip2 install --upgrade pip -sudo pip2 install zeroc-ice +sudo pip2 install zeroc-ice==3.6.4 sudo apt-get install -y libopenni2-dev libopenni-dev @@ -63,8 +63,6 @@ sudo apt-get install -y gazebo7 libgazebo7-dev sudo apt-get install -y nodejs -sudo apt install -y sophus - sudo apt-get install -y ardronelib libgoogle-glog-dev diff --git a/src/drivers/YoutubeServer/youtubeserver.yml b/src/drivers/YoutubeServer/youtubeserver.yml index 9f0a4692b..3138e66bc 100644 --- a/src/drivers/YoutubeServer/youtubeserver.yml +++ b/src/drivers/YoutubeServer/youtubeserver.yml @@ -1,6 +1,6 @@ youtubeServer: ImageSrv: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS (Not supported) + Server: Ice #Deactivate, Ice , ROS (Not supported) Proxy: "default -h 0.0.0.0 -p 9999" URL: "https://www.youtube.com/watch?v=zw47_q9wbBE" LiveBroadcast: False #True for youtube live events @@ -10,4 +10,3 @@ youtubeServer: Name: youtubeServer_py NodeName: youtubeServerCfg - diff --git a/src/drivers/gazeboserver/plugins/opel/CMakeLists.txt b/src/drivers/gazeboserver/plugins/opel/CMakeLists.txt index db19c27d6..5c5d09bf1 100644 --- a/src/drivers/gazeboserver/plugins/opel/CMakeLists.txt +++ b/src/drivers/gazeboserver/plugins/opel/CMakeLists.txt @@ -42,7 +42,7 @@ target_link_libraries(camera_dumpopel JderobotInterfaces ) -INSTALL (TARGETS opelMotors DESTINATION share/jderobot/gazebo/plugins/opel/ COMPONENT gazeboserver) +INSTALL (TARGETS opelMotors camera_dumpopel opelPose3D DESTINATION share/jderobot/gazebo/plugins/opel/ COMPONENT gazeboserver) FILE(GLOB_RECURSE CFG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cfg) INSTALL (FILES ${CFG_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/conf/ COMPONENT gazeboserver) diff --git a/src/examples/basic_component/basic_component.yml b/src/examples/basic_component/basic_component.yml index 0c473255d..b0570ee77 100644 --- a/src/examples/basic_component/basic_component.yml +++ b/src/examples/basic_component/basic_component.yml @@ -1,14 +1,14 @@ basic_component: Motors: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9001" Topic: "/turtlebotROS/mobile_base/commands/velocity" Name: basic_componentCamera maxW: 0.7 maxV: 4 - + Camera: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" @@ -17,4 +17,3 @@ basic_component: NodeName: basic_component Vmax: 5 Wmax: 0.5 - diff --git a/src/examples/basic_component_py/basic_component_py.yml b/src/examples/basic_component_py/basic_component_py.yml index 561135419..94369b82c 100644 --- a/src/examples/basic_component_py/basic_component_py.yml +++ b/src/examples/basic_component_py/basic_component_py.yml @@ -1,14 +1,14 @@ basic_component: Motors: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9001" Topic: "/turtlebotROS/mobile_base/commands/velocity" Name: basic_component_pyCamera maxW: 0.7 maxV: 4 - + Camera: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" diff --git a/src/libs/comm_cpp/CMakeLists.txt b/src/libs/comm_cpp/CMakeLists.txt index 0dabe7c67..5719923e9 100644 --- a/src/libs/comm_cpp/CMakeLists.txt +++ b/src/libs/comm_cpp/CMakeLists.txt @@ -34,6 +34,7 @@ include_directories( set(HEADERS include/jderobot/comm/communicator.hpp + include/jderobot/comm/tools.hpp include/jderobot/comm/laserClient.hpp include/jderobot/comm/interfaces/laserClient.hpp include/jderobot/comm/ice/laserIceClient.hpp @@ -65,6 +66,7 @@ set(HEADERS set(SOURCES src/communicator.cpp + src/tools.cpp src/laserClient.cpp src/ice/laserIceClient.cpp src/cameraClient.cpp diff --git a/src/libs/comm_cpp/include/jderobot/comm/ardroneextraClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/ardroneextraClient.hpp index 46a7a786e..eddd3078b 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/ardroneextraClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/ardroneextraClient.hpp @@ -22,8 +22,13 @@ #include +#include #include #include +#include +#ifdef JDERROS +//#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/bumperClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/bumperClient.hpp index c9c3227a9..11755e770 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/bumperClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/bumperClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/cameraClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/cameraClient.hpp index e87eea284..961ec0d9f 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/cameraClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/cameraClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/cmdvelClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/cmdvelClient.hpp index fd9d078dc..fb659ed05 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/cmdvelClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/cmdvelClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +//#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/communicator.hpp b/src/libs/comm_cpp/include/jderobot/comm/communicator.hpp index cd1b1a696..666301a92 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/communicator.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/communicator.hpp @@ -23,6 +23,7 @@ #include #include #include +#include namespace Comm { diff --git a/src/libs/comm_cpp/include/jderobot/comm/laserClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/laserClient.hpp index c1d8c435d..ab2d0db66 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/laserClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/laserClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/motorsClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/motorsClient.hpp index 40ccb5f0c..cfb5ed465 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/motorsClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/motorsClient.hpp @@ -22,8 +22,14 @@ #include #include +#include #include #include +#include +#include +#ifdef JDERROS +#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/navdataClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/navdataClient.hpp index ad9771f36..2d5fabcd4 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/navdataClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/navdataClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +//#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/pose3dClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/pose3dClient.hpp index 2569d4cbb..b10bb8555 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/pose3dClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/pose3dClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/rgbdClient.hpp b/src/libs/comm_cpp/include/jderobot/comm/rgbdClient.hpp index a868b77b6..0bbfda494 100644 --- a/src/libs/comm_cpp/include/jderobot/comm/rgbdClient.hpp +++ b/src/libs/comm_cpp/include/jderobot/comm/rgbdClient.hpp @@ -22,8 +22,13 @@ #include #include +#include #include #include +#include +#ifdef JDERROS +//#include +#endif diff --git a/src/libs/comm_cpp/include/jderobot/comm/tools.hpp b/src/libs/comm_cpp/include/jderobot/comm/tools.hpp new file mode 100644 index 000000000..528e0b31c --- /dev/null +++ b/src/libs/comm_cpp/include/jderobot/comm/tools.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 1997-2018 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 + */ + +#ifndef JDEROBOTCOMM_TOOLS_H +#define JDEROBOTCOMM_TOOLS_H + +#include + + +namespace Comm { + + int server2int (std::string server); + + +} //NS + +#endif // JDEROBOTCOMM_TOOLS_H \ No newline at end of file diff --git a/src/libs/comm_cpp/src/ardroneextraClient.cpp b/src/libs/comm_cpp/src/ardroneextraClient.cpp index 330c70389..a63248896 100644 --- a/src/libs/comm_cpp/src/ardroneextraClient.cpp +++ b/src/libs/comm_cpp/src/ardroneextraClient.cpp @@ -1,17 +1,16 @@ #include -#include -#ifdef JDERROS -//#include -#endif + namespace Comm { -ArDroneExtraClient* +ArDroneExtraClient* getArDroneExtraClient(Comm::Communicator* jdrc, std::string prefix){ ArDroneExtraClient* client = 0; + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); switch (server){ case 0: { diff --git a/src/libs/comm_cpp/src/bumperClient.cpp b/src/libs/comm_cpp/src/bumperClient.cpp index 090a6034d..b9699d754 100644 --- a/src/libs/comm_cpp/src/bumperClient.cpp +++ b/src/libs/comm_cpp/src/bumperClient.cpp @@ -1,16 +1,16 @@ -#include -#include -#ifdef JDERROS -#include -#endif +#include + namespace Comm { -BumperClient* +BumperClient* getBumperClient(Comm::Communicator* jdrc, std::string prefix){ BumperClient* client = 0; - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); + switch (server){ case 0: { diff --git a/src/libs/comm_cpp/src/cameraClient.cpp b/src/libs/comm_cpp/src/cameraClient.cpp index f52c57de8..15013f324 100644 --- a/src/libs/comm_cpp/src/cameraClient.cpp +++ b/src/libs/comm_cpp/src/cameraClient.cpp @@ -17,19 +17,18 @@ * Aitor Martinez Fernandez */ #include -#include -#ifdef JDERROS -#include -#endif + namespace Comm { -CameraClient* +CameraClient* getCameraClient(Comm::Communicator* jdrc, std::string prefix){ CameraClient* client = 0; + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); switch (server){ case 0: { @@ -76,4 +75,4 @@ getCameraClient(Comm::Communicator* jdrc, std::string prefix){ } -}//NS \ No newline at end of file +}//NS diff --git a/src/libs/comm_cpp/src/cmdvelClient.cpp b/src/libs/comm_cpp/src/cmdvelClient.cpp index 43943e5d6..c093ab990 100644 --- a/src/libs/comm_cpp/src/cmdvelClient.cpp +++ b/src/libs/comm_cpp/src/cmdvelClient.cpp @@ -1,17 +1,16 @@ #include -#include -#ifdef JDERROS -//#include -#endif + namespace Comm { -CMDVelClient* +CMDVelClient* getCMDVelClient(Comm::Communicator* jdrc, std::string prefix){ CMDVelClient* client = 0; + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); switch (server){ case 0: { diff --git a/src/libs/comm_cpp/src/laserClient.cpp b/src/libs/comm_cpp/src/laserClient.cpp index 71de12e20..93d6eee9d 100644 --- a/src/libs/comm_cpp/src/laserClient.cpp +++ b/src/libs/comm_cpp/src/laserClient.cpp @@ -1,16 +1,16 @@ -#include -#include -#ifdef JDERROS -#include -#endif +#include + namespace Comm { -LaserClient* +LaserClient* getLaserClient(Comm::Communicator* jdrc, std::string prefix){ LaserClient* client = 0; - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); + switch (server){ case 0: { diff --git a/src/libs/comm_cpp/src/motorsClient.cpp b/src/libs/comm_cpp/src/motorsClient.cpp index 8fc10f160..6c97400cd 100644 --- a/src/libs/comm_cpp/src/motorsClient.cpp +++ b/src/libs/comm_cpp/src/motorsClient.cpp @@ -1,17 +1,15 @@ #include -#include -#ifdef JDERROS -#include -#endif namespace Comm { -MotorsClient* +MotorsClient* getMotorsClient(Comm::Communicator* jdrc, std::string prefix){ MotorsClient* client = 0; + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); switch (server){ case 0: { diff --git a/src/libs/comm_cpp/src/navdataClient.cpp b/src/libs/comm_cpp/src/navdataClient.cpp index 65a1a6029..bcdd802f6 100644 --- a/src/libs/comm_cpp/src/navdataClient.cpp +++ b/src/libs/comm_cpp/src/navdataClient.cpp @@ -1,16 +1,17 @@ -#include -#include -#ifdef JDERROS -//#include -#endif +#include + namespace Comm { -NavdataClient* +NavdataClient* getNavdataClient(Comm::Communicator* jdrc, std::string prefix){ NavdataClient* client = 0; - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + std::transform(server_name.begin(), server_name.end(), server_name.begin(), ::tolower); + server = server2int(server_name); + switch (server){ case 0: { diff --git a/src/libs/comm_cpp/src/pose3dClient.cpp b/src/libs/comm_cpp/src/pose3dClient.cpp index 80c8d2f9b..d1f74e721 100644 --- a/src/libs/comm_cpp/src/pose3dClient.cpp +++ b/src/libs/comm_cpp/src/pose3dClient.cpp @@ -1,17 +1,17 @@ #include -#include -#ifdef JDERROS -#include -#endif + namespace Comm { -Pose3dClient* +Pose3dClient* getPose3dClient(Comm::Communicator* jdrc, std::string prefix){ Pose3dClient* client = 0; + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + std::transform(server_name.begin(), server_name.end(), server_name.begin(), ::tolower); + server = server2int(server_name); - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); switch (server){ case 0: { @@ -57,4 +57,4 @@ getPose3dClient(Comm::Communicator* jdrc, std::string prefix){ } -}//NS \ No newline at end of file +}//NS diff --git a/src/libs/comm_cpp/src/rgbdClient.cpp b/src/libs/comm_cpp/src/rgbdClient.cpp index 9c961809e..7ad2d1b8e 100644 --- a/src/libs/comm_cpp/src/rgbdClient.cpp +++ b/src/libs/comm_cpp/src/rgbdClient.cpp @@ -17,19 +17,18 @@ * Aitor Martinez Fernandez */ #include -#include -#ifdef JDERROS -//#include -#endif + namespace Comm { -RgbdClient* +RgbdClient* getRgbdClient(Comm::Communicator* jdrc, std::string prefix){ RgbdClient* client = 0; + int server; + std::string server_name = jdrc->getConfig().asString(prefix+".Server"); + server = server2int(server_name); - int server = jdrc->getConfig().asIntWithDefault(prefix+".Server", 0); switch (server){ case 0: { @@ -77,4 +76,4 @@ getRgbdClient(Comm::Communicator* jdrc, std::string prefix){ } -}//NS \ No newline at end of file +}//NS diff --git a/src/libs/comm_cpp/src/tools.cpp b/src/libs/comm_cpp/src/tools.cpp new file mode 100644 index 000000000..ed8c959bf --- /dev/null +++ b/src/libs/comm_cpp/src/tools.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 1997-2017 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 + */ +#include + +namespace Comm { + int server2int(std::string server){ + std::transform(server.begin(), server.end(), server.begin(), ::tolower); + if(server == "ice" || server == "1"){ + return 1; + } + else if(server == "ros"|| server == "2"){ + return 2; + } + else return 0; + } + +}//NS \ No newline at end of file diff --git a/src/libs/comm_py/comm/__init__.py b/src/libs/comm_py/comm/__init__.py index f14587b65..efcac4bb5 100644 --- a/src/libs/comm_py/comm/__init__.py +++ b/src/libs/comm_py/comm/__init__.py @@ -1,22 +1,24 @@ from .communicator import Communicator +from .tools import server2int + def init (config, prefix): - ''' + ''' Starts JdeRobotComm @param config: configuration of client @type config: dict ''' - return Communicator(config, prefix) + return Communicator(config, prefix) - + diff --git a/src/libs/comm_py/comm/ardroneextraClient.py.only-ice.in b/src/libs/comm_py/comm/ardroneextraClient.py.only-ice.in index f5b06fa96..7610816db 100644 --- a/src/libs/comm_py/comm/ardroneextraClient.py.only-ice.in +++ b/src/libs/comm_py/comm/ardroneextraClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.ardroneextraIceClient import ArDroneExtraIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherArDroneExtra(jdrc, prefix): @return ArDroneExtra ROS Publisher ''' - + print(prefix + ": ROS msg are diabled") return None @@ -71,9 +72,8 @@ def getArDroneExtraClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__ArDroneExtradisabled, __getArDroneExtraIceClient, __getPublisherArDroneExtra] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/ardroneextraClient.py.ros.in b/src/libs/comm_py/comm/ardroneextraClient.py.ros.in index b29238ffb..6af92b4a4 100644 --- a/src/libs/comm_py/comm/ardroneextraClient.py.ros.in +++ b/src/libs/comm_py/comm/ardroneextraClient.py.ros.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.ardroneextraIceClient import ArDroneExtraIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherArDroneExtra(jdrc, prefix): @return ArDroneExtra ROS Publisher ''' - + print(prefix + ": This Interface doesn't support ROS msg") return None @@ -71,9 +72,8 @@ def getArDroneExtraClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__ArDroneExtradisabled, __getArDroneExtraIceClient, __getPublisherArDroneExtra] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/bumperClient.py.only-ice.in b/src/libs/comm_py/comm/bumperClient.py.only-ice.in index 9947e1070..37059711f 100644 --- a/src/libs/comm_py/comm/bumperClient.py.only-ice.in +++ b/src/libs/comm_py/comm/bumperClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.bumperIceClient import BumperIceClient +from .tools import server2int def __getBumperIceClient(jdrc, prefix): @@ -66,8 +67,9 @@ def getBumperClient (jdrc, prefix): @return None if Bumper is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Bumperdisabled, __getBumperIceClient, __getListenerBumper] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/bumperClient.py.ros.in b/src/libs/comm_py/comm/bumperClient.py.ros.in index e15e7a875..731bb5698 100644 --- a/src/libs/comm_py/comm/bumperClient.py.ros.in +++ b/src/libs/comm_py/comm/bumperClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.bumperIceClient import BumperIceClient +from .tools import server2int if (sys.version_info[0] == 2): from .ros.listenerBumper import ListenerBumper @@ -75,8 +76,9 @@ def getBumperClient (jdrc, prefix): @return None if Bumper is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Bumperdisabled, __getBumperIceClient, __getListenerBumper] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/cameraClient.py.only-ice.in b/src/libs/comm_py/comm/cameraClient.py.only-ice.in index ba3082568..e1aed373d 100644 --- a/src/libs/comm_py/comm/cameraClient.py.only-ice.in +++ b/src/libs/comm_py/comm/cameraClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.cameraIceClient import CameraIceClient +from .tools import server2int def __getCameraIceClient(jdrc, prefix): ''' @@ -33,7 +34,7 @@ def __getListenerCamera(jdrc, prefix): @return Camera ROS Subscriber ''' - + print(prefix + ": ROS msg are diabled") return None @@ -66,8 +67,9 @@ def getCameraClient (jdrc, prefix): @return None if Camera is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Cameradisabled, __getCameraIceClient, __getListenerCamera] - return cons[server](jdrc, name) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/cameraClient.py.ros.in b/src/libs/comm_py/comm/cameraClient.py.ros.in index fda8a419a..5c423d91c 100644 --- a/src/libs/comm_py/comm/cameraClient.py.ros.in +++ b/src/libs/comm_py/comm/cameraClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.cameraIceClient import CameraIceClient +from .tools import server2int if (sys.version_info[0] == 2): from .ros.listenerCamera import ListenerCamera @@ -75,8 +76,9 @@ def getCameraClient (jdrc, prefix): @return None if Camera is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Cameradisabled, __getCameraIceClient, __getListenerCamera] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/cmdvelClient.py.only-ice.in b/src/libs/comm_py/comm/cmdvelClient.py.only-ice.in index e56668c21..a31a67247 100644 --- a/src/libs/comm_py/comm/cmdvelClient.py.only-ice.in +++ b/src/libs/comm_py/comm/cmdvelClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.cmdvelIceClient import CMDVelIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherCMDVel(jdrc, prefix): @return CMDVel ROS Publisher ''' - + print(prefix + ": ROS msg are diabled") return None @@ -71,9 +72,8 @@ def getCMDVelClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__CMDVeldisabled, __getCMDVelIceClient, __getPublisherCMDVel] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/cmdvelClient.py.ros.in b/src/libs/comm_py/comm/cmdvelClient.py.ros.in index 5e9be18c9..83672407f 100644 --- a/src/libs/comm_py/comm/cmdvelClient.py.ros.in +++ b/src/libs/comm_py/comm/cmdvelClient.py.ros.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.cmdvelIceClient import CMDVelIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherCMDVel(jdrc, prefix): @return CMDVel ROS Publisher ''' - + print(prefix + ": This Interface doesn't support ROS msg") return None @@ -71,9 +72,8 @@ def getCMDVelClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__CMDVeldisabled, __getCMDVelIceClient, __getPublisherCMDVel] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/communicator.py.only-ice.in b/src/libs/comm_py/comm/communicator.py.only-ice.in index d1e51662e..e0e994167 100644 --- a/src/libs/comm_py/comm/communicator.py.only-ice.in +++ b/src/libs/comm_py/comm/communicator.py.only-ice.in @@ -11,6 +11,7 @@ from .navdataClient import getNavdataClient from .cmdvelClient import getCMDVelClient from .bumperClient import getBumperClient from .sonarClient import getSonarClient +from .tools import server2int @@ -24,7 +25,7 @@ class Communicator: Communicator constructor @param config: configuration of communicator - + @type config: dict ''' @@ -37,7 +38,7 @@ class Communicator: ymlNode = self.config.getProperty(prefix) for i in ymlNode: - if type(ymlNode[i]) is dict and ymlNode[i]["Server"] == 1: + if type(ymlNode[i]) is dict and server2int(ymlNode[i]["Server"]) == 1 : iceserver = True if iceserver: @@ -60,7 +61,7 @@ class Communicator: return self.__ic def getConfig(self): - return self.config + return self.config def getCameraClient(self, name): @@ -68,7 +69,7 @@ class Communicator: Returns a Camera client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -79,7 +80,7 @@ class Communicator: Returns a Motors client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -90,7 +91,7 @@ class Communicator: Returns a PTMotors client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -101,7 +102,7 @@ class Communicator: Returns a Pose3D client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -112,7 +113,7 @@ class Communicator: Returns a Laser client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -123,7 +124,7 @@ class Communicator: Returns a RGBD client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -134,7 +135,7 @@ class Communicator: Returns a CMDVel client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -145,7 +146,7 @@ class Communicator: Returns a Navdata client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -156,7 +157,7 @@ class Communicator: Returns a ArDroneExtra client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -168,7 +169,7 @@ class Communicator: Returns a Bumper client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -179,9 +180,8 @@ class Communicator: Returns a Sonar client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' return getSonarClient(self, name) - diff --git a/src/libs/comm_py/comm/communicator.py.ros.in b/src/libs/comm_py/comm/communicator.py.ros.in index 34d24af5f..cde4dac25 100644 --- a/src/libs/comm_py/comm/communicator.py.ros.in +++ b/src/libs/comm_py/comm/communicator.py.ros.in @@ -12,6 +12,7 @@ from .cmdvelClient import getCMDVelClient from .ptMotorsClient import getPTMotorsClient from .bumperClient import getBumperClient from .sonarClient import getSonarClient +from .tools import server2int @@ -25,7 +26,7 @@ class Communicator: Communicator constructor @param config: configuration of communicator - + @type config: dict ''' @@ -38,9 +39,9 @@ class Communicator: ymlNode = self.config.getProperty(prefix) for i in ymlNode: - if type(ymlNode[i]) is dict and ymlNode[i]["Server"] == 1: + if type(ymlNode[i]) is dict and server2int(ymlNode[i]["Server"]) == 1: iceserver = True - if type(ymlNode[i]) is dict and ymlNode[i]["Server"] == 2: + if type(ymlNode[i]) is dict and server2int(ymlNode[i]["Server"]) == 2: rosserver = True if rosserver: @@ -66,8 +67,8 @@ class Communicator: def getIc(self): return self.__ic - def getConfig(self): - return self.config + def getConfig(self): + return self.config def getCameraClient(self, name): @@ -75,7 +76,7 @@ class Communicator: Returns a Camera client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -86,7 +87,7 @@ class Communicator: Returns a Motors client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -97,7 +98,7 @@ class Communicator: Returns a Pose3D client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -108,7 +109,7 @@ class Communicator: Returns a Laser client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -120,7 +121,7 @@ class Communicator: Returns a RGBD client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -131,7 +132,7 @@ class Communicator: Returns a CMDVel client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -142,7 +143,7 @@ class Communicator: Returns a Navdata client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -153,7 +154,7 @@ class Communicator: Returns a ArDroneExtra client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -164,7 +165,7 @@ class Communicator: Returns a PTMotors client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -175,7 +176,7 @@ class Communicator: Returns a Bumper client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' @@ -186,9 +187,8 @@ class Communicator: Returns a Sonar client with the configration indicated by the name @param name: name of the client in the config - + @type name: String ''' return getSonarClient(self, name) - diff --git a/src/libs/comm_py/comm/laserClient.py.only-ice.in b/src/libs/comm_py/comm/laserClient.py.only-ice.in index 83c5e3212..1f88c4689 100644 --- a/src/libs/comm_py/comm/laserClient.py.only-ice.in +++ b/src/libs/comm_py/comm/laserClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.laserIceClient import LaserIceClient +from .tools import server2int def __getLaserIceClient(jdrc, prefix): @@ -66,8 +67,9 @@ def getLaserClient (jdrc, prefix): @return None if Laser is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Laserdisabled, __getLaserIceClient, __getListenerLaser] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/laserClient.py.ros.in b/src/libs/comm_py/comm/laserClient.py.ros.in index ef6afbbd3..f7fe427bf 100644 --- a/src/libs/comm_py/comm/laserClient.py.ros.in +++ b/src/libs/comm_py/comm/laserClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.laserIceClient import LaserIceClient +from .tools import server2int if (sys.version_info[0] == 2): from .ros.listenerLaser import ListenerLaser @@ -75,8 +76,9 @@ def getLaserClient (jdrc, prefix): @return None if Laser is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Laserdisabled, __getLaserIceClient, __getListenerLaser] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/motorsClient.py.only-ice.in b/src/libs/comm_py/comm/motorsClient.py.only-ice.in index 10c5ece30..514d802af 100644 --- a/src/libs/comm_py/comm/motorsClient.py.only-ice.in +++ b/src/libs/comm_py/comm/motorsClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.motorsIceClient import MotorsIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherMotors(jdrc, prefix): @return Motors ROS Publisher ''' - + print(prefix + ": ROS msg are diabled") return None @@ -70,8 +71,9 @@ def getMotorsClient (jdrc, prefix): @return None if Motors is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Motorsdisabled, __getMotorsIceClient, __getPublisherMotors] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/motorsClient.py.ros.in b/src/libs/comm_py/comm/motorsClient.py.ros.in index 022f338bd..0eb4b7d04 100644 --- a/src/libs/comm_py/comm/motorsClient.py.ros.in +++ b/src/libs/comm_py/comm/motorsClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.motorsIceClient import MotorsIceClient +from .tools import server2int if (sys.version_info[0] == 2): from .ros.publisherMotors import PublisherMotors @@ -45,14 +46,14 @@ def __getPublisherMotors(jdrc, prefix): if not maxW: maxW = 0.5 print (prefix+".maxW not provided, the default value is used: "+ repr(maxW)) - + maxV = jdrc.getConfig().getPropertyWithDefault(prefix+".maxV", 5) if not maxV: maxV = 5 print (prefix+".maxV not provided, the default value is used: "+ repr(maxV)) - + client = PublisherMotors(topic, maxV, maxW) return client else: @@ -90,8 +91,9 @@ def getMotorsClient (jdrc, prefix): @return None if Motors is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Motorsdisabled, __getMotorsIceClient, __getPublisherMotors] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/navdataClient.py.only-ice.in b/src/libs/comm_py/comm/navdataClient.py.only-ice.in index f1be2d4c3..73d3469d7 100644 --- a/src/libs/comm_py/comm/navdataClient.py.only-ice.in +++ b/src/libs/comm_py/comm/navdataClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.navdataIceClient import NavdataIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherNavdata(jdrc, prefix): @return Navdata ROS Publisher ''' - + print(prefix + ": ROS msg are diabled") return None @@ -71,9 +72,8 @@ def getNavdataClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__Navdatadisabled, __getNavdataIceClient, __getPublisherNavdata] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/navdataClient.py.ros.in b/src/libs/comm_py/comm/navdataClient.py.ros.in index 1501e5661..c462e4d07 100644 --- a/src/libs/comm_py/comm/navdataClient.py.ros.in +++ b/src/libs/comm_py/comm/navdataClient.py.ros.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.navdataIceClient import NavdataIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherNavdata(jdrc, prefix): @return Navdata ROS Publisher ''' - + print(prefix + ": This Interface doesn't support ROS msg") return None @@ -71,9 +72,8 @@ def getNavdataClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__Navdatadisabled, __getNavdataIceClient, __getPublisherNavdata] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/pose3dClient.py.only-ice.in b/src/libs/comm_py/comm/pose3dClient.py.only-ice.in index eb3f657dc..7507ae784 100644 --- a/src/libs/comm_py/comm/pose3dClient.py.only-ice.in +++ b/src/libs/comm_py/comm/pose3dClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.pose3dIceClient import Pose3dIceClient +from .tools import server2int def __getPoseIceClient(jdrc, prefix): @@ -67,8 +68,9 @@ def getPose3dClient (jdrc, prefix): @return None if pose3d is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Posedisabled, __getPoseIceClient, __getListenerPose] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/pose3dClient.py.ros.in b/src/libs/comm_py/comm/pose3dClient.py.ros.in index 35dbc9bd4..1b37452a0 100644 --- a/src/libs/comm_py/comm/pose3dClient.py.ros.in +++ b/src/libs/comm_py/comm/pose3dClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.pose3dIceClient import Pose3dIceClient +from .tools import server2int if (sys.version_info[0] == 2): from .ros.listenerPose3d import ListenerPose3d @@ -78,8 +79,9 @@ def getPose3dClient (jdrc, prefix): @return None if pose3d is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Posedisabled, __getPoseIceClient, __getListenerPose] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/ptMotorsClient.py.only-ice.in b/src/libs/comm_py/comm/ptMotorsClient.py.only-ice.in index c06a304b5..ae73107de 100644 --- a/src/libs/comm_py/comm/ptMotorsClient.py.only-ice.in +++ b/src/libs/comm_py/comm/ptMotorsClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.ptMotorsIceClient import PTMotorsIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherPTMotors(jdrc, prefix): @return PTMotors ROS Publisher ''' - + print(prefix + ": ROS msg are diabled") return None @@ -70,8 +71,9 @@ def getPTMotorsClient (jdrc, prefix): @return None if PTMotors is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__PTMotorsdisabled, __getPTMotorsIceClient, __getPublisherPTMotors] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/ptMotorsClient.py.ros.in b/src/libs/comm_py/comm/ptMotorsClient.py.ros.in index 8ac285629..e95e47fb7 100644 --- a/src/libs/comm_py/comm/ptMotorsClient.py.ros.in +++ b/src/libs/comm_py/comm/ptMotorsClient.py.ros.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.ptMotorsIceClient import PTMotorsIceClient +from .tools import server2int @@ -35,7 +36,7 @@ def __getPublisherPTMotors(jdrc, prefix): @return PTMotors ROS Publisher ''' - + print(prefix + ": This Interface doesn't support ROS msg") return None @@ -70,8 +71,9 @@ def getPTMotorsClient (jdrc, prefix): @return None if PTMotors is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__PTMotorsdisabled, __getPTMotorsIceClient, __getPublisherPTMotors] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/rgbdClient.py.only-ice.in b/src/libs/comm_py/comm/rgbdClient.py.only-ice.in index b9b34c950..8607787b3 100644 --- a/src/libs/comm_py/comm/rgbdClient.py.only-ice.in +++ b/src/libs/comm_py/comm/rgbdClient.py.only-ice.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.rgbdIceClient import RgbdIceClient +from .tools import server2int #if (sys.version_info[0] == 2): # from .ros.listenerRgbd import ListenerRgbd @@ -69,7 +70,8 @@ def getRgbdClient (jdrc, prefix): @return None if Rgbd is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Rgbddisabled, __getRgbdIceClient, __getListenerRgbd] diff --git a/src/libs/comm_py/comm/rgbdClient.py.ros.in b/src/libs/comm_py/comm/rgbdClient.py.ros.in index 06a049efc..716a8d355 100644 --- a/src/libs/comm_py/comm/rgbdClient.py.ros.in +++ b/src/libs/comm_py/comm/rgbdClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.rgbdIceClient import RgbdIceClient +from .tools import server2int if (sys.version_info[0] == 2): from .ros.listenerRgbd import ListenerRgbd @@ -78,7 +79,8 @@ def getRgbdClient (jdrc, prefix): @return None if Rgbd is disabled ''' - server = jdrc.getConfig().getPropertyWithDefault(prefix+".Server", 0) + server = jdrc.getConfig().getProperty(prefix+".Server") + server = server2int(server) cons = [__Rgbddisabled, __getRgbdIceClient, __getListenerRgbd] diff --git a/src/libs/comm_py/comm/sonarClient.py.only-ice.in b/src/libs/comm_py/comm/sonarClient.py.only-ice.in index ed3e42dd8..55e284212 100644 --- a/src/libs/comm_py/comm/sonarClient.py.only-ice.in +++ b/src/libs/comm_py/comm/sonarClient.py.only-ice.in @@ -1,6 +1,7 @@ import sys import Ice from .ice.sonarIceClient import SonarIceClient +from .tools import server2int def __getSonarIceClient(jdrc, prefix): @@ -67,9 +68,8 @@ def getSonarClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__Laserdisabled, __getLaserIceClient, __getListenerLaser] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/sonarClient.py.ros.in b/src/libs/comm_py/comm/sonarClient.py.ros.in index 0f2364749..147265482 100644 --- a/src/libs/comm_py/comm/sonarClient.py.ros.in +++ b/src/libs/comm_py/comm/sonarClient.py.ros.in @@ -2,6 +2,7 @@ import sys import Ice import rospy from .ice.sonarIceClient import SonarIceClient +from .tools import server2int def __getSonarIceClient(jdrc, prefix): @@ -34,7 +35,7 @@ def __getListenerSonar(jdrc, prefix): @return Laser ROS Subscriber - ''' + ''' print(prefix + ": This Interface doesn't support ROS msg") return None @@ -68,9 +69,8 @@ def getSonarClient (jdrc, prefix): ''' server = jdrc.getConfig().getProperty(prefix+".Server") - if not server: - server=0 + server = server2int(server) cons = [__Sonardisabled, __getSonarIceClient, __getListenerSonar] - return cons[server](jdrc, prefix) \ No newline at end of file + return cons[server](jdrc, prefix) diff --git a/src/libs/comm_py/comm/tools.py b/src/libs/comm_py/comm/tools.py new file mode 100644 index 000000000..f07a44357 --- /dev/null +++ b/src/libs/comm_py/comm/tools.py @@ -0,0 +1,9 @@ + + +def server2int(server): + serverl = server.lower() + if serverl == "ice" or serverl == "1": + return 1 + elif serverl == "ros" or serverl == "2": + return 2 + else : return 0 \ No newline at end of file diff --git a/src/libs/comm_py/tests/test.yml b/src/libs/comm_py/tests/test.yml index 8c679a42e..5b4b34225 100644 --- a/src/libs/comm_py/tests/test.yml +++ b/src/libs/comm_py/tests/test.yml @@ -1,6 +1,6 @@ Test: Motors: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9001" Topic: "/turtlebotROS/mobile_base/commands/velocity" Name: testMotors @@ -8,55 +8,55 @@ Test: maxW: 0.7 Camera1: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" Name: testCamera1 Camera2: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CameraR:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraR/image_raw" Name: testCamera2 Pose3D: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Pose3D:default -h localhost -p 9001" Topic: "/turtlebotROS/odom" Name: testPose3d Laser: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Laser:default -h localhost -p 9001" Topic: "/turtlebotROS/laser/scan" Name: testLaser Sonar: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Sonar:default -h localhost -p 8993" Topic: "/turtlebotROS/laser/scan" Name: testSonar CMDVel: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CMDVel:default -h 0.0.0.0 -p 9000" Navdata: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: Navdata:default -h 0.0.0.0 -p 9000 Extra: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: Extra:default -h 0.0.0.0 -p 9000 Bumper: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: Extra:default -h 0.0.0.0 -p 9000 Topic: "/turtlebotROS/mobile_base/events/bumper" Name: testPose3d Vmax: 3 Wmax: 0.7 - NodeName: JdeRobotCommTest \ No newline at end of file + NodeName: JdeRobotCommTest diff --git a/src/libs/config_cpp/src/demo/demo.yml b/src/libs/config_cpp/src/demo/demo.yml index 04a17ada4..725ebb2ec 100644 --- a/src/libs/config_cpp/src/demo/demo.yml +++ b/src/libs/config_cpp/src/demo/demo.yml @@ -1,18 +1,17 @@ Demo: Motors: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9001" Topic: "/turtlebotROS/mobile_base/commands/velocity" Name: basic_component_pyCamera maxW: 0.7 maxV: 4 - + Camera: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" Name: basic_component_pyCamera NodeName: demo - diff --git a/src/libs/config_py/demo/demo.yml b/src/libs/config_py/demo/demo.yml index abc5b1518..3600abea2 100644 --- a/src/libs/config_py/demo/demo.yml +++ b/src/libs/config_py/demo/demo.yml @@ -1,18 +1,17 @@ Demo: Motors: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: Motors:default -h localhost -p 9001 Topic: '/turtlebotROS/mobile_base/commands/velocity' Name: basic_component_pyCamera maxW: 0.7 maxV: 4 - + Camera: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" Name: basic_component_pyCamera NodeName: demo - diff --git a/src/tools/cameraview/cameraview.yml b/src/tools/cameraview/cameraview.yml index 794c83f25..9b936ec35 100644 --- a/src/tools/cameraview/cameraview.yml +++ b/src/tools/cameraview/cameraview.yml @@ -1,10 +1,10 @@ Cameraview: Camera: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "cameraA:tcp -h localhost -p 9999" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" Name: cameraA Fps: 30 - NodeName: cameraview \ No newline at end of file + NodeName: cameraview diff --git a/src/tools/colorTuner_py/colorTuner_py.yml b/src/tools/colorTuner_py/colorTuner_py.yml index f1167d452..f4a8176c0 100644 --- a/src/tools/colorTuner_py/colorTuner_py.yml +++ b/src/tools/colorTuner_py/colorTuner_py.yml @@ -1,6 +1,6 @@ ColorTuner: Camera: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "cameraA:tcp -h localhost -p 9999" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" diff --git a/src/tools/kobukiViewer/kobukiViewer.yml b/src/tools/kobukiViewer/kobukiViewer.yml index 6240df791..95dd26dbb 100644 --- a/src/tools/kobukiViewer/kobukiViewer.yml +++ b/src/tools/kobukiViewer/kobukiViewer.yml @@ -1,6 +1,6 @@ kobukiViewer: Motors: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9001" Topic: "/turtlebotROS/mobile_base/commands/velocity" Name: kobukiViewerMotors @@ -8,27 +8,27 @@ kobukiViewer: maxW: 0.7 Camera1: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraL/image_raw" Name: kobukiViewerCamera1 Camera2: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "CameraR:default -h localhost -p 9001" Format: RGB8 Topic: "/TurtlebotROS/cameraR/image_raw" Name: kobukiViewerCamera2 Pose3D: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "Pose3D:default -h localhost -p 9001" Topic: "//turtlebotROS/odom" Name: kobukiViewerPose3d Laser: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "Laser:default -h localhost -p 9001" Topic: "/turtlebotROS/laser/scan" Name: kobukiViewerLaser diff --git a/src/tools/pantilt_teleop_py/pantilt_teleop.yml b/src/tools/pantilt_teleop_py/pantilt_teleop.yml index 2fd472ba6..42312070e 100644 --- a/src/tools/pantilt_teleop_py/pantilt_teleop.yml +++ b/src/tools/pantilt_teleop_py/pantilt_teleop.yml @@ -1,15 +1,14 @@ pantilt_teleop: PTMotors: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS (Not supported) + Server: Ice # Deactivate, Ice , ROS (Not supported) Proxy: "PanTilt:default -h localhost -p 9977" Name: basic_component_pyPTMotors - + Camera: - Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: ROS # Deactivate, Ice , ROS Proxy: "cameraA:default -h localhost -p 9999" Format: RGB8 Topic: "/usb_cam/image_raw" Name: pantilt_teleop_pyCamera NodeName: pantilt_teleop_py - diff --git a/src/tools/rgbdViewer/freenect_ros.yml b/src/tools/rgbdViewer/freenect_ros.yml new file mode 100644 index 000000000..cc3dfbd08 --- /dev/null +++ b/src/tools/rgbdViewer/freenect_ros.yml @@ -0,0 +1,49 @@ +rgbdViewer: + CameraRGB: + Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Proxy: "cameraA:tcp -h localhost -p 9998" + Format: RGB8 + Topic: "/camera/rgb/image_raw" + Name: cameraA + Fps: 30 + + CameraDEPTH: + Server: 2 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Proxy: "cameraB:tcp -h localhost -p 9998" + Format: RGB8 + Topic: "/camera/depth_registered/sw_registered/image_rect" + Name: cameraB + Fps: 30 + + PointCloud: + Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Proxy: "pointcloud1:tcp -h localhost -p 9999" + Topic: "/TurtlebotROS/cameraL/image_raw" + Name: pointcloud + Fps: 30 + + RGBD: + Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Proxy: "rgbd1:tcp -h localhost -p 9999" + Topic: "/TurtlebotROS/cameraL/image_raw" + Name: RGBD + Fps: 30 + + Pose3DMotors: + Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Proxy: "Pose3DMotors1:tcp -h 193.147.14.20 -p 9999" + Topic: "/TurtlebotROS/cameraL/image_raw" + Name: Pose3DMotors + + KinectLeds: + Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Proxy: "kinectleds1:tcp -h 193.147.14.20 -p 9999" + Topic: "/TurtlebotROS/cameraL/image_raw" + Name: KinectLeds + + + NodeName: rgbdViewer + Width: 640 + Height: 480 + Fps: 15 + Debug: 1 diff --git a/src/tools/rgbdViewer/rgbdViewer.cpp b/src/tools/rgbdViewer/rgbdViewer.cpp index a181895d9..5bcc73a1e 100644 --- a/src/tools/rgbdViewer/rgbdViewer.cpp +++ b/src/tools/rgbdViewer/rgbdViewer.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -166,9 +167,11 @@ int main(int argc, char** argv){ std::cerr <<"Error :" << msg << std::endl; return 1; } - cameraRGBActive=(bool)cfg.asIntWithDefault("rgbdViewer.CameraRGB.Server",0); - cameraDepthActive=(bool)cfg.asIntWithDefault("rgbdViewer.CameraDEPTH.Server",0); - cameraRGBDActive=(bool)cfg.asIntWithDefault("rgbdViewer.RGBD.Server",0); + + + cameraRGBActive=(bool)Comm::server2int(cfg.asStringWithDefault("rgbdViewer.CameraRGB.Server","0")); + cameraDepthActive=(bool)Comm::server2int(cfg.asStringWithDefault("rgbdViewer.CameraDEPTH.Server","0")); + cameraRGBDActive=(bool)Comm::server2int(cfg.asStringWithDefault("rgbdViewer.RGBD.Server","0")); if (cameraRGBDActive && (cameraRGBActive || cameraDepthActive)){ LOG(ERROR) << "RGBD and single cameras cannot be selected at the same time"; diff --git a/src/tools/rgbdViewer/rgbdViewer.yml b/src/tools/rgbdViewer/rgbdViewer.yml index 0d982c075..166c889f4 100644 --- a/src/tools/rgbdViewer/rgbdViewer.yml +++ b/src/tools/rgbdViewer/rgbdViewer.yml @@ -1,6 +1,6 @@ rgbdViewer: CameraRGB: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "cameraA:tcp -h localhost -p 9999" Format: RGB8 Topic: "/camera/rgb/image_raw" @@ -8,7 +8,7 @@ rgbdViewer: Fps: 30 CameraDEPTH: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice, ROS Proxy: "cameraB:tcp -h localhost -p 9999" Format: RGB8 Topic: "/camera/depth_registered/image_raw" @@ -16,27 +16,27 @@ rgbdViewer: Fps: 30 PointCloud: - Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Deactivate # Deactivate, Ice, ROS Proxy: "pointcloud1:tcp -h localhost -p 9999" Topic: "/TurtlebotROS/cameraL/image_raw" Name: pointcloud Fps: 30 RGBD: - Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Deactivate # Deactivate, Ice, ROS Proxy: "rgbd1:tcp -h localhost -p 9999" Topic: "/TurtlebotROS/cameraL/image_raw" Name: RGBD Fps: 30 Pose3DMotors: - Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Deactivate # Deactivate, Ice, ROS Proxy: "Pose3DMotors1:tcp -h 193.147.14.20 -p 9999" Topic: "/TurtlebotROS/cameraL/image_raw" Name: Pose3DMotors KinectLeds: - Server: 0 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Deactivate # Deactivate, Ice, ROS Proxy: "kinectleds1:tcp -h 193.147.14.20 -p 9999" Topic: "/TurtlebotROS/cameraL/image_raw" Name: KinectLeds diff --git a/src/tools/scratch2jderobot/cfg/drone.yml b/src/tools/scratch2jderobot/cfg/drone.yml index 57fc7906c..6784a6743 100644 --- a/src/tools/scratch2jderobot/cfg/drone.yml +++ b/src/tools/scratch2jderobot/cfg/drone.yml @@ -1,6 +1,6 @@ drone: Motors: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9000" Topic: "/cmd_vel_mux/input/teleop" Name: Motors @@ -8,36 +8,36 @@ drone: maxW: 0.7 Camera1: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Camera:default -h localhost -p 9000" Format: RGB8 Topic: "/camera/rgb/image_raw" Name: Camera1 Pose3D: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Pose3D:default -h localhost -p 9000" Topic: "/odom" Name: Pose3d Laser: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Laser:default -h localhost -p 9000" Topic: "/scan" Name: Laser CMDVel: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CMDVel:default -h localhost -p 9000" Name: CMDVel Navdata: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Navdata:default -h localhost -p 9000" Name: Navdata Extra: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Extra:default -h localhost -p 9000" Name: Extra diff --git a/src/tools/scratch2jderobot/cfg/robot.yml b/src/tools/scratch2jderobot/cfg/robot.yml index 9d13e29a9..28f8730e4 100644 --- a/src/tools/scratch2jderobot/cfg/robot.yml +++ b/src/tools/scratch2jderobot/cfg/robot.yml @@ -1,6 +1,6 @@ robot: Motors: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Motors:default -h localhost -p 9001" Topic: "/mobile_base/commands/velocity" Name: robotMotors @@ -8,19 +8,19 @@ robot: maxV: 4 Laser: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Laser:tcp -h localhost -p 9001" Topic: "/scan" Name: robotLaser Pose3D: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Pose3D:default -h localhost -p 9001" Topic: "/odom" Name: robotPose3d Camera1: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CameraL:default -h localhost -p 9001" Format: RGB8 Topic: "/cameraL/image_raw" diff --git a/src/tools/uav_viewer_py/uav_viewer_py.yml b/src/tools/uav_viewer_py/uav_viewer_py.yml index 43512936a..b39b9ac44 100644 --- a/src/tools/uav_viewer_py/uav_viewer_py.yml +++ b/src/tools/uav_viewer_py/uav_viewer_py.yml @@ -1,31 +1,31 @@ UAVViewer: Camera: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Camera:default -h localhost -p 9000" Format: RGB8 Topic: "/IntrorobROS/image_raw" Name: UAVViewerCamera Pose3D: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Pose3D:default -h localhost -p 9000" Topic: "/IntrorobROS/Pose3D" Name: UAVViewerPose3d CMDVel: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "CMDVel:tcp -h localhost -p 9000" Topic: "/IntrorobROS/CMDVel" Name: UAVViewerCMDVel Navdata: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Navdata:tcp -h localhost -p 9000" Topic: "/IntrorobROS/Navdata" Name: UAVViewerNavdata Extra: - Server: 1 # 0 -> Deactivate, 1 -> Ice , 2 -> ROS + Server: Ice # Deactivate, Ice , ROS Proxy: "Extra:tcp -h localhost -p 9000" Topic: "/IntrorobROS/Extra" Name: UAVViewerExtra @@ -33,6 +33,6 @@ UAVViewer: Xmax: 10 Ymax: 10 Zmax: 5 - Yawmax: 1 + Yawmax: 1 NodeName: UAVViewer