From c05391ed40562010171a3e2324836e30bda67cbd Mon Sep 17 00:00:00 2001 From: Markus Swarowsky <markus.swarowsky@student.kit.edu> Date: Thu, 2 Mar 2017 21:57:50 +0100 Subject: [PATCH] target get set to 0 at activation of pass through controller also added PlatformTarget --- .../PassThroughController.h | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/source/RobotAPI/libraries/BasicRTControllers/PassThroughController.h b/source/RobotAPI/libraries/BasicRTControllers/PassThroughController.h index acb5582b8..3bdf59b69 100644 --- a/source/RobotAPI/libraries/BasicRTControllers/PassThroughController.h +++ b/source/RobotAPI/libraries/BasicRTControllers/PassThroughController.h @@ -34,6 +34,7 @@ #include <RobotAPI/libraries/RobotRTControllers/Targets/JointTorqueTarget.h> #include <RobotAPI/libraries/RobotRTControllers/Targets/JointVelocityTarget.h> #include <RobotAPI/libraries/RobotRTControllers/DataUnits/KinematicDataUnit.h> +#include <RobotAPI/libraries/RobotRTControllers/Targets/PlatformWheelVelocityTarget.h> namespace armarx { @@ -134,9 +135,38 @@ namespace armarx } }; + template <> + struct PassThroughControllerTargetTypeTraits<PlatformWheelVelocityTarget> + { + static float* getTargetDatamember(PlatformWheelVelocityTarget& t) + { + return &t.velocity; + } + static const float* getFrontRightWheelVelocity(const PlatformDataUnitInterface* pu) + { + return pu->getFrontRightWheelVelocity(); + } + static const float* getFrontLeftWheelVelocity(const PlatformDataUnitInterface* pu) + { + return pu->getFrontLeftWheelVelocity(); + } + static const float* getRearRightWheelVelocity(const PlatformDataUnitInterface* pu) + { + return pu->getRearRightWheelVelocity(); + } + static const float* getRearLeftWheelVelocity(const PlatformDataUnitInterface* pu) + { + return pu->getRearLeftWheelVelocity(); + } + static std::string getControlMode() + { + return ControlModes::VelocityMode; + } + }; + LVL1ControllerRegistration<PassThroughController<JointPositionTarget>> registrationSomeControllerPositionPassThroughController("PositionPassThroughController"); LVL1ControllerRegistration<PassThroughController<JointVelocityTarget>> registrationSomeControllerVelocityPassThroughController("VelocityPassThroughController"); - LVL1ControllerRegistration<PassThroughController<JointTorqueTarget >> registrationSomeControllerJointPassThroughController("JointPassThroughController"); + LVL1ControllerRegistration<PassThroughController<JointTorqueTarget >> registrationSomeControllerJointPassThroughController("TorquePassThroughController"); template <typename TargetType> std::string PassThroughController<TargetType>::getClassName(const Ice::Current&) const @@ -194,6 +224,8 @@ namespace armarx for (std::size_t i = 0; i < jointStates.size(); ++i) { iceTargets.at(i).val.store(*jointStates.at(i)); + //set it to zero + iceTargets.at(i).val.store(0.0); } } -- GitLab