Skip to content

Commit

Permalink
merge dev into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rlober committed Nov 21, 2016
2 parents 1a575a9 + 1099b1f commit df5a3fc
Show file tree
Hide file tree
Showing 41 changed files with 2,018 additions and 204 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ tmp/
build
.kdev4
*.kdev4
html/
.DS_Store
html-gh-pages/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ branches:
branches:
only:
- master
- dev

install:
- CI_DIR=$PWD
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ else()
endif()

set(VARS_PREFIX "OcraIcub")
set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_BUILD_TYPE Debug)

set(${VARS_PREFIX}_MAJOR_VERSION 1)
Expand Down Expand Up @@ -68,6 +68,7 @@ add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_PREFIX}/bin"
add_subdirectory(ocra-icub)
add_subdirectory(ocra-icub-server)
add_subdirectory(ocra-icub-clients)
add_subdirectory(ocra-icub-tools)


# add a target to generate API documentation with Doxygen
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# ocra-wbi-plugins [![Build Status](https://travis-ci.org/ocra-recipes/ocra-wbi-plugins.svg?branch=master)](https://travis-ci.org/ocra-recipes/ocra-wbi-plugins)

# ocra-wbi-plugins
Controller implementations and plugins for communicating between the whole body controller libraries developed at ISIR, [`ocra-recipes`](https://github.com/ocra-recipes/ocra-recipes), and the iCub Whole Body Interface, [`WBI`](https://github.com/robotology/wholebodyinterface), libraries.

#### Build Status
| master | dev |
|:------:|:---:|
| [![Build Status](https://travis-ci.org/ocra-recipes/ocra-wbi-plugins.svg?branch=master)](https://travis-ci.org/ocra-recipes/ocra-wbi-plugins) | [![Build Status](https://travis-ci.org/ocra-recipes/ocra-wbi-plugins.svg?branch=dev)](https://travis-ci.org/ocra-recipes/ocra-wbi-plugins) |




## Code Structure
Here's how everything is laid out...
Expand Down
28 changes: 8 additions & 20 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "ocra-icub"
PROJECT_NAME = "ocra-wbi-plugins"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand All @@ -44,21 +44,21 @@ PROJECT_NUMBER =
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "A match made in heaven."
PROJECT_BRIEF = "Doxygen documentation for the ocra-wbi-plugins repository"

# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
# the documentation. The maximum height of the logo should not exceed 55 pixels
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
# to the output directory.

PROJECT_LOGO =
PROJECT_LOGO = @CMAKE_CURRENT_SOURCE_DIR@/html-gh-pages/static/img/logo-doxygen.png

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# entered, it will be relative to the location where doxygen was xstarted. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = ./docs
OUTPUT_DIRECTORY = @CMAKE_CURRENT_SOURCE_DIR@/html-gh-pages/doxy-ocra-wbi-plugins

# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
Expand Down Expand Up @@ -743,7 +743,7 @@ WARN_LOGFILE =
# spaces.
# Note: If this tag is empty the current directory is searched.

INPUT = @CMAKE_CURRENT_SOURCE_DIR@/bin @CMAKE_CURRENT_SOURCE_DIR@/libs @CMAKE_CURRENT_SOURCE_DIR@/README.md
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/ocra-icub-server @CMAKE_CURRENT_SOURCE_DIR@/ocra-icub-clients @CMAKE_CURRENT_SOURCE_DIR@/ocra-icub @CMAKE_CURRENT_SOURCE_DIR@/README.md

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -1789,18 +1789,6 @@ GENERATE_XML = NO

XML_OUTPUT = xml

# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.

XML_SCHEMA =

# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.

XML_DTD =

# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
Expand Down Expand Up @@ -2049,7 +2037,7 @@ HIDE_UNDOC_RELATIONS = YES
# set to NO
# The default value is: NO.

HAVE_DOT = NO
HAVE_DOT = YES

# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of
Expand Down Expand Up @@ -2203,7 +2191,7 @@ DIRECTORY_GRAPH = YES
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_IMAGE_FORMAT = png
DOT_IMAGE_FORMAT = svg

# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
Expand Down
1 change: 1 addition & 0 deletions ocra-icub-clients/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ project(ocra-icub-clients CXX)
add_subdirectory(example-client)
add_subdirectory(stepping-demo)
add_subdirectory(task-operations-demo)
add_subdirectory(sitting-demo)
# add_subdirectory(your-client)
2 changes: 1 addition & 1 deletion ocra-icub-clients/example-client/src/ExampleClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool ExampleClient::initialize()

ocra_recipes::TERMINATION_STRATEGY termStrategy = ocra_recipes::BACK_AND_FORTH;

leftHandTrajThread = std::make_shared<ocra_recipes::TrajectoryThread>(10, "leftHandCartesian", waypoints, trajType, termStrategy);
leftHandTrajThread = std::make_shared<ocra_recipes::TrajectoryThread>(10, "LeftHandCartesian", waypoints, trajType, termStrategy);

// leftHandTrajThread->setDisplacement(0.2);
leftHandTrajThread->setGoalErrorThreshold(0.03);
Expand Down
75 changes: 75 additions & 0 deletions ocra-icub-clients/sitting-demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This file is part of sitting-demo.
# Copyright (C) [your institution here]
# author(s): [your name here]
#
# 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/>.

# Make sure we are working with at least CMake 2.8.12
cmake_minimum_required(VERSION 2.8.12)

# Initiate the project
PROJECT(sitting-demo CXX)

# Make sure you have a C++11 compatible compiler
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

# Build as Release (Change Release to Debug for better debugging symbols)
set(CMAKE_BUILD_TYPE Release)

# Set the project version.
set(${PROJECT_NAME}_MAJOR_VERSION 1)
set(${PROJECT_NAME}_MINOR_VERSION 0)
set(${PROJECT_NAME}_PATCH_VERSION 0)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION})

# Add some helpful CMake functions
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)

