diff --git a/source/RobotAPI/libraries/RobotRTControllers/CMakeLists.txt b/source/RobotAPI/libraries/RobotRTControllers/CMakeLists.txt index 1ca0215a847d67d0849493307952c493b8291d74..289708c82bd97fc382f77bef1c020e8ac970f132 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/CMakeLists.txt +++ b/source/RobotAPI/libraries/RobotRTControllers/CMakeLists.txt @@ -21,11 +21,11 @@ set(LIB_FILES set(LIB_HEADERS Constants.h ControlModes.h - - Targets/JointTargetBase.h + Targets/TargetBase.h Targets/JointPositionTarget.h Targets/JointVelocityTarget.h Targets/JointTorqueTarget.h + Targets/PlatformWheelVelocityTarget.h DataUnits/ForceTorqueDataUnit.h DataUnits/HapticDataUnit.h diff --git a/source/RobotAPI/libraries/RobotRTControllers/DataUnits/PlatformDataUnit.h b/source/RobotAPI/libraries/RobotRTControllers/DataUnits/PlatformDataUnit.h index 4d4b70ee04f7493c0569780d06a72a37f6a2791d..cf1930643c0c01d48480f4d6d2237fd5718d8323 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/DataUnits/PlatformDataUnit.h +++ b/source/RobotAPI/libraries/RobotRTControllers/DataUnits/PlatformDataUnit.h @@ -34,6 +34,10 @@ namespace armarx virtual const float* getVelocityX() const = 0; virtual const float* getVelocityY() const = 0; virtual const float* getVelocityRotation() const = 0; + virtual const float* getFrontRightWheelVelocity() const = 0; + virtual const float* getFrontLeftWheelVelocity() const = 0; + virtual const float* getRearRightWheelVelocity() const = 0; + virtual const float* getRearLeftWheelVelocity() const = 0; }; class PlatformDataUnitPtrProvider : public virtual PlatformDataUnitInterface @@ -64,7 +68,48 @@ namespace armarx { return velocityRotation; } + + const float* getFrontRightWheelVelocity() const override + { + return frontRightVelocity; + } + + const float* getFrontLeftWheelVelocity() const override + { + return frontLeftVelocity; + } + + const float* getRearRightWheelVelocity() const override + { + return rearRightVelocity; + } + + const float* getRearLeftWheelVelocity() const override + { + return rearLeftVelocity; + } + protected: + void setFrontRightVelocityPtr(float* velocity) + { + frontRightVelocity = velocity; + } + + void setFrontLeftVelocityPtr(float* velocity) + { + frontRightVelocity = velocity; + } + + void setRearRightVelocityPtr(float* velocity) + { + frontRightVelocity = velocity; + } + + void setRearLeftVelocityPtr(float* velocity) + { + frontRightVelocity = velocity; + } + float* positionX; float* positionY; float* rotation; @@ -72,6 +117,11 @@ namespace armarx float* velocityX; float* velocityY; float* velocityRotation; + + float* frontRightVelocity; + float* frontLeftVelocity; + float* rearRightVelocity; + float* rearLeftVelocity; }; } diff --git a/source/RobotAPI/libraries/RobotRTControllers/LVL0Controller.h b/source/RobotAPI/libraries/RobotRTControllers/LVL0Controller.h index 403565e80da9998f1959081a39b0904636a0e7b8..707f920088ed506caa7d8abfd4aab15a961a75e5 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/LVL0Controller.h +++ b/source/RobotAPI/libraries/RobotRTControllers/LVL0Controller.h @@ -23,7 +23,7 @@ #ifndef _ARMARX_LIB_RobotAPI_LVL0Controller_H #define _ARMARX_LIB_RobotAPI_LVL0Controller_H -#include "Targets/JointTargetBase.h" +#include "Targets/TargetBase.h" #include <memory> @@ -36,7 +36,7 @@ namespace armarx { public: virtual void run(const IceUtil::Time& sensorValuesTimestamp, const IceUtil::Time& timeSinceLastIteration) = 0; - virtual JointTargetBase* getTarget() const = 0; + virtual TargetBase* getTarget() const = 0; virtual void resetTarget() diff --git a/source/RobotAPI/libraries/RobotRTControllers/LVL1Controller.h b/source/RobotAPI/libraries/RobotRTControllers/LVL1Controller.h index aa19370a1e71bc7cdd6c218ea264bebcc482b3eb..7c525d1525de28f8bdf93001ae9d6ae3183c660c 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/LVL1Controller.h +++ b/source/RobotAPI/libraries/RobotRTControllers/LVL1Controller.h @@ -35,7 +35,7 @@ #include <RobotAPI/interface/libraries/RTControllers/LVL1Controller.h> -#include "Targets/JointTargetBase.h" +#include "Targets/TargetBase.h" //units #include "DataUnits/ForceTorqueDataUnit.h" @@ -55,7 +55,7 @@ namespace armarx virtual const KinematicDataUnitInterface* getRTKinematicDataUnit() const = 0; virtual const PlatformDataUnitInterface* getRTPlatformDataUnit() const = 0; - virtual JointTargetBase* getJointTarget(const std::string& jointName, const std::string& controlMode) = 0; + virtual TargetBase* getJointTarget(const std::string& jointName, const std::string& controlMode) = 0; virtual std::string getName() const = 0; }; diff --git a/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.cpp b/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.cpp index 4c0c6188046a6d502affef48993f09bd396740f7..c10b03c2f32e69f20bd6b215d60c5a6fd8750801 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.cpp +++ b/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.cpp @@ -361,7 +361,7 @@ armarx::LVL1ControllerInterfacePrx armarx::RobotUnit::loadController(const std:: return LVL1ControllerInterfacePrx::uncheckedCast(prx); } -armarx::JointTargetBase* armarx::RobotUnit::getJointTarget(const std::string& jointName, const std::string& controlMode) +armarx::TargetBase* armarx::RobotUnit::getJointTarget(const std::string& jointName, const std::string& controlMode) { GuardType guard {dataMutex}; if (!hasLVL0Controller(jointName, controlMode)) diff --git a/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.h b/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.h index bf0b29c1c3286679e8e57e84723dcd03ddc93f3e..29b64a714f907e0204d84b1d7aaf1ef59fede61d 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.h +++ b/source/RobotAPI/libraries/RobotRTControllers/RobotUnit.h @@ -231,7 +231,7 @@ namespace armarx virtual const KinematicDataUnitInterface* getRTKinematicDataUnit() const = 0; virtual const PlatformDataUnitInterface* getRTPlatformDataUnit() const = 0; //targets (nonrt but results are used in rt) - virtual JointTargetBase* getJointTarget(const std::string& jointName, const std::string& controlMode) override; + virtual TargetBase* getJointTarget(const std::string& jointName, const std::string& controlMode) override; protected: // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/source/RobotAPI/libraries/RobotRTControllers/SyntaxCheck.cpp b/source/RobotAPI/libraries/RobotRTControllers/SyntaxCheck.cpp index 8e6bcbcfec592de5e7bbeab05dee116fe7eba4af..537a95b05e346be4e757283dee548af8e73bdfe0 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/SyntaxCheck.cpp +++ b/source/RobotAPI/libraries/RobotRTControllers/SyntaxCheck.cpp @@ -31,7 +31,7 @@ #include "DataUnits/PlatformDataUnit.h" #include "Targets/JointPositionTarget.h" -#include "Targets/JointTargetBase.h" +#include "Targets/TargetBase.h" #include "Targets/JointTorqueTarget.h" #include "Targets/JointVelocityTarget.h" diff --git a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointPositionTarget.h b/source/RobotAPI/libraries/RobotRTControllers/Targets/JointPositionTarget.h index 6e7205de9349dcbe43b5df2303239f356930092f..2fe706d361672c09f0d8b0c1e9e548e76b893e58 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointPositionTarget.h +++ b/source/RobotAPI/libraries/RobotRTControllers/Targets/JointPositionTarget.h @@ -23,7 +23,7 @@ #ifndef _ARMARX_LIB_RobotAPI_JointPositionTarget_H #define _ARMARX_LIB_RobotAPI_JointPositionTarget_H -#include "JointTargetBase.h" +#include "TargetBase.h" namespace armarx { @@ -38,7 +38,7 @@ namespace armarx * * Detailed description of class JointPositionTarget. */ - class JointPositionTarget: public JointTargetBase + class JointPositionTarget: public TargetBase { public: float position = ControllerConstants::ValueNotSetNaN; diff --git a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointTorqueTarget.h b/source/RobotAPI/libraries/RobotRTControllers/Targets/JointTorqueTarget.h index 9421f2218a76b28cc39f294954ca65bde85f7ee4..0c70ed9a03735db69c57beb3a01c666f107304c6 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointTorqueTarget.h +++ b/source/RobotAPI/libraries/RobotRTControllers/Targets/JointTorqueTarget.h @@ -23,7 +23,7 @@ #ifndef _ARMARX_LIB_RobotAPI_JointTorqueTarget_H #define _ARMARX_LIB_RobotAPI_JointTorqueTarget_H -#include "JointTargetBase.h" +#include "TargetBase.h" namespace armarx { @@ -38,7 +38,7 @@ namespace armarx * * Detailed description of class JointTorqueTarget. */ - class JointTorqueTarget: public JointTargetBase + class JointTorqueTarget: public TargetBase { public: float torque = ControllerConstants::ValueNotSetNaN; diff --git a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointVelocityTarget.h b/source/RobotAPI/libraries/RobotRTControllers/Targets/JointVelocityTarget.h index a4b307de90de0385d8ef16ade0ab90decc5fa43e..1c6296d950b7d1a1a7642f768409b2e1f662ad15 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointVelocityTarget.h +++ b/source/RobotAPI/libraries/RobotRTControllers/Targets/JointVelocityTarget.h @@ -23,7 +23,7 @@ #ifndef _ARMARX_LIB_RobotAPI_JointVelocityTarget_H #define _ARMARX_LIB_RobotAPI_JointVelocityTarget_H -#include "JointTargetBase.h" +#include "TargetBase.h" namespace armarx { @@ -38,7 +38,7 @@ namespace armarx * * Detailed description of class JointVelocityTarget. */ - class JointVelocityTarget: public JointTargetBase + class JointVelocityTarget: public TargetBase { public: float velocity = ControllerConstants::ValueNotSetNaN; @@ -55,7 +55,6 @@ namespace armarx return std::isfinite(velocity); } }; - } #endif diff --git a/source/RobotAPI/libraries/RobotRTControllers/Targets/PlatformWheelVelocityTarget.h b/source/RobotAPI/libraries/RobotRTControllers/Targets/PlatformWheelVelocityTarget.h new file mode 100644 index 0000000000000000000000000000000000000000..c2bafb0adb4cb68407667fbf5db85c2eb9eb7ea6 --- /dev/null +++ b/source/RobotAPI/libraries/RobotRTControllers/Targets/PlatformWheelVelocityTarget.h @@ -0,0 +1,57 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), + * Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX 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/>. + * + * @author Markus Swarowsky (markus dot swarowsky at student dot kit dot edu) + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + + +#ifndef _ARMARX_LIB_RobotAPI_PLATFORMWHEELTARGET_H +#define _ARMARX_LIB_RobotAPI_PLATFORMWHEELTARGET_H + + +#include "TargetBase.h" + + +namespace armarx +{ + + class PlatformWheelVelocityTarget : public TargetBase + { + public: + float velocity = ControllerConstants::ValueNotSetNaN; + virtual std::string getControlMode() const override + { + return ControlModes::VelocityMode; + } + virtual void reset() override + { + velocity = ControllerConstants::ValueNotSetNaN; + } + virtual bool isValid() const override + { + return std::isfinite(velocity); + } + + private: + }; + +} + +#endif //_ARMARX_LIB_RobotAPI_PLATFORMWHEELTARGET_H diff --git a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointTargetBase.h b/source/RobotAPI/libraries/RobotRTControllers/Targets/TargetBase.h similarity index 93% rename from source/RobotAPI/libraries/RobotRTControllers/Targets/JointTargetBase.h rename to source/RobotAPI/libraries/RobotRTControllers/Targets/TargetBase.h index 3f9736b89a32d299bcaa4897d24dba4cd6e02dc5..d303e24ebcb1ff546bcb8bd68d485f50f6b1fb12 100644 --- a/source/RobotAPI/libraries/RobotRTControllers/Targets/JointTargetBase.h +++ b/source/RobotAPI/libraries/RobotRTControllers/Targets/TargetBase.h @@ -34,13 +34,13 @@ namespace armarx * @ingroup RobotAPI * A description of the library RobotRTControllers. * - * @class JointTargetBase + * @class TargetBase * @ingroup Library-RobotRTControllers * @brief Brief description of class JointTargetBase. * - * Detailed description of class JointTargetBase. + * Detailed description of class TargetBase. */ - class JointTargetBase + class TargetBase { public: virtual std::string getControlMode() const = 0;