Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiscreteFilter block #47

Closed
wants to merge 92 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
288d6e9
Migrated old DH conversion code from embedded to iDynTree
francesco-romano Sep 25, 2017
aa70f72
Fixed bug introduced with toolbox refactoring
francesco-romano Sep 25, 2017
6716aaa
Temporary fix: included iostream
francesco-romano Oct 24, 2017
2295493
New Matlab WBToolboxConfig class
diegoferigo Oct 30, 2017
be52d5b
New Anytype interface and MxAnyType implementation
diegoferigo Oct 30, 2017
7057663
Error class has been enhanced and renamed to Log
diegoferigo Oct 30, 2017
b4beb26
Removed WBIModelBlock
diegoferigo Oct 30, 2017
aee4eed
New Configuration class
diegoferigo Oct 30, 2017
8a68ac7
New RobotInterface class
diegoferigo Oct 30, 2017
af1fa41
ClockServer thrift messages are now a static library
diegoferigo Nov 8, 2017
1d71a86
Substituted C-style cast with static_cast in Signal.cpp
diegoferigo Nov 8, 2017
19cf4d6
Switch to AnyType interface to handle data read by BlockInformation
diegoferigo Nov 8, 2017
f097369
WBIBlock refactored and renamed to WBBlock
diegoferigo Nov 8, 2017
04531f1
Minor edits of base/ classes
diegoferigo Nov 10, 2017
639fb71
WBInterface refactored and renamed to ToolboxSingleton
diegoferigo Nov 8, 2017
42a06f4
CentroidalMomentum refactored
diegoferigo Nov 8, 2017
aab17af
DotJNu refactored
diegoferigo Nov 8, 2017
2881b1b
ForwardKinematics refactored
diegoferigo Nov 8, 2017
881f382
GetLimits refactored
diegoferigo Nov 8, 2017
fade9bb
InverseDynamics refactored
diegoferigo Nov 8, 2017
58eecea
Jacobian refactored
diegoferigo Nov 8, 2017
648aef9
MassMatrix refactored
diegoferigo Nov 8, 2017
6953aa2
MinimumJerkTrajectoryGenerator refactored
diegoferigo Nov 8, 2017
c931213
RealTimeSyncronizer refactored
diegoferigo Nov 8, 2017
0bc69bd
SetLowLevelPID refactored
diegoferigo Nov 10, 2017
0eada49
SetReferences refactored
diegoferigo Nov 8, 2017
520266f
SimulatorSynchronizer refactored
diegoferigo Nov 8, 2017
d23242c
YarpClock refactored
diegoferigo Nov 8, 2017
525a620
YarpRead refactored
diegoferigo Nov 8, 2017
3ff6286
YarpWrite refactored
diegoferigo Nov 8, 2017
0f36c33
GetEstimate refactored and renamed to GetMeasurement
diegoferigo Nov 8, 2017
028dbd6
YARPWBIConverter refactored and renamed to ModelPartitioner
diegoferigo Nov 8, 2017
1ad29cb
Removed support of CMake < 3.0
diegoferigo Nov 8, 2017
0c2ecfd
iDynTree is now a global dependency
diegoferigo Nov 8, 2017
d73ea70
Link the project against the MxAnyType library
diegoferigo Nov 8, 2017
d1bc775
New PID and WBTPIDConfig matlab classes
diegoferigo Nov 8, 2017
82b760b
Matlab functions used by Blocks which inherit from WBBlock class
diegoferigo Nov 8, 2017
68dc010
New getStdVector() method in Signal
diegoferigo Nov 9, 2017
3bbad1f
BlockInformation is now a const pointer, changed indentation in cpp
diegoferigo Nov 10, 2017
579174b
Switched to std::array for storing the gravity vector
diegoferigo Nov 13, 2017
8c61547
Switched to std::unique_ptr for PolyDriver member
diegoferigo Nov 13, 2017
a3c61c5
Changed the name of the getDevice template to getInterfaceFromTemplate
diegoferigo Nov 13, 2017
1dd9789
Removed Eigen from AnyType and MxAnyType
diegoferigo Nov 13, 2017
d4dd040
Disabled InverseKinematics block
diegoferigo Nov 13, 2017
f2f31ca
Switched to smart pointers for private members of all the blocks
diegoferigo Nov 13, 2017
e0e7a92
Forgot class scope for two static methods
diegoferigo Nov 13, 2017
f64da6e
Follow links in Simulink model inspection for finding the Config Block
diegoferigo Nov 21, 2017
eb0e1b7
Retaining the RemoteControlBoardRemapper needs a unique port prefix
diegoferigo Nov 21, 2017
1f3f8a2
Switch from smart pointers to raw pointers for Yarp interfaces
diegoferigo Nov 21, 2017
9b90b9e
Updated Blocks for using raw pointers to Yarp interfaces
diegoferigo Nov 21, 2017
a01cecf
Block which inherith from WBBlocks now terminate correctly
diegoferigo Nov 21, 2017
ed7dd92
Switched ands from bitwise to logical
diegoferigo Nov 21, 2017
d4a6433
Check smart pointer status before using the KinDynComputations object
diegoferigo Nov 21, 2017
9b3180a
GetLimits: missing deg2rad conversion and typo for invalid joint check
diegoferigo Nov 21, 2017
5c9912c
GetMeasurement: changed some member names for clarity
diegoferigo Nov 21, 2017
3a0d018
SetReferences: Position mode now calls setRefSpeeds()
diegoferigo Nov 21, 2017
9993d13
ModelPartitioner: fixed the forwarding of i/o data
diegoferigo Nov 21, 2017
212ffaf
YarpRead: fixed indexing of signals
diegoferigo Nov 21, 2017
9cb9aa8
Improved logging support and log messages
diegoferigo Nov 21, 2017
e210a17
Initialize to nullptr the buffers of the Signal class
diegoferigo Nov 21, 2017
8ea9fe7
Use const arguments in Configuration::setParameters()
diegoferigo Nov 21, 2017
dc20f9a
Fix passing booleans as mask parameters
diegoferigo Nov 21, 2017
3a1941c
Added method for extractring a struct from Matlab's WBTPIDConfig class
diegoferigo Nov 21, 2017
f20f521
Typo in Mask2WBToolboxConfig.m script
diegoferigo Nov 21, 2017
ed2d5de
Disable IK blocks
diegoferigo Nov 21, 2017
3353232
Use system Matlab headers in MxAnyType library
diegoferigo Nov 28, 2017
b695ad4
Moved +WBToolbox folder into toolbox/
diegoferigo Nov 28, 2017
00911ae
Fixed DotJNu output variable
diegoferigo Nov 29, 2017
e24edee
Signal class rewritten
diegoferigo Nov 29, 2017
930b9e4
Fixed the parsing of the gravity vector
diegoferigo Nov 29, 2017
c923906
Moved the update of robot state into WBBlock
diegoferigo Nov 29, 2017
fc50b08
Updated all blocks to the new Signal class and WBBlock::setRobotState
diegoferigo Nov 29, 2017
b922c54
New SetReferences mask param to set the reference speed (Position mode)
diegoferigo Nov 29, 2017
7ca1c9c
Cleaned CMakeLists.txt and folder structure, updated library
diegoferigo Nov 29, 2017
6d882b5
[Squash] Update lib
diegoferigo Dec 1, 2017
163ddeb
Explicitly set the velocity representation in iDynTree
diegoferigo Dec 1, 2017
98aafcc
Fixed the generalized torques conversion of InverseDynamics block
diegoferigo Dec 6, 2017
5480fae
Updated README.md
diegoferigo Dec 6, 2017
47f3b5a
Added Migration How-To from 2.0 to 3.0
diegoferigo Dec 6, 2017
edf4a58
Included the support of a new DiscreteFilter Block
diegoferigo Aug 9, 2017
73c1c4e
First working version of DiscreteFilter block with 1D I/O signal
diegoferigo Aug 10, 2017
79c0c57
DiscreteFilter: Multidimesional signal support
diegoferigo Aug 10, 2017
a49d7b9
Updated library
diegoferigo Aug 11, 2017
ee56684
Avoid problems on streams due to system's locale
diegoferigo Aug 11, 2017
5737e5e
Included support to console debug messages
diegoferigo Aug 11, 2017
0238299
Minor indentation change
diegoferigo Aug 11, 2017
077d986
DiscreteFilter: Included parameters for initializing input / output
diegoferigo Aug 11, 2017
b8ba0fe
Updated library
diegoferigo Aug 11, 2017
4791efe
DiscreteFilter: improved behavior of optional parameters
diegoferigo Aug 11, 2017
189df02
Reduced memory allocations
diegoferigo Aug 11, 2017
fafaaf1
DiscreteFilter: uploaded test model
diegoferigo Aug 11, 2017
580e430
Rebased DiscreteFilter block on WB3.0
diegoferigo Dec 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# Copyright (C) 2013-2015 Instituto Italiano di Tecnologia
# Author: Jorhabib Eljaik, Francesco Romano
# Copyright (C) 2013-2017 iCub Facility - Istituto Italiano di Tecnologia
# Author: Jorhabib Eljaik, Francesco Romano, Diego Ferigo
# CopyPolicy: Released under the terms of the GNU GPL v2.0.