# Find OcraIcub
find_package(OcraIcub REQUIRED)
IF(${OcraIcub_FOUND})
message("-- Found OcraIcub version ${OcraIcub_VERSION}")
ENDIF()

# Get all of the source and header files.
file(GLOB folder_source src/*.cpp)
file(GLOB folder_header include/${PROJECT_NAME}/*.h)
source_group("Source Files" FILES ${folder_source})
source_group("Header Files" FILES ${folder_header})

# Tell the compiler where to look for all other headers
include_directories(
${PROJECT_SOURCE_DIR}/include
${OcraIcub_INCLUDE_DIRS}
)

# Add the client executable (binary)
add_executable(${PROJECT_NAME} ${folder_source} ${folder_header})

# Link to the appropriate libs
target_link_libraries(
${PROJECT_NAME}
${OcraIcub_LIBRARIES}
)

# Install to the bin/ directory if installed.
install(TARGETS ${PROJECT_NAME} DESTINATION bin)

# Add an uninstallation target so you can just run - make uninstall - to remove the binary.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef SITTINGDEMOCLIENT_H
#define SITTINGDEMOCLIENT_H

#include <ocra-icub/IcubClient.h>
#include <ocra-recipes/TrajectoryThread.h>
#include <ocra-recipes/ControllerClient.h>


class SittingDemoClient : public ocra_recipes::ControllerClient
{
DEFINE_CLASS_POINTER_TYPEDEFS(SittingDemoClient)

public:
SittingDemoClient (std::shared_ptr<ocra::Model> modelPtr, const int loopPeriod);
virtual ~SittingDemoClient ();

protected:
virtual bool initialize();
virtual void release();
virtual void loop();

private:
ocra_recipes::TrajectoryThread::Ptr rootTrajThread;
};


#endif // TEST_CLIENT_H
38 changes: 38 additions & 0 deletions ocra-icub-clients/sitting-demo/src/SittingDemoClient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "sitting-demo/SittingDemoClient.h"
SittingDemoClient::SittingDemoClient(std::shared_ptr<ocra::Model> modelPtr, const int loopPeriod)
: ocra_recipes::ControllerClient(modelPtr, loopPeriod)
{
// add your code here...
}

SittingDemoClient::~SittingDemoClient()
{
// add your code here...
}

bool SittingDemoClient::initialize()
{
ocra_recipes::TRAJECTORY_TYPE trajType = ocra_recipes::MIN_JERK;

Eigen::Vector3d waypoints(-0.12, -0.105, 0.22);

ocra_recipes::TERMINATION_STRATEGY termStrategy = ocra_recipes::REVERSE_STOP;

rootTrajThread = std::make_shared<ocra_recipes::TrajectoryThread>(10, "RootCartesian", waypoints, trajType, termStrategy);

// rootTrajThread->setDisplacement(0.2);
rootTrajThread->setGoalErrorThreshold(0.03);
rootTrajThread->setMaxVelocity(0.01);
rootTrajThread->start();
return true;
}

void SittingDemoClient::release()
{
// add your code here...
}

void SittingDemoClient::loop()
{
// add your code here...
}
87 changes: 87 additions & 0 deletions ocra-icub-clients/sitting-demo/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*! ile main.cpp
* rief
* \details
* uthor [Your Name](url of your github site)
* \date [date]
* \copyright GNU General Public License.
*/
/*
* This file is part of sitting-demo.
* Copyright (C) [year] [institution]
*
* 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/>.
*/

#include <yarp/os/ResourceFinder.h>
#include <yarp/os/Network.h>
#include <yarp/os/Log.h>
#include <yarp/os/LogStream.h>
#include <yarp/os/Time.h>

#include <ocra-icub/IcubClient.h>
#include <ocra-recipes/ControllerClient.h>
#include <ocra-recipes/ClientManager.h>

#include "sitting-demo/SittingDemoClient.h"

int main (int argc, char * argv[])
{
yarp::os::Log yLog;
yarp::os::Network yarp;

double network_timeout = 10.0;
if (!yarp.checkNetwork(network_timeout))
{
yLog.fatal() << "YARP network is not available";
return -1;
}

yLog.info() << "Making model initializer";
ocra_icub::ModelInitializer modelIni = ocra_icub::ModelInitializer();

int loopPeriod = 10;

std::shared_ptr<ocra_recipes::ControllerClient> ctrlClient;
yLog.info() << "Making controller client";

if(!modelIni.getModel())
{
yLog.fatal() << "Model is not empty.";
}

ctrlClient = std::make_shared<SittingDemoClient>(modelIni.getModel(), loopPeriod);

std::shared_ptr<ocra_recipes::ClientManager> clientManager;
yLog.info() << "Making client manager";
clientManager = std::make_shared<ocra_recipes::ClientManager>(ctrlClient);

yLog.info() << "Resource finder stuff";
yarp::os::ResourceFinder rf;
rf.setVerbose(true);
rf.setDefaultConfigFile("sitting-demo.ini"); //default config file name.
rf.setDefaultContext("sitting-demo"); //when no parameters are given to the module this is the default context
rf.configure(argc,argv);

if (rf.check("help"))
{
clientManager->printHelp();
return 0;
}

yLog.info() << "Configuring";
clientManager->configure(rf);

yLog.info() << "Launching client";
return clientManager->launchClient();
}
Loading

0 comments on commit df5a3fc

Please sign in to comment.