diff --git a/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.cpp b/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.cpp index 222b7f42c475ca3645676bb4460a822f62328b48..1a8943ff48d03c398ffe3d6ac7e37e191b766e51 100755 --- a/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.cpp +++ b/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.cpp @@ -133,17 +133,17 @@ namespace armarx } - void NJointHolonomicPlatformGlobalPositionController::setGlobalPos(float x, float y, float yaw, const IceUtil::Time& time = ::IceUtil::Time::now()) + void NJointHolonomicPlatformGlobalPositionController::setGlobalPos(const PlatformPose& currentPose) { // ..todo:: lock :) - getWriterControlStruct().globalPosition << x, y; - getWriterControlStruct().globalOrientation = yaw; + getWriterControlStruct().globalPosition << currentPose.x, currentPose.y; + getWriterControlStruct().globalOrientation = currentPose.rotationAroundZ; getWriterControlStruct().startPosition = currentPosition; getWriterControlStruct().startOrientation = currentOrientation; - getWriterControlStruct().lastUpdate = time; + getWriterControlStruct().lastUpdate = IceUtil::Time::microSeconds(currentPose.timestampInMicroSeconds); writeControlStruct(); } diff --git a/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.h b/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.h index b151f38024bbd08336f3aed67d89f98215bbad36..c6c7e6cd9f044c814fae30bf216c005f674963ad 100755 --- a/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.h +++ b/source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformGlobalPositionController.h @@ -102,7 +102,7 @@ namespace armarx void setTarget(float x, float y, float yaw, float translationAccuracy, float rotationAccuracy); - void setGlobalPos(float x, float y, float yaw, const IceUtil::Time&); + void setGlobalPos(const PlatformPose& currentPose); protected: diff --git a/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.cpp b/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.cpp old mode 100644 new mode 100755 index 1201da179c7ce4770ae7afffd0230c180b466b6a..f67bb14d7a0df2743ee3d65410f58f768937f1fb --- a/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.cpp +++ b/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.cpp @@ -45,6 +45,7 @@ void armarx::PlatformSubUnit::update(const armarx::SensorAndControl& sc, const J relY = s->relativePositionY; relR = s->relativePositionRotation; + // @@@ CHECK BELOW: if (s->isA<SensorValueHolonomicPlatformAbsolutePosition>()) { @@ -57,6 +58,7 @@ void armarx::PlatformSubUnit::update(const armarx::SensorAndControl& sc, const J currentPose.y = abs(1, 3); currentPose.rotationAroundZ = VirtualRobot::MathTools::eigen4f2rpy(abs)(2); listenerPrx->reportPlatformPose(currentPose); + globalPosCtrl->setGlobalPos(currentPose); } else { @@ -90,7 +92,11 @@ void armarx::PlatformSubUnit::move(Ice::Float vx, Ice::Float vy, Ice::Float vr, void armarx::PlatformSubUnit::moveTo(Ice::Float rx, Ice::Float ry, Ice::Float rr, Ice::Float lac, Ice::Float rac, const Ice::Current&) { - ARMARX_WARNING << "NYI"; + globalPosCtrl->setTarget(rx, ry, rr, lac, rac); + if (!globalPosCtrl->isControllerActive()) + { + globalPosCtrl->activateController(); + }; } void armarx::PlatformSubUnit::moveRelative(Ice::Float rx, Ice::Float ry, Ice::Float rr, Ice::Float lac, Ice::Float rac, const Ice::Current&) @@ -138,3 +144,25 @@ Eigen::Matrix4f armarx::PlatformSubUnit::getRelativePose() const rp(1, 3) = relY; return rp; } + + +void armarx::PlatformSubUnit::reportPlatformPose(PlatformPose const& currentPose, const Ice::Current& c) +{ + globalPosCtrl->setGlobalPos(currentPose); +} + +void armarx::PlatformSubUnit::reportNewTargetPose(Ice::Float newPlatformPositionX, Ice::Float newPlatformPositionY, Ice::Float newPlatformRotation, const Ice::Current& c) +{ + +} + +void armarx::PlatformSubUnit::reportPlatformVelocity(Ice::Float currentPlatformVelocityX, Ice::Float currentPlatformVelocityY, Ice::Float currentPlatformVelocityRotation, const Ice::Current& c) +{ + +} + + + +void armarx::PlatformSubUnit::reportPlatformOdometryPose(Ice::Float, Ice::Float, Ice::Float, const Ice::Current&) +{ +} diff --git a/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.h b/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.h old mode 100644 new mode 100755 index 428cc7c295396938bed6d9d6210296dc14ffe65d..7420f33e06d32adbbcc66d1b0ed09dc66effdfd5 --- a/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.h +++ b/source/RobotAPI/components/units/RobotUnit/Units/PlatformSubUnit.h @@ -44,7 +44,8 @@ namespace armarx TYPEDEF_PTRS_HANDLE(PlatformSubUnit); class PlatformSubUnit: virtual public RobotUnitSubUnit, - virtual public PlatformUnit + virtual public PlatformUnit, + virtual public PlatformSubUnitInterface { public: void update(const SensorAndControl& sc, const JointAndNJointControllers& c) override; @@ -59,8 +60,18 @@ namespace armarx virtual void setGlobalPose(PoseBasePtr globalPose, const Ice::Current& = Ice::emptyCurrent) /*override*/; virtual PoseBasePtr getGlobalPose(const Ice::Current& = Ice::emptyCurrent) /*override*/; + + void reportPlatformPose(PlatformPose const& currentPose, const Ice::Current& c = ::Ice::Current()) override ; + void reportNewTargetPose(Ice::Float newPlatformPositionX, Ice::Float newPlatformPositionY, Ice::Float newPlatformRotation, const Ice::Current& c = ::Ice::Current()) override; + void reportPlatformVelocity(Ice::Float currentPlatformVelocityX, Ice::Float currentPlatformVelocityY, Ice::Float currentPlatformVelocityRotation, const Ice::Current& c = ::Ice::Current()) override; + + void reportPlatformOdometryPose(::Ice::Float, ::Ice::Float, ::Ice::Float, const ::Ice::Current& = ::Ice::Current()) override; + // PlatformUnit interface - void onInitPlatformUnit() override {} + void onInitPlatformUnit() override + { + usingTopic("PlatformState"); + } void onStartPlatformUnit() override {} void onExitPlatformUnit() override {} void stopPlatform(const Ice::Current& c = Ice::emptyCurrent) override; diff --git a/source/RobotAPI/interface/units/PlatformUnitInterface.ice b/source/RobotAPI/interface/units/PlatformUnitInterface.ice index bec45c18e866a544a7a419f912c3169773187200..5472c33e9c7e8aef1d6fac076146ac2faac3c9fe 100644 --- a/source/RobotAPI/interface/units/PlatformUnitInterface.ice +++ b/source/RobotAPI/interface/units/PlatformUnitInterface.ice @@ -109,5 +109,10 @@ module armarx void reportPlatformOdometryPose(float x, float y, float angle); }; + interface PlatformSubUnitInterface extends PlatformUnitInterface, PlatformUnitListener + { + + }; + };