Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
dynamic-graph
Commits
198c54d6
Commit
198c54d6
authored
9 years ago
by
Rohan Budhiraja
Committed by
Olivier Stasse
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Patch for inputing Eigen::Transform as Matrix4d
parent
55c51cbd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/dynamic-graph/value.h
+7
-8
7 additions, 8 deletions
include/dynamic-graph/value.h
src/command/command.cpp
+1
-1
1 addition, 1 deletion
src/command/command.cpp
src/command/value.cpp
+41
-12
41 additions, 12 deletions
src/command/value.cpp
with
49 additions
and
21 deletions
include/dynamic-graph/value.h
+
7
−
8
View file @
198c54d6
...
...
@@ -30,8 +30,6 @@ namespace dynamicgraph {
class
Value
;
class
DYNAMIC_GRAPH_DLLAPI
EitherType
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EitherType
(
const
Value
&
value
);
~
EitherType
();
operator
bool
()
const
;
...
...
@@ -41,16 +39,14 @@ namespace dynamicgraph {
operator
double
()
const
;
operator
std
::
string
()
const
;
operator
Vector
()
const
;
operator
Matrix
()
const
;
operator
Eigen
::
MatrixXd
()
const
;
operator
Eigen
::
Matrix4d
()
const
;
private:
const
Value
*
value_
;
};
class
DYNAMIC_GRAPH_DLLAPI
Value
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
enum
Type
{
NONE
,
BOOL
,
...
...
@@ -61,6 +57,7 @@ namespace dynamicgraph {
STRING
,
VECTOR
,
MATRIX
,
MATRIX4D
,
NB_TYPES
};
~
Value
();
...
...
@@ -72,7 +69,8 @@ namespace dynamicgraph {
explicit
Value
(
const
double
&
value
);
explicit
Value
(
const
std
::
string
&
value
);
explicit
Value
(
const
Vector
&
value
);
explicit
Value
(
const
Matrix
&
value
);
explicit
Value
(
const
Eigen
::
MatrixXd
&
value
);
explicit
Value
(
const
Eigen
::
Matrix4d
&
value
);
/// Copy constructor
Value
(
const
Value
&
value
);
// Construct an empty value (None)
...
...
@@ -108,7 +106,8 @@ namespace dynamicgraph {
double
doubleValue
()
const
;
std
::
string
stringValue
()
const
;
Vector
vectorValue
()
const
;
Matrix
matrixValue
()
const
;
Eigen
::
MatrixXd
matrixXdValue
()
const
;
Eigen
::
Matrix4d
matrix4dValue
()
const
;
Type
type_
;
const
void
*
const
value_
;
};
...
...
This diff is collapsed.
Click to expand it.
src/command/command.cpp
+
1
−
1
View file @
198c54d6
...
...
@@ -50,7 +50,7 @@ namespace dynamicgraph {
for
(
unsigned
int
iParam
=
0
;
iParam
<
values
.
size
();
iParam
++
)
{
if
(
values
[
iParam
].
type
()
!=
paramTypes
[
iParam
])
{
std
::
stringstream
ss
;
ss
<<
"argument "
<<
iParam
<<
"is of wrong type: "
ss
<<
"argument "
<<
iParam
<<
"
is of wrong type: "
<<
Value
::
typeName
(
paramTypes
[
iParam
])
<<
" expected, got "
<<
Value
::
typeName
(
values
[
iParam
].
type
());
throw
ExceptionAbstract
(
ExceptionAbstract
::
TOOLS
,
ss
.
str
());
...
...
This diff is collapsed.
Click to expand it.
src/command/value.cpp
+
41
−
12
View file @
198c54d6
...
...
@@ -61,9 +61,14 @@ namespace dynamicgraph {
{
return
value_
->
vectorValue
();
}
EitherType
::
operator
Matrix
()
const
EitherType
::
operator
Eigen
::
Matrix
Xd
()
const
{
return
value_
->
matrixValue
();
return
value_
->
matrixXdValue
();
}
EitherType
::
operator
Eigen
::
Matrix4d
()
const
{
return
value_
->
matrix4dValue
();
}
void
Value
::
deleteValue
()
...
...
@@ -91,7 +96,10 @@ namespace dynamicgraph {
delete
(
const
Vector
*
)
value_
;
break
;
case
MATRIX
:
delete
(
const
Matrix
*
)
value_
;
delete
(
const
Eigen
::
MatrixXd
*
)
value_
;
break
;
case
MATRIX4D
:
delete
(
const
Eigen
::
Matrix4d
*
)
value_
;
break
;
default:
;
}
...
...
@@ -129,8 +137,12 @@ namespace dynamicgraph {
value_
(
new
Vector
(
value
))
{
}
Value
::
Value
(
const
Matrix
&
value
)
:
type_
(
MATRIX
),
value_
(
new
Matrix
(
value
))
Value
::
Value
(
const
Eigen
::
MatrixXd
&
value
)
:
type_
(
MATRIX
),
value_
(
new
Eigen
::
MatrixXd
(
value
))
{
}
Value
::
Value
(
const
Eigen
::
Matrix4d
&
value
)
:
type_
(
MATRIX4D
),
value_
(
new
Eigen
::
Matrix4d
(
value
))
{
}
...
...
@@ -168,7 +180,10 @@ namespace dynamicgraph {
copy
=
new
Vector
(
value
.
vectorValue
());
break
;
case
Value
::
MATRIX
:
copy
=
new
Matrix
(
value
.
matrixValue
());
copy
=
new
Eigen
::
MatrixXd
(
value
.
matrixXdValue
());
break
;
case
Value
::
MATRIX4D
:
copy
=
new
Eigen
::
Matrix4d
(
value
.
matrix4dValue
());
break
;
default:
abort
();
...
...
@@ -262,12 +277,20 @@ namespace dynamicgraph {
"value is not an vector"
);
}
Matrix
Value
::
matrixValue
()
const
Eigen
::
Matrix
Xd
Value
::
matrix
Xd
Value
()
const
{
if
(
type_
==
MATRIX
)
return
*
((
const
Matrix
*
)
value_
);
return
*
((
const
Eigen
::
MatrixXd
*
)
value_
);
throw
ExceptionAbstract
(
ExceptionAbstract
::
TOOLS
,
"value is not a Eigen matrixXd"
);
}
Eigen
::
Matrix4d
Value
::
matrix4dValue
()
const
{
if
(
type_
==
MATRIX4D
)
return
*
((
const
Eigen
::
Matrix4d
*
)
value_
);
throw
ExceptionAbstract
(
ExceptionAbstract
::
TOOLS
,
"value is not a matrix"
);
"value is not a
Eigen
matrix
4d
"
);
}
std
::
string
Value
::
typeName
(
Type
type
)
...
...
@@ -288,7 +311,9 @@ namespace dynamicgraph {
case
VECTOR
:
return
std
::
string
(
"vector"
);
case
MATRIX
:
return
std
::
string
(
"matrix"
);
return
std
::
string
(
"matrixXd"
);
case
MATRIX4D
:
return
std
::
string
(
"matrix4d"
);
default:
return
std
::
string
(
"unknown"
);
}
...
...
@@ -321,7 +346,10 @@ namespace dynamicgraph {
os
<<
value
.
vectorValue
();
break
;
case
Value
::
MATRIX
:
os
<<
value
.
matrixValue
();
os
<<
value
.
matrixXdValue
();
break
;
case
Value
::
MATRIX4D
:
os
<<
value
.
matrix4dValue
();
break
;
default:
return
os
;
...
...
@@ -336,7 +364,8 @@ namespace dynamicgraph {
template
<
>
const
Value
::
Type
ValueHelper
<
double
>::
TypeID
=
Value
::
DOUBLE
;
template
<
>
const
Value
::
Type
ValueHelper
<
std
::
string
>::
TypeID
=
Value
::
STRING
;
template
<
>
const
Value
::
Type
ValueHelper
<
Vector
>::
TypeID
=
Value
::
VECTOR
;
template
<
>
const
Value
::
Type
ValueHelper
<
Matrix
>::
TypeID
=
Value
::
MATRIX
;
template
<
>
const
Value
::
Type
ValueHelper
<
Eigen
::
MatrixXd
>::
TypeID
=
Value
::
MATRIX
;
template
<
>
const
Value
::
Type
ValueHelper
<
Eigen
::
Matrix4d
>::
TypeID
=
Value
::
MATRIX4D
;
}
// namespace command
}
//namespace dynamicgraph
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment