Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Rousselle
bliss
Commits
6c1c83c9
Commit
6c1c83c9
authored
Mar 30, 2017
by
bliss administrator
Committed by
bliss administrator
Nov 10, 2017
Browse files
BM05 bliss axis manager for robot.
parent
a512be70
Changes
1
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/motors/BM05Robot.py
0 → 100644
View file @
6c1c83c9
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import
time
import
serial
from
bliss.controllers.motor
import
Controller
from
bliss.common
import
log
as
elog
from
bliss.common.axis
import
AxisState
from
bliss.common.utils
import
object_attribute_get
,
object_attribute_set
,
object_method
from
StaubPy
import
bm05Controller
"""
Bliss controller for ID31Robot.
"""
class
BM05Robot
(
Controller
):
Cache
=
{}
def
initialize
(
self
):
"""
"""
# opens communication
print
(
"Initialisation of BM05 robot."
)
host
=
self
.
config
.
get
(
'host'
)
try
:
self
.
bm05
=
BM05Robot
.
Cache
[
host
]
except
KeyError
:
BM05Robot
.
Cache
[
host
]
=
bm05Controller
.
BM05Controller
(
controllerAssociated
=
self
.
config
.
get
(
'host'
))
self
.
bm05
=
BM05Robot
.
Cache
[
host
]
# Change for True if you want a lot of debugs on the controller and in the console.
self
.
bm05
.
printDebug
=
False
print
(
"Creating robot 'firmware' and shipping to controller. (fast)"
)
self
.
bm05
.
makeOnly
()
print
(
"Starting new robot controller 'firmware' (takes time (5seconds to 2 minutes) ) PLEASE WAIT FOR IT"
)
self
.
bm05
.
loadOnly
()
print
(
"Initialising values in controller. (fast)"
)
self
.
bm05
.
initValues
()
self
.
movingStatus
=
"initialised"
print
(
"Post Init Actions in controller. (fast)"
)
self
.
bm05
.
postInit
()
self
.
bm05
.
speed
=
self
.
config
.
get
(
'speed'
)
def
finalize
(
self
):
"""
"""
# Closes communication
def
initialize_axis
(
self
,
axis
):
"""
Reads specific config
Adds specific methods
"""
axis
.
role
=
axis
.
config
.
get
(
'role'
)
def
read_position
(
self
,
axis
):
"""
Returns position's setpoint or measured position.
Args:
- <axis> : bliss axis.
- [<measured>] : boolean : if True, function returns
measured position in ???
Returns:
- <position> : float : axis setpoint in ???.
"""
#must have axis name : filmx filmy filmz
return
getattr
(
self
.
bm05
,
axis
.
role
)
def
read_encoder
(
self
,
encoder
):
raise
NotImplementedError
@
object_attribute_get
(
type_info
=
"float"
)
def
get_speed
(
self
,
axis
):
return
self
.
bm05
.
speed
@
object_attribute_set
(
type_info
=
"float"
)
def
set_speed
(
self
,
axis
,
new_speed
):
self
.
bm05
.
speed
=
new_speed
def
state
(
self
,
axis
):
if
self
.
bm05
.
hasMovesProgrammed
:
return
AxisState
(
"MOVING"
)
else
:
return
AxisState
(
"READY"
)
def
prepare_move
(
self
,
motion
):
setattr
(
self
.
bm05
,
motion
.
axis
.
role
,
motion
.
target_pos
)
def
start_one
(
self
,
motion
):
"""
"""
print
(
"START one"
,
motion
)
self
.
bm05
.
moveToFilmPosition
()
def
start_all
(
self
,
*
motion_list
):
print
(
"START ALL"
,
motion_list
)
self
.
bm05
.
moveToFilmPosition
()
def
stop
(
self
,
axis
):
i
=
0
while
self
.
bm05
.
hasMovesProgrammed
and
i
<
5
:
self
.
bm05
.
resetMotion
()
i
+=
1
if
self
.
bm05
.
hasMovesProgrammed
:
logging
.
error
(
'robot still has programmed moves after 5 attempts to stop'
)
# topo Force gripper
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
openGripper
(
self
,
axis
):
self
.
bm05
.
openGripper
()
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
closeGripper
(
self
,
axis
):
self
.
bm05
.
closeGripper
()
# Topo lead door
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
openTopoDoor
(
self
,
axis
):
self
.
bm05
.
openTopoDoor
()
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
closeTopoDoor
(
self
,
axis
):
self
.
bm05
.
closeTopoDoor
()
# Change Films
@
object_method
(
types_info
=
(
"int"
,
"None"
))
def
loadFilm
(
self
,
axis
,
film
):
self
.
bm05
.
loadFilm
(
film
)
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
unloadFilm
(
self
,
axis
):
self
.
bm05
.
unLoadFilm
()
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
parkRobotNoMatterWhatDANGEROUS
(
self
,
axis
):
self
.
bm05
.
parkRobotNoMatterWhatDANGEROUS
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment