Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
View Selection
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Software
ArmarX
Skills
View Selection
Commits
a729e3cd
Commit
a729e3cd
authored
2 years ago
by
armar-user
Browse files
Options
Downloads
Patches
Plain Diff
gaze controller: cleanup
parent
4dcfa7c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/armarx/view_selection/gaze_controller/GazeController.cpp
+21
-15
21 additions, 15 deletions
.../armarx/view_selection/gaze_controller/GazeController.cpp
with
21 additions
and
15 deletions
source/armarx/view_selection/gaze_controller/GazeController.cpp
+
21
−
15
View file @
a729e3cd
#include
"GazeController.h"
#include
"
ArmarXCore/core/logging/Logging.h
"
#include
<
ArmarXCore/core/logging/Logging.h
>
#include
<ArmarXCore/interface/observers/VariantBase.h>
#include
"RobotAPI/components/units/RobotUnit/ControlModes.h"
#include
"RobotAPI/components/units/RobotUnit/ControlTargets/ControlTarget1DoFActuator.h"
#include
<RobotAPI/components/units/RobotUnit/ControlModes.h>
#include
<RobotAPI/components/units/RobotUnit/ControlTargets/ControlTarget1DoFActuator.h>
#include
<RobotAPI/components/units/RobotUnit/util/ControlThreadOutputBuffer.h>
#include
<RobotAPI/libraries/core/FramedPose.h>
#include
"
armarx/view_selection/common/controller_types.h
"
#include
<
armarx/view_selection/common/controller_types.h
>
#include
<armarx/view_selection/gaze_controller/aron/GazeControllerConfig.aron.generated.h>
#include
<armarx/view_selection/gaze_controller/aron_conversions.h>
...
...
@@ -21,7 +23,7 @@ namespace armarx::view_selection::gaze_controller
const
NJointControllerConfigPtr
&
config
,
const
VirtualRobot
::
RobotPtr
&
)
{
ARMARX_
INFO
<<
"Creating gaze controller"
;
ARMARX_
RT_LOGF
(
"Creating gaze controller"
)
;
// config
ConfigPtrT
cfg
=
ConfigPtrT
::
dynamicCast
(
config
);
ARMARX_CHECK_EXPRESSION
(
cfg
);
...
...
@@ -32,7 +34,7 @@ namespace armarx::view_selection::gaze_controller
const
auto
configData
=
arondto
::
Config
::
FromAron
(
cfg
->
config
);
// robot
ARMARX_
INFO
<<
"Setting up nodes"
;
ARMARX_
RT_LOGF
(
"Setting up nodes"
)
;
{
_rtRobot
=
useSynchronizedRtRobot
();
ARMARX_CHECK_NOT_NULL
(
_rtRobot
);
...
...
@@ -54,15 +56,17 @@ namespace armarx::view_selection::gaze_controller
ARMARX_CHECK_NOT_NULL
(
_rtYawCtrlTarget
);
//_rtYawCtrlPos = &(yawCtrlTarget->position);
}
ARMARX_RT_LOGF
(
"Nodes set up successfully"
);
}
GazeController
::~
GazeController
()
=
default
;
void
GazeController
::
updateConfig
(
const
::
armarx
::
aron
::
data
::
dto
::
DictPtr
&
dto
,
const
Ice
::
Current
&
iceCurrent
)
const
Ice
::
Current
&
/*
iceCurrent
*/
)
{
ARMARX_
INFO
<<
"Controller::updateConfig"
;
//
ARMARX_
VERBOSE
<< "Controller::updateConfig";
auto
updateConfigDto
=
arondto
::
Config
::
FromAron
(
dto
);
...
...
@@ -89,19 +93,21 @@ namespace armarx::view_selection::gaze_controller
}
void
GazeController
::
rtRun
(
const
IceUtil
::
Time
&
sensorValuesTimestamp
,
const
IceUtil
::
Time
&
timeSinceLastIteration
)
GazeController
::
rtRun
(
const
IceUtil
::
Time
&
/*
sensorValuesTimestamp
*/
,
const
IceUtil
::
Time
&
/*
timeSinceLastIteration
*/
)
{
const
auto
now
=
armarx
::
core
::
time
::
DateTime
::
Now
()
;
auto
target
=
rtGetControlStruct
().
targets
.
gazeTarget
.
position
;
ARMARX_INFO
<<
deactivateSpam
(
1
)
<<
"Current target is "
<<
rtGetControlStruct
().
targets
.
gazeTarget
;
if
(
target
.
frame
.
empty
())
{
target
.
frame
=
GlobalFrame
;
}
// calculate inverse kinematic
const
float
currentYawAngle
=
_rtYawNode
->
getJointValue
();
const
float
currentPitchAngle
=
_rtPitchNode
->
getJointValue
();
const
Eigen
::
Vector3f
targetPoint
=
rtGetControlStruct
().
targets
.
gazeTarget
.
position
.
toRootEigen
(
_rtRobot
);
const
Eigen
::
Vector3f
targetPoint
=
target
.
toRootEigen
(
_rtRobot
);
const
float
h
=
_rtCameraNode
->
getPositionInRootFrame
().
z
();
float
targetYawAngle
=
-
std
::
atan2
(
targetPoint
.
x
(),
targetPoint
.
y
());
...
...
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