Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrunettini committed Feb 12, 2018
2 parents c95064f + e61694b commit 5f29fb5
Show file tree
Hide file tree
Showing 60 changed files with 974 additions and 593 deletions.
38 changes: 19 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,54 @@ env:
- TRAVIS_BUILD_TYPE=Release

before_script:
# install a recent cmake and lua 5.1
# install a recent cmake and lua 5.1
#ubuntu dependencies
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo sh -c 'echo "deb http://www.icub.org/ubuntu trusty contrib/science" > /etc/apt/sources.list.d/icub.list'; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install cmake liblua5.1-dev; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install cmake3 liblua5.1-dev; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get --assume-yes --force-yes install icub-common libeigen3-dev; fi

- cd ..

# install robot-testing framework
- git clone https://github.com/robotology/robot-testing
- git clone --depth=1 --branch devel https://github.com/robotology/robot-testing
- cd robot-testing
- mkdir build
- cd build
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} -DENABLE_LUA_PLUGIN:BOOL=ON -DENABLE_WEB_LISTENER:BOOL=ON ..
- make
- sudo make install
- make
- sudo make install
- cd ../..

# install yarp
- git clone https://github.com/robotology/yarp
- git clone --depth=1 --branch devel https://github.com/robotology/yarp
- cd yarp
- mkdir build
- cd build
- cmake -DCREATE_LIB_MATH:BOOL=ON -DCREATE_SHARED_LIBRARY:BOOL=ON -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} -DYARP_COMPILE_RTF_ADDONS:BOOL=ON ..
- cmake -DCREATE_LIB_MATH:BOOL=ON -DCREATE_SHARED_LIBRARY:BOOL=ON -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} -DYARP_COMPILE_RTF_ADDONS:BOOL=ON ..
- make
- sudo make install
- sudo ldconfig
- cd ../..
# install icub-main
- git clone https://github.com/robotology/icub-main

# install icub-main
- git clone --depth=1 --branch devel https://github.com/robotology/icub-main
- cd icub-main
- mkdir build
- cd build
- cmake -DCREATE_SHARED_LIBRARY:BOOL=ON -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} ..
- cmake -DCREATE_SHARED_LIBRARY:BOOL=ON -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} ..
- make
- sudo make install
- sudo ldconfig
- cd ../..

# configure icub-tests
- cd icub-tests
- mkdir build
- cd build
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} ..
script:

script:
- make
# test install/uninstall

Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
cmake_minimum_required(VERSION 3.0)
project(iCub-Tests)

# find a version of RTF higher then 1.0.1
# find a version of RTF higher then 1.3.2
# and with yarp support enabled
find_package(RTF 1.2 REQUIRED)
find_package(RTF 1.3.3 COMPONENTS DLL REQUIRED)
find_package(YARP REQUIRED)

# set the output plugin directory to collect all the shared libraries
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
Expand Down
3 changes: 1 addition & 2 deletions example/cpp/ExampleFixture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ find_package(YARP)
# add include directories
include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

