diff --git a/src/liboncilla-webots/WebotsL3Adapter.cpp b/src/liboncilla-webots/WebotsL3Adapter.cpp index 27cd788..d9b99f1 100644 --- a/src/liboncilla-webots/WebotsL3Adapter.cpp +++ b/src/liboncilla-webots/WebotsL3Adapter.cpp @@ -1,33 +1,39 @@ /** * \file WebotsL3Adapter.cpp * * \date Jan 27, 2012 * \author Alexandre Tuleu */ #include "WebotsL3Adapter.h" using namespace rci::oncilla; WebotsL3Adapter::WebotsL3Adapter(OncillaL3Ptr node, webots::Servo * servo) : d_node(node) , d_servo(*servo){ if(!servo){ throw std::logic_error("Unvalid webots::Servo handle."); } } WebotsL3Adapter::~WebotsL3Adapter(){ } void WebotsL3Adapter::SendCommand(){/*Nothing to do*/} void WebotsL3Adapter::Step(double ts){/*Nothing ot do*/} void WebotsL3Adapter::ReadSensors(){ - ///\todo implement ! - //throw std::runtime_error("ReadSensor of WebotsL3Adpater is not implemented yet"); + d_node->unsafeUpdatePosition(d_servo.getPosition()); } +void WebotsL3Adapter::Activate(){ + d_servo.enablePosition(1); +} + +void WebotsL3Adapter::DeActivate(){ + d_servo.disablePosition(); +} diff --git a/src/liboncilla-webots/WebotsL3Adapter.h b/src/liboncilla-webots/WebotsL3Adapter.h index 083d8b4..4ebae7e 100644 --- a/src/liboncilla-webots/WebotsL3Adapter.h +++ b/src/liboncilla-webots/WebotsL3Adapter.h @@ -1,36 +1,39 @@ /** * \file WebotsL3Adapter.h * * \date Jan 27, 2012 * \author Alexandre Tuleu */ #ifndef LIBONCILLA_WEBOTS_WEBOTSL3ADAPTER_H_ #define LIBONCILLA_WEBOTS_WEBOTSL3ADAPTER_H_ #include <liboncilla/OncillaL3.h> #include "WebotsNodeAdapter.h" #include "webots/Servo.hpp" /** + * Implementation of OncillaL3 joint. * + * Right now just read data from the P1/P2 - L3 joint. Some transformation + * should be done in the future once the hardware will be better defined. */ class WebotsL3Adapter : public WebotsNodeAdapter{ public: WebotsL3Adapter(rci::oncilla::OncillaL3Ptr node, webots::Servo * servo); virtual ~WebotsL3Adapter(); void SendCommand(); void Step(double ts); void ReadSensors(); - void Activate(){}; - void DeActivate(){}; + void Activate(); + void DeActivate(); private: rci::oncilla::OncillaL3Ptr d_node; webots::Servo & d_servo; }; #endif // LIBONCILLA_WEBOTS_WEBOTSL3ADAPTER_H_