cmake_minimum_required(VERSION 2.8.11)

cmake_minimum_required(VERSION 3.3)
project(WB-Toolbox)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(YCM REQUIRED)
include(YCMDefaultDirs)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(WB-TOOLBOX_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/share/WB-Toolbox")

add_subdirectory(MxAnyType)
add_subdirectory(toolbox)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images DESTINATION ${WB-TOOLBOX_SHARE_DIR})
Expand Down
51 changes: 51 additions & 0 deletions MxAnyType/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_policy(SET CMP0048 NEW)
project(MxAnyType LANGUAGES CXX VERSION 0.1)
cmake_minimum_required(VERSION 3.0.2)

# Configure the project
# =====================
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(GNUInstallDirs)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# Use a general prefix for the project
set(VARS_PREFIX ${PROJECT_NAME})
# set(VARS_PREFIX "MxAnyType")

# Build the library
# =================

# Export the includes needed to who inherits this library
# Set this up properly for handling either BUILD and INSTALL trees
set(${VARS_PREFIX}_INCLUDE_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(${VARS_PREFIX}_INCLUDE_INSTALL ${CMAKE_INSTALL_INCLUDEDIR}/${VARS_PREFIX})

# Add the target
add_library(${VARS_PREFIX} STATIC ${CMAKE_CURRENT_SOURCE_DIR}/include/AnyType.h
${CMAKE_CURRENT_SOURCE_DIR}/include/MxAnyType.h
${CMAKE_CURRENT_SOURCE_DIR}/src/MxAnyType.cpp)


# TODO: temporary, waiting the library becomes a shared
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set_target_properties(${VARS_PREFIX} PROPERTIES COMPILE_FLAGS "-fPIC")
endif()

# Find Matlab resources
find_package(Matlab REQUIRED MX_LIBRARY)
target_include_directories(${VARS_PREFIX} SYSTEM PUBLIC "${Matlab_INCLUDE_DIRS}")

# Setup the include directories
# TODO why in the how to was INTERFACE?
target_include_directories(${VARS_PREFIX} PUBLIC
$<BUILD_INTERFACE:${${VARS_PREFIX}_INCLUDE_BUILD}>
$<INSTALL_INTERFACE:${${VARS_PREFIX}_INCLUDE_INSTALL}>)

# Assign some useful properties
# set_target_properties(${VARS_PREFIX} PROPERTIES VERSION ${PROJECT_VERSION}
# PUBLIC_HEADER MxAnyType.h)

# Build tests
# ===========
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests)
61 changes: 61 additions & 0 deletions MxAnyType/include/AnyType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef ANYTYPE_H
#define ANYTYPE_H