# add required libraries
link_libraries(${RTF_LIBRARIES}
Expand Down
3 changes: 1 addition & 2 deletions example/cpp/ExampleTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ find_package(YARP)
# add include directories
include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

# add the source codes to build the plugin library
add_library(${PROJECTNAME} MODULE ExampleTest.h
Expand Down
10 changes: 3 additions & 7 deletions src/camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ cmake_minimum_required(VERSION 3.0)
set(PROJECTNAME CameraTest)
project(${PROJECTNAME})

find_package(RTF 1.1 COMPONENTS DLL)
find_package(YARP)

include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

add_library(${PROJECTNAME} MODULE CameraTest.h
CameraTest.cpp)
rtf_add_plugin(${PROJECTNAME} HEADERS CameraTest.h
SOURCES CameraTest.cpp)

target_link_libraries(${PROJECTNAME} ${RTF_LIBRARIES}
${YARP_LIBRARIES} YARP::YARP_rtf)
Expand Down
8 changes: 4 additions & 4 deletions src/camera/CameraTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ bool CameraTest::setup(yarp::os::Property& property) {
setName(property.find("name").asString());

// updating parameters
RTF_ASSERT_ERROR_IF(property.check("portname"),
RTF_ASSERT_ERROR_IF_FALSE(property.check("portname"),
"The portname must be given as the test paramter!");
cameraPortName = property.find("portname").asString();
measure_time = property.check("measure_time") ? property.find("measure_time").asInt() : TIMES;
expected_frequency = property.check("expected_frequency") ? property.find("expected_frequency").asInt() : FREQUENCY;
tolerance = property.check("tolerance") ? property.find("tolerance").asInt() : TOLERANCE;

// opening port
RTF_ASSERT_ERROR_IF(port.open("/CameraTest/image:i"),
RTF_ASSERT_ERROR_IF_FALSE(port.open("/CameraTest/image:i"),
"opening port, is YARP network available?");

RTF_TEST_REPORT(Asserter::format("Listening to camera for %d seconds",
Expand All @@ -56,7 +56,7 @@ bool CameraTest::setup(yarp::os::Property& property) {
// connecting
RTF_TEST_REPORT(Asserter::format("connecting from %s to %s",
port.getName().c_str(), cameraPortName.c_str()));
RTF_ASSERT_ERROR_IF(Network::connect(cameraPortName, port.getName()),
RTF_ASSERT_ERROR_IF_FALSE(Network::connect(cameraPortName, port.getName()),
"could not connect to remote port, camera unavailable");
return true;
}
Expand Down Expand Up @@ -84,6 +84,6 @@ void CameraTest::run() {
RTF_TEST_REPORT(Asserter::format("Received %d frames, expecting %d",
frames,
expectedFrames));
RTF_TEST_FAIL_IF(abs(frames-expectedFrames)<tolerance,
RTF_TEST_FAIL_IF_FALSE(abs(frames-expectedFrames)<tolerance,
"checking number of received frames");
}
10 changes: 3 additions & 7 deletions src/cartesian-control/reaching-tolerance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@ cmake_minimum_required(VERSION 3.0)
# set the project name
project(CartesianControlReachingToleranceTest)

# add the required cmake packages
find_package(RTF 1.1 COMPONENTS DLL)
find_package(YARP REQUIRED)

list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

# add include directories
include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

# import math symbols from standard cmath
add_definitions(-D_USE_MATH_DEFINES)

# add the source codes to build the plugin library
add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.h ${PROJECT_NAME}.cpp)
rtf_add_plugin(${PROJECT_NAME} HEADERS ${PROJECT_NAME}.h
SOURCES ${PROJECT_NAME}.cpp)

# add required libraries
target_link_libraries(${PROJECT_NAME} ${RTF_LIBRARIES} ${YARP_LIBRARIES} YARP::YARP_rtf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ bool CartesianControlReachingToleranceTest::setup(Property &property)
optJoint.put("local",("/"+getName()+"/joint/"+arm+"_arm"));

RTF_TEST_REPORT(Asserter::format("Opening Cartesian Controller Client for %s_arm",arm.c_str()));
RTF_ASSERT_ERROR_IF(drvCart.open(optCart),"Unable to open the client!");
RTF_ASSERT_ERROR_IF_FALSE(drvCart.open(optCart),"Unable to open the client!");

RTF_TEST_REPORT(Asserter::format("Opening Joint Controller Client for %s_arm",arm.c_str()));
RTF_ASSERT_ERROR_IF(drvJoint.open(optJoint),"Unable to open the client!");
RTF_ASSERT_ERROR_IF_FALSE(drvJoint.open(optJoint),"Unable to open the client!");
return true;
}

Expand All @@ -79,10 +79,10 @@ bool CartesianControlReachingToleranceTest::setup(Property &property)
void CartesianControlReachingToleranceTest::tearDown()
{
RTF_TEST_REPORT("Closing Cartesian Controller Client");
RTF_ASSERT_FAIL_IF(drvCart.close(),"Unable to close the client!");
RTF_ASSERT_FAIL_IF_FALSE(drvCart.close(),"Unable to close the client!");

RTF_TEST_REPORT("Closing Joint Controller Client");
RTF_ASSERT_FAIL_IF(drvJoint.close(),"Unable to close the client!");
RTF_ASSERT_FAIL_IF_FALSE(drvJoint.close(),"Unable to close the client!");
}


Expand Down
10 changes: 3 additions & 7 deletions src/cartesian-control/simple-p2p-movement/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@ cmake_minimum_required(VERSION 3.0)
# set the project name
project(CartesianControlSimpleP2pMovementTest)

# add the required cmake packages
find_package(RTF 1.1 COMPONENTS DLL)
find_package(YARP REQUIRED)

list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

# add include directories
include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

# import math symbols from standard cmath
add_definitions(-D_USE_MATH_DEFINES)

# add the source codes to build the plugin library
add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.h ${PROJECT_NAME}.cpp)
rtf_add_plugin(${PROJECT_NAME} HEADERS ${PROJECT_NAME}.h
SOURCES ${PROJECT_NAME}.cpp)

# add required libraries
target_link_libraries(${PROJECT_NAME} ${RTF_LIBRARIES} ${YARP_LIBRARIES} YARP::YARP_rtf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool CartesianControlSimpleP2pMovementTest::setup(Property &property)
option.put("local",("/"+getName()+"/"+arm+"_arm"));

RTF_TEST_REPORT(Asserter::format("Opening Cartesian Controller Client for %s_arm",arm.c_str()));
RTF_ASSERT_ERROR_IF(driver.open(option),"Unable to open the client!");
RTF_ASSERT_ERROR_IF_FALSE(driver.open(option),"Unable to open the client!");
return true;
}

Expand All @@ -68,7 +68,7 @@ bool CartesianControlSimpleP2pMovementTest::setup(Property &property)
void CartesianControlSimpleP2pMovementTest::tearDown()
{
RTF_TEST_REPORT("Closing Cartesian Controller Client");
RTF_ASSERT_FAIL_IF(driver.close(),"Unable to close the client!");
RTF_ASSERT_FAIL_IF_FALSE(driver.close(),"Unable to close the client!");
}


Expand Down
10 changes: 3 additions & 7 deletions src/controlModes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ cmake_minimum_required(VERSION 3.0)
set(PROJECTNAME ControlModes)
project(${PROJECTNAME})

find_package(RTF 1.1 COMPONENTS DLL)
find_package(YARP)

include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

add_library(${PROJECTNAME} MODULE ControlModes.h
ControlModes.cpp)
rtf_add_plugin(${PROJECT_NAME} HEADERS ControlModes.h
SOURCES ControlModes.cpp)
target_link_libraries(${PROJECTNAME} ${RTF_LIBRARIES}
${YARP_LIBRARIES} YARP::YARP_rtf)

Expand Down
36 changes: 18 additions & 18 deletions src/controlModes/ControlModes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ bool ControlModes::setup(yarp::os::Property& property) {
setName(property.find("name").asString());

// updating parameters
RTF_ASSERT_ERROR_IF(property.check("robot"), "The robot name must be given as the test parameter!");
RTF_ASSERT_ERROR_IF(property.check("part"), "The part name must be given as the test parameter!");
RTF_ASSERT_ERROR_IF(property.check("joints"), "The joints list must be given as the test parameter!");
RTF_ASSERT_ERROR_IF(property.check("home"), "The home positions must be given as the test parameter!");
RTF_ASSERT_ERROR_IF_FALSE(property.check("robot"), "The robot name must be given as the test parameter!");
RTF_ASSERT_ERROR_IF_FALSE(property.check("part"), "The part name must be given as the test parameter!");
RTF_ASSERT_ERROR_IF_FALSE(property.check("joints"), "The joints list must be given as the test parameter!");
RTF_ASSERT_ERROR_IF_FALSE(property.check("home"), "The home positions must be given as the test parameter!");

robotName = property.find("robot").asString();
partName = property.find("part").asString();
Expand All @@ -64,26 +64,26 @@ bool ControlModes::setup(yarp::os::Property& property) {
RTF_TEST_REPORT(RTF::Asserter::format("Tolerance of %.2f is used to check home position", tolerance));

Bottle* jointsBottle = property.find("joints").asList();
RTF_ASSERT_ERROR_IF(jointsBottle!=0,"unable to parse joints parameter");
RTF_ASSERT_ERROR_IF_FALSE(jointsBottle!=0,"unable to parse joints parameter");
n_cmd_joints = jointsBottle->size();
RTF_ASSERT_ERROR_IF(n_cmd_joints>0,"invalid number of joints, it must be >0");
RTF_ASSERT_ERROR_IF_FALSE(n_cmd_joints>0,"invalid number of joints, it must be >0");

Property options;
options.put("device", "remote_controlboard");
options.put("remote", "/"+robotName+"/"+partName);
options.put("local", "/ControlModesTest/"+robotName+"/"+partName);

dd = new PolyDriver(options);
RTF_ASSERT_ERROR_IF(dd->isValid(),"Unable to open device driver");
RTF_ASSERT_ERROR_IF(dd->view(idir),"Unable to open position direct interface");
RTF_ASSERT_ERROR_IF(dd->view(ienc),"Unable to open encoders interface");
RTF_ASSERT_ERROR_IF(dd->view(iamp),"Unable to open ampliefier interface");
RTF_ASSERT_ERROR_IF(dd->view(ipos),"Unable to open position interface");
RTF_ASSERT_ERROR_IF(dd->view(icmd),"Unable to open control mode interface");
RTF_ASSERT_ERROR_IF(dd->view(iimd),"Unable to open interaction mode interface");
RTF_ASSERT_ERROR_IF(dd->view(ivel),"Unable to open velocity control interface");
RTF_ASSERT_ERROR_IF(dd->view(itrq),"Unable to open torque control interface");
RTF_ASSERT_ERROR_IF(dd->view(ivar),"Unable to open remote variables interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->isValid(),"Unable to open device driver");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(idir),"Unable to open position direct interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(ienc),"Unable to open encoders interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(iamp),"Unable to open ampliefier interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(ipos),"Unable to open position interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(icmd),"Unable to open control mode interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(iimd),"Unable to open interaction mode interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(ivel),"Unable to open velocity control interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(itrq),"Unable to open torque control interface");
RTF_ASSERT_ERROR_IF_FALSE(dd->view(ivar),"Unable to open remote variables interface");

if (!ienc->getAxes(&n_part_joints))
{
Expand Down Expand Up @@ -253,9 +253,9 @@ void ControlModes::verifyModeSingle(int joint, int desired_control_mode, yarp::d
void ControlModes::checkJointWithTorqueMode()
{
yarp::os::Bottle b;
RTF_ASSERT_ERROR_IF(ivar->getRemoteVariable("torqueControlEnabled", b), "unable to get torqueControlEnabled");
RTF_ASSERT_ERROR_IF_FALSE(ivar->getRemoteVariable("torqueControlEnabled", b), "unable to get torqueControlEnabled");

RTF_ASSERT_ERROR_IF((b.size() != n_part_joints), "torqueControlEnabled var returns joint num not corret.");
RTF_ASSERT_ERROR_IF_FALSE((b.size() != n_part_joints), "torqueControlEnabled var returns joint num not corret.");

int j=0;
for(int i=0; i<b.size() && j<n_part_joints; i++)
Expand Down
10 changes: 3 additions & 7 deletions src/demoRedBall/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@ cmake_minimum_required(VERSION 3.0)
# set the project name
project(DemoRedBallTest)

# add the required cmake packages
find_package(RTF 1.1 COMPONENTS DLL)
find_package(YARP REQUIRED)

list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

# add include directories
include_directories(${CMAKE_SOURCE_DIR}
${RTF_INCLUDE_DIRS}
${YARP_INCLUDE_DIRS}
${YARP_HELPERS_INCLUDE_DIR})
${YARP_INCLUDE_DIRS})

# import math symbols from standard cmath
add_definitions(-D_USE_MATH_DEFINES)

# add the source codes to build the plugin library
add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.h ${PROJECT_NAME}.cpp)
rtf_add_plugin(${PROJECT_NAME} HEADERS ${PROJECT_NAME}.h
SOURCES ${PROJECT_NAME}.cpp)

# add required libraries
target_link_libraries(${PROJECT_NAME} ${RTF_LIBRARIES} ${YARP_LIBRARIES} YARP::YARP_rtf)
Expand Down
Loading

0 comments on commit 5f29fb5

Please sign in to comment.