Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91275977
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
Sat, Nov 9, 14:19
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Nov 11, 14:19 (2 d)
Engine
blob
Format
Raw Data
Handle
22234619
Attached To
R6622 liboncilla
OncillaL1L2Test.cpp
View Options
#include <gtest/gtest.h>
#include <liboncilla/nodes/L1L2.h>
#include "liboncilla/Synchronizer.h"
using
namespace
nemo
;
using
namespace
rci
;
using
namespace
rci
::
oncilla
;
class
MockSynchronizer
:
public
::
rci
::
oncilla
::
Synchronizer
{
public
:
MockSynchronizer
()
:
Synchronizer
(
"Sync"
)
{
}
virtual
void
ProcessAsyncPrimpl
()
{
}
virtual
void
WaitForProcessAsyncPrimpl
()
{
}
virtual
double
lastProcessTimeStep
()
const
{
return
0.005
;
}
virtual
void
switchToSynchronizationModeHook
(){
}
};
class
OncillaL1L2Test
:
public
::
testing
::
Test
{
protected
:
OncillaL1L2Test
()
:
joint
(),
ja_values
(),
ji_values
(),
ja
(),
ji
(),
synchr
()
{
joint
=
rci
::
oncilla
::
L1
::
Ptr
(
new
L1
(
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
()
{
}
rci
::
oncilla
::
L1L2
::
Ptr
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