#include <vector>
#include <unordered_map>
#include <memory>

class AnyType;

typedef std::shared_ptr<AnyType> AnyTypeSPtr;
typedef std::vector<AnyTypeSPtr> AnyCell;
typedef std::unordered_map<std::string, AnyTypeSPtr> AnyStruct;

class AnyType
{
protected:

public:
AnyType() = default;
virtual ~AnyType() = default;

// Integers
virtual bool asInt(int& i) = 0;
// virtual bool asInt8(int8_t& i) = 0;
// virtual bool asInt16(int16_t& i) = 0;
virtual bool asInt32(int32_t& i) = 0;
// virtual bool asInt64(int64_t& i) = 0;

// Unsigned Integers
virtual bool asUInt(unsigned& i) = 0;
// virtual bool asUInt8(uint8_t& i) = 0;
// virtual bool asUInt16(uint16_t& i) = 0;
// virtual bool asUInt32(uint32_t& i) = 0;
// virtual bool asUInt64(uint64_t& i) = 0;

// Boolean
virtual bool asBool(bool& b) = 0;

// Floating-point
// virtual bool asFloat(float& f) = 0;
virtual bool asDouble(double& d) = 0;

// Characters
virtual bool asString(std::string& s) = 0;

// Struct
virtual bool asAnyStruct(AnyStruct& map) = 0;

// Cell array
virtual bool asAnyCell(AnyCell& map) = 0;

// Matrix
// TODO: constraint max 2-dimension
// virtual bool asMatrixFloat(Eigen::MatrixXf mat) = 0;
// virtual bool asMatrixDouble(Eigen::MatrixXd mat) = 0;

// Vector
virtual bool asVectorDouble(std::vector<double>& vec) = 0;
};

