-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
2,018 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ tmp/ | |
build | ||
.kdev4 | ||
*.kdev4 | ||
html/ | ||
.DS_Store | ||
html-gh-pages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ branches: | |
branches: | ||
only: | ||
- master | ||
- dev | ||
|
||
install: | ||
- CI_DIR=$PWD | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
27 changes: 27 additions & 0 deletions
27
ocra-icub-clients/sitting-demo/include/sitting-demo/SittingDemoClient.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
Oops, something went wrong.