Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
bbe884f4
Commit
bbe884f4
authored
6 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
made jointlimitavoidance constraint compatible with limitless joints
parent
87fb6043
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
VirtualRobot/IK/constraints/JointLimitAvoidanceConstraint.cpp
+33
-0
33 additions, 0 deletions
...ualRobot/IK/constraints/JointLimitAvoidanceConstraint.cpp
VirtualRobot/IK/constraints/JointLimitAvoidanceConstraint.h
+3
-0
3 additions, 0 deletions
VirtualRobot/IK/constraints/JointLimitAvoidanceConstraint.h
with
36 additions
and
0 deletions
VirtualRobot/IK/constraints/JointLimitAvoidanceConstraint.cpp
+
33
−
0
View file @
bbe884f4
...
...
@@ -38,3 +38,36 @@ JointLimitAvoidanceConstraint::JointLimitAvoidanceConstraint(const RobotPtr &rob
setReferenceConfiguration
(
reference
);
}
double
JointLimitAvoidanceConstraint
::
optimizationFunction
(
unsigned
int
/*id*/
)
{
double
value
=
0
;
float
v
;
for
(
size_t
i
=
0
;
i
<
nodeSet
->
getSize
();
i
++
)
{
RobotNodePtr
node
=
nodeSet
->
getNode
(
i
);
if
(
node
->
isLimitless
())
continue
;
v
=
(
node
->
getJointValue
()
-
reference
(
i
));
value
+=
v
*
v
;
}
return
optimizationFunctionFactor
*
value
;
}
Eigen
::
VectorXf
JointLimitAvoidanceConstraint
::
optimizationGradient
(
unsigned
int
/*id*/
)
{
Eigen
::
VectorXf
gradient
(
nodeSet
->
getSize
());
for
(
size_t
i
=
0
;
i
<
nodeSet
->
getSize
();
i
++
)
{
RobotNodePtr
node
=
nodeSet
->
getNode
(
i
);
if
(
!
node
->
isLimitless
())
gradient
(
i
)
=
2
*
(
node
->
getJointValue
()
-
reference
(
i
));
else
gradient
(
i
)
=
0.0
f
;
}
return
optimizationFunctionFactor
*
gradient
;
}
This diff is collapsed.
Click to expand it.
VirtualRobot/IK/constraints/JointLimitAvoidanceConstraint.h
+
3
−
0
View file @
bbe884f4
...
...
@@ -32,6 +32,9 @@ namespace VirtualRobot
{
public:
JointLimitAvoidanceConstraint
(
const
RobotPtr
&
robot
,
const
RobotNodeSetPtr
&
nodeSet
);
protected:
double
optimizationFunction
(
unsigned
int
)
override
;
Eigen
::
VectorXf
optimizationGradient
(
unsigned
int
)
override
;
};
typedef
boost
::
shared_ptr
<
JointLimitAvoidanceConstraint
>
JointLimitAvoidanceConstraintPtr
;
...
...
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