#endif /* ANYTYPE_H */
98 changes: 98 additions & 0 deletions MxAnyType/include/MxAnyType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#ifndef MXANYTYPE_H
#define MXANYTYPE_H

#include <vector>
#include <string>
#include <unordered_map>
#include <cassert>
#include "AnyType.h"
#include "matrix.h"

class MxAnyType;

// If needed in the future
// class MxAnyCell : public AnyCell {};
// class MxAnyStruct : public AnyStruct {};

struct MxArrayMetadata {
mxClassID id;
bool isScalar;
size_t rows;
size_t cols;
size_t nElem;
size_t nDims;
std::vector<size_t> dims;
};

class MxAnyType : public AnyType
{
private:
const mxArray* mx;
MxArrayMetadata md;
bool validate;

// TODO: https://it.mathworks.com/help/matlab/apiref/mxgetscalar.html returns a double always
bool asScalar(double& d);
bool validateClassId(mxClassID id1, mxClassID id2);

// mxArray* getMxArrayPtr() const { return static_cast<mxArray*>(getAnyDataPtr()); }

public:
// void* getAnyDataPtr() const override {
// return (void*) mx;
// }

MxAnyType();
MxAnyType(const mxArray* m, bool validateId = false);
~MxAnyType() = default;
MxAnyType(const MxAnyType& mxAnyType);

void enableClassIDValidation();

// STRING / CHARS
// ==============

bool asString(std::string& s) override;

// SCALAR TYPES
// ============

// Generic casting
// ---------------

bool asInt(int& i) override;
bool asUInt(unsigned& i) override;

// Specific casting
// ----------------

bool asInt32(int32_t& i) override;

// TODO: complete with all the other scalar types
// bool asInt64(int64_t& i) override
// {
// double buffer;
// if (!asScalar(buffer)) return false;
// i = static_cast<int64_t>(buffer);
// return validateClassId(md.id, mxINT64_CLASS);
// }

bool asDouble(double& d) override;
bool asBool(bool& b) override;

// COMPOSITE DATA TYPES
// ====================

bool asAnyStruct(AnyStruct& s) override;
bool asAnyCell(AnyCell& cell) override;

// MATRIX
// ======

// VECTOR
// ======

bool asVectorDouble(std::vector<double>& vec) override;
};

#endif /* MXANYTYPE_H */
Loading