Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Merge requests
!451
Improve armar7 platform movement
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Improve armar7 platform movement
feature/improve-armar7-platform-movement
into
master
Overview
6
Commits
9
Pipelines
28
Changes
3
Merged
Tobias Gröger
requested to merge
feature/improve-armar7-platform-movement
into
master
10 months ago
Overview
5
Commits
9
Pipelines
28
Changes
3
Expand
0
0
Merge request reports
Viewing commit
53181419
Prev
Next
Show latest version
3 files
+
201
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
53181419
Start setting up new HolonomicPlatformVelocityControllerWithRamp
· 53181419
Tobias Gröger
authored
10 months ago
source/RobotAPI/components/units/RobotUnit/NJointControllers/NJointHolonomicPlatformVelocityControllerWithRamp.cpp
0 → 100644
+
104
−
0
Options
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::NJointHolonomicPlatformUnitVelocityPassThroughController
* @author Raphael Grimm ( raphael dot grimm at kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include
"NJointHolonomicPlatformVelocityControllerWithRamp.h"
#include
<ArmarXCore/core/exceptions/local/ExpressionException.h>
#include
<RobotAPI/components/units/RobotUnit/NJointControllers/NJointControllerRegistry.h>
namespace
armarx
{
NJointHolonomicPlatformVelocityControllerWithRamp
::
NJointHolonomicPlatformUnitVelocityPassThroughController
(
RobotUnit
*
prov
,
NJointHolonomicPlatformUnitVelocityPassThroughControllerConfigPtr
cfg
,
const
VirtualRobot
::
RobotPtr
&
)
:
maxCommandDelay
(
IceUtil
::
Time
::
milliSeconds
(
500
))
{
target
=
useControlTarget
(
cfg
->
platformName
,
ControlModes
::
HolonomicPlatformVelocity
)
->
asA
<
ControlTargetHolonomicPlatformVelocity
>
();
ARMARX_CHECK_EXPRESSION
(
target
)
<<
"The actuator "
<<
cfg
->
platformName
<<
" has no control mode "
<<
ControlModes
::
HolonomicPlatformVelocity
;
initialSettings
.
velocityX
=
cfg
->
initialVelocityX
;
initialSettings
.
velocityY
=
cfg
->
initialVelocityY
;
initialSettings
.
velocityRotation
=
cfg
->
initialVelocityRotation
;
reinitTripleBuffer
(
initialSettings
);
}
void
NJointHolonomicPlatformVelocityControllerWithRamp
::
rtRun
(
const
IceUtil
::
Time
&
sensorValuesTimestamp
,
const
IceUtil
::
Time
&
)
{
auto
commandAge
=
sensorValuesTimestamp
-
rtGetControlStruct
().
commandTimestamp
;
if
(
commandAge
>
maxCommandDelay
&&
// command must be recent
(
rtGetControlStruct
().
velocityX
!=
0.0
f
||
rtGetControlStruct
().
velocityY
!=
0.0
f
||
rtGetControlStruct
().
velocityRotation
!=
0.0
f
))
// only throw error if any command is not zero
{
throw
LocalException
(
"Platform target velocity was not set for a too long time: delay: "
)
<<
commandAge
.
toSecondsDouble
()
<<
" s, max allowed delay: "
<<
maxCommandDelay
.
toSecondsDouble
()
<<
" s"
;
}
else
{
target
->
velocityX
=
rtGetControlStruct
().
velocityX
;
target
->
velocityY
=
rtGetControlStruct
().
velocityY
;
target
->
velocityRotation
=
rtGetControlStruct
().
velocityRotation
;
}
}
void
NJointHolonomicPlatformVelocityControllerWithRamp
::
setVelocites
(
float
velocityX
,
float
velocityY
,
float
velocityRotation
)
{
LockGuardType
guard
{
controlDataMutex
};
getWriterControlStruct
().
velocityX
=
velocityX
;
getWriterControlStruct
().
velocityY
=
velocityY
;
getWriterControlStruct
().
velocityRotation
=
velocityRotation
;
getWriterControlStruct
().
commandTimestamp
=
IceUtil
::
Time
::
now
();
writeControlStruct
();
}
IceUtil
::
Time
NJointHolonomicPlatformVelocityControllerWithRamp
::
getMaxCommandDelay
()
const
{
return
maxCommandDelay
;
}
void
NJointHolonomicPlatformVelocityControllerWithRamp
::
setMaxCommandDelay
(
const
IceUtil
::
Time
&
value
)
{
maxCommandDelay
=
value
;
}
NJointControllerRegistration
<
NJointHolonomicPlatformVelocityControllerWithRamp
>
registrationNJointHolonomicPlatformUnitVelocityPassThroughController
(
"NJointHolonomicPlatformVelocityControllerWithRamp"
);
}
// namespace armarx
Loading