Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96982888
OncillaL1Test.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
Wed, Jan 1, 08:00
Size
2 KB
Mime Type
text/x-c++
Expires
Fri, Jan 3, 08:00 (2 d)
Engine
blob
Format
Raw Data
Handle
23305367
Attached To
R6622 liboncilla
OncillaL1Test.cpp
View Options
#include <gtest/gtest.h>
#include "OncillaL1.h"
#include "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
OncillaL1Test
:
public
::
testing
::
Test
{
protected
:
OncillaL1Test
()
:
joint
(),
ja_values
(),
ji_values
(),
ja
(),
ji
(),
synchr
()
{
joint
=
OncillaL1Ptr
(
new
OncillaL1
(
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
~
OncillaL1Test
()
{
}
OncillaL1Ptr
joint
;
RealVector
ja_values
,
ji_values
;
JointAnglesPtr
ja
;
JointImpedancePtr
ji
;
MockSynchronizer
synchr
;
};
TEST_F
(
OncillaL1Test
,
testInitialialState
)
{
EXPECT_NO_THROW
(
joint
->
getLastPositionCommand
());
EXPECT_EQ
(
0.0
,
joint
->
getLastPositionCommand
()
->
rad
());
}
TEST_F
(
OncillaL1Test
,
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