Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90759169
OncillaL01.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
Mon, Nov 4, 12:18
Size
2 KB
Mime Type
text/x-c
Expires
Wed, Nov 6, 12:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22129838
Attached To
R6622 liboncilla
OncillaL01.cpp
View Options
#include "OncillaL01.h"
using
namespace
std
;
namespace
rci
{
namespace
oncilla
{
OncillaL0
::
OncillaL0
(
const
std
::
string
&
name
)
:
ResourceNode
(
name
),
Controlled
(),
PositionControlled
()
{
}
bool
OncillaL0
::
isConverged
()
const
{
return
false
;
}
bool
OncillaL0
::
setJointPosition
(
JointAnglesPtr
position
)
{
// Successfull
this
->
_lastCommandedPosition
=
position
;
return
true
;
}
JointAnglesPtr
OncillaL0
::
getLastPositionCommand
()
const
{
if
(
this
->
_lastCommandedPosition
)
{
return
this
->
_lastCommandedPosition
;
}
throw
runtime_error
(
"No position command received yet."
);
}
OncillaL0
::~
OncillaL0
()
{
}
std
::
string
OncillaL0
::
print
()
const
{
ostringstream
outstream
(
ostringstream
::
out
);
outstream
.
precision
(
3
);
// Precision when printing double values
outstream
<<
"<Oncilla Hip>"
<<
endl
;
return
outstream
.
str
();
}
OncillaL1
::
OncillaL1
(
OncillaSynchronizer
&
s
,
const
std
::
string
&
name
)
:
ResourceNode
(
name
),
Controlled
(),
Sensing
(),
PositionControlled
(),
PositionSensing
(),
TorqueControlled
(),
ImpedanceControlled
(),
synchronizer
(
s
)
{
this
->
_dimension
=
2
;
// Two encoder values - should always be the same
}
bool
OncillaL1
::
isConverged
()
const
{
throw
std
::
runtime_error
(
"Not yet implemented."
);
return
false
;
}
bool
OncillaL1
::
setJointPosition
(
JointAnglesPtr
position
)
{
// Successfull
this
->
_lastCommandedPosition
=
position
;
return
true
;
}
JointAnglesPtr
OncillaL1
::
getJointPosition
()
const
{
return
this
->
_latestJointPosition
;
}
bool
OncillaL1
::
setJointVelocity
(
JointVelocitiesPtr
vel
)
{
throw
std
::
runtime_error
(
"Not yet implemented."
);
}
bool
OncillaL1
::
setJointTorque
(
JointTorquesPtr
torque
)
{
throw
std
::
runtime_error
(
"Not yet implemented."
);
}
bool
OncillaL1
::
setJointImpedance
(
JointImpedancePtr
imped
)
{
if
(
this
->
synchronizer
.
tooBusy
())
{
throw
std
::
runtime_error
(
"Synchronizer has to be switched off to change JointImpedance."
);
}
else
{
throw
std
::
runtime_error
(
"Not yet implemented."
);
}
}
JointAnglesPtr
OncillaL1
::
getLastPositionCommand
()
const
{
if
(
this
->
_lastCommandedPosition
)
{
return
this
->
_lastCommandedPosition
;
}
// If we don`t have a command yet, we return the latest sensor value
if
(
this
->
_latestJointPosition
)
{
// TODO: Log
return
this
->
_latestJointPosition
;
}
throw
runtime_error
(
"No position command received yet."
);
}
OncillaL1
::~
OncillaL1
()
{
}
std
::
string
OncillaL1
::
print
()
const
{
ostringstream
outstream
(
ostringstream
::
out
);
outstream
.
precision
(
3
);
// Precision when printing double values
outstream
<<
"<Oncilla Hip>"
<<
endl
;
return
outstream
.
str
();
}
}
}
Event Timeline
Log In to Comment