Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91751157
OncillaL1L2Test.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 14, 02:38
Size
2 KB
Mime Type
text/x-c++
Expires
Sat, Nov 16, 02:38 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22312147
Attached To
R6622 liboncilla
OncillaL1L2Test.cpp
View Options
#include <gtest/gtest.h>
#include "liboncilla/OncillaL1L2.h"
#include "liboncilla/OncillaSynchronizer.h"
using namespace nemo;
using namespace rci;
using namespace rci::oncilla;
class MockSynchronizer: public OncillaSynchronizer {
public:
MockSynchronizer() :
OncillaSynchronizer("Sync") {
}
virtual void processAsync() {
}
virtual void waitForProcessAsync() {
}
virtual void registerTrunkNode(rci::oncilla::OncillaTrunkPtr) {
}
virtual void registerL0Node(rci::oncilla::Oncilla::Leg,
rci::oncilla::OncillaL0Ptr) {
}
virtual void registerL1Node(rci::oncilla::Oncilla::Leg,
rci::oncilla::OncillaL1Ptr) {
}
virtual void registerL2Node(rci::oncilla::Oncilla::Leg,
rci::oncilla::OncillaL2Ptr) {
}
virtual void registerL3Node(rci::oncilla::Oncilla::Leg,
rci::oncilla::OncillaL3Ptr) {
}
virtual void registerL4Node(rci::oncilla::Oncilla::Leg,
rci::oncilla::OncillaL4Ptr) {
}
virtual double latestProcessLoopDurationPrimpl() const {
return 0.005;
}
virtual void switchToSynchronizationModeHook(){
}
};
class OncillaL1L2Test: public ::testing::Test {
protected:
OncillaL1L2Test() :
joint(), ja_values(), ji_values(), ja(), ji(), synchr() {
joint = OncillaL1Ptr(new OncillaL1L2(synchr, "FooBar"));
ja_values = RealVector(dim(1), 1.234);
ji_values = RealVector(dim(2), 1.234);
ji_values[1] = 2.345;
ja = JointAngles::fromRad(ja_values);
ji = JointImpedancePtr(new JointImpedance(ji_values));
}
virtual ~OncillaL1L2Test() {
}
OncillaL1Ptr joint;
RealVector ja_values, ji_values;
JointAnglesPtr ja;
JointImpedancePtr ji;
MockSynchronizer synchr;
};
TEST_F(OncillaL1L2Test, testInitialialState)
{
EXPECT_NO_THROW(joint->getLastPositionCommand());
EXPECT_EQ(0.0,joint->getLastPositionCommand()->rad());
}
TEST_F(OncillaL1L2Test, testPositionCommand)
{
EXPECT_NO_THROW(joint->getLastPositionCommand());
EXPECT_EQ(0.0,joint->getLastPositionCommand()->rad());
joint->setJointPosition(ja);
EXPECT_EQ(1.234, joint->getLastPositionCommand()->rad());
}
Event Timeline
Log In to Comment