Skip to content
Snippets Groups Projects
Commit cefef332 authored by Markus Swarowsky's avatar Markus Swarowsky
Browse files

added the PlatformWheelVelocityTarget;

changed the JointTargetBase to a general TargetBase;
added wheel speed reporting to the PlatformDataUnit
parent bfda0a2d
No related branches found
No related tags found
No related merge requests found
Showing
with 125 additions and 19 deletions
......@@ -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
......
......@@ -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;
};
}
......
......@@ -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()
......
......@@ -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;
};
......
......@@ -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))
......
......@@ -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:
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //
......
......@@ -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"
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
/*
* 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
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment