Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python3 ArmarX
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
Releases
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
Python3 ArmarX
Merge requests
!26
add control module
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
add control module
control
into
master
Overview
1
Commits
1
Pipelines
0
Changes
1
Open
Markus Grotz
requested to merge
control
into
master
2 years ago
Overview
1
Commits
1
Pipelines
0
Changes
1
Expand
Can you test this?
0
0
Merge request reports
Compare
master
master (HEAD)
and
latest version
latest version
e7f38cf3
1 commit,
2 years ago
1 file
+
82
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
armarx_robots/control.py
0 → 100644
+
82
−
0
Options
import
time
import
logging
from
typing
import
List
from
typing
import
Dict
from
typing
import
Any
import
numpy
as
np
from
armarx.pose_helper
import
convert_pose_to_global
from
armarx.pose_helper
import
convert_pose_to_root
from
armarx
import
RobotUnitInterfacePrx
from
armarx
import
NJointCartesianWaypointControllerConfig
from
armarx
import
NJointCartesianWaypointControllerInterfacePrx
from
armarx
import
Matrix_4_4_f
as
Matrix4f
from
armarx
import
Vector4f
from
armarx
import
FramedPoseBase
from
armarx
import
Vector3Base
from
armarx
import
QuaternionBase
logger
=
logging
.
getLogger
(
__name__
)
from
abc
import
ABC
from
abc
import
abstractmethod
class
AbstractController
(
ABC
):
@property
@abstractmethod
def
controller_name
(
self
)
->
str
:
pass
@property
@abstractmethod
def
config
(
self
)
->
Dict
[
str
,
Any
]:
pass
class
CartesianWaypointController
:
controller_name
:
str
=
'
NJointCartesianWaypointController
'
config
=
{
'
rns
'
:
'
RightArm
'
}
def
__init__
(
self
,
config
=
None
,
name
:
str
=
None
):
if
not
config
:
self
.
config
.
update
(
config
)
self
.
controller
=
None
self
.
name
=
name
or
self
.
__class__
.
__name__
self
.
robot_unit
=
RobotUnitInterfacePrx
.
get_proxy
(
'
Armar6Unit
'
)
def
__enter__
(
self
):
config
=
NJointCartesianWaypointControllerConfig
(
**
self
.
config
)
controller
=
self
.
robot_unit
.
createOrReplaceNJointController
(
self
.
controller_name
,
self
.
name
,
config
)
controller
=
NJointCartesianWaypointControllerInterfacePrx
.
checkedCast
(
controller
)
self
.
controller
=
controller
controller
.
activateController
()
return
controller
def
__del__
(
self
):
if
self
.
controller
:
self
.
controller
.
deleteController
()
def
__exit__
(
self
,
exc_type
,
exc_value
,
traceback
):
if
not
self
.
controller
:
return
self
.
controller
.
deactivateController
()
while
self
.
controller
.
isControllerActive
():
logger
.
debug
(
'
Waiting until controller is deactived
'
)
time
.
sleep
(
0.01
)
Loading