Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
robot_behaviour
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Antonio Andriella
robot_behaviour
Commits
0d4e2348
Commit
0d4e2348
authored
4 years ago
by
Antonio Andriella
Browse files
Options
Downloads
Patches
Plain Diff
add calibration method
parent
2ba93fb8
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
src/robot_behaviour/gesture_reproducer.py
+66
-24
66 additions, 24 deletions
src/robot_behaviour/gesture_reproducer.py
with
66 additions
and
24 deletions
src/robot_behaviour/gesture_reproducer.py
+
66
−
24
View file @
0d4e2348
...
@@ -256,6 +256,50 @@ class Gesture:
...
@@ -256,6 +256,50 @@ class Gesture:
rospy
.
loginfo
(
"
Execute action without waiting for result...
"
)
rospy
.
loginfo
(
"
Execute action without waiting for result...
"
)
def
calibration
(
self
,
points
):
'''
GO through all the four points
Args:
:points
:return:
'''
for
i
in
range
(
len
(
points
)):
# cell 1 is g45 for the robot view point
conv_cell
=
int
(
self
.
convert
(
points
[
i
]))
rospy
.
loginfo
(
"
Starting run_motion_python application...
"
)
self
.
wait_for_valid_time
(
10.0
)
# client = SimpleActionClient('/play_motion', PlayMotionAction)
rospy
.
loginfo
(
"
conv_cell
"
+
str
(
conv_cell
))
rospy
.
loginfo
(
"
Waiting for Action Server...
"
)
self
.
client
.
wait_for_server
()
goal
=
PlayMotionGoal
()
goal
.
motion_name
=
"
p
"
+
str
(
conv_cell
)
goal
.
skip_planning
=
False
goal
.
priority
=
0
# Optional
rospy
.
loginfo
(
"
Sending goal with motion:
"
+
"
p
"
+
str
(
conv_cell
))
self
.
client
.
send_goal
(
goal
)
rospy
.
loginfo
(
"
Waiting for result...
"
)
action_ok
=
self
.
client
.
wait_for_result
(
rospy
.
Duration
(
30.0
))
state
=
self
.
client
.
get_state
()
rospy
.
sleep
(
1.0
)
#Coming back to my position
rospy
.
loginfo
(
"
Starting run_motion_python application...
"
)
self
.
wait_for_valid_time
(
10.0
)
rospy
.
loginfo
(
"
Waiting for Action Server...
"
)
self
.
client
.
wait_for_server
()
goal
=
PlayMotionGoal
()
goal
.
motion_name
=
"
c
"
+
str
(
conv_cell
)
goal
.
skip_planning
=
False
goal
.
priority
=
0
# Optional
rospy
.
loginfo
(
"
Sending goal with motion:
"
+
"
c
"
+
str
(
conv_cell
))
self
.
client
.
send_goal
(
goal
)
rospy
.
loginfo
(
"
Waiting for result...
"
)
action_ok
=
self
.
client
.
wait_for_result
(
rospy
.
Duration
(
30.0
))
state
=
self
.
client
.
get_state
()
def
pick
(
self
,
cell
):
def
pick
(
self
,
cell
):
'''
'''
Robot picks the token in location cell
Robot picks the token in location cell
...
@@ -464,7 +508,7 @@ class Gesture:
...
@@ -464,7 +508,7 @@ class Gesture:
rospy
.
loginfo
(
"
Execute action without waiting for result...
"
)
rospy
.
loginfo
(
"
Execute action without waiting for result...
"
)
def
offer_token
(
self
,
token_loc
,
reproduce_text
,
text
_0
,
text_1
):
def
offer_token
(
self
,
token_loc
,
reproduce_text
,
text
):
# cell 1 is g45 for the robot view point
# cell 1 is g45 for the robot view point
conv_cell
=
int
(
self
.
convert
(
token_loc
))
conv_cell
=
int
(
self
.
convert
(
token_loc
))
rospy
.
loginfo
(
"
Starting run_motion_python application...
"
)
rospy
.
loginfo
(
"
Starting run_motion_python application...
"
)
...
@@ -486,7 +530,6 @@ class Gesture:
...
@@ -486,7 +530,6 @@ class Gesture:
action_ok
=
self
.
client
.
wait_for_result
(
rospy
.
Duration
(
30.0
))
action_ok
=
self
.
client
.
wait_for_result
(
rospy
.
Duration
(
30.0
))
state
=
self
.
client
.
get_state
()
state
=
self
.
client
.
get_state
()
reproduce_text
(
text_0
)
print
(
self
.
client
.
get_state
())
print
(
self
.
client
.
get_state
())
#replace action_ok with get_state ==3
#replace action_ok with get_state ==3
if
action_ok
:
if
action_ok
:
...
@@ -510,7 +553,7 @@ class Gesture:
...
@@ -510,7 +553,7 @@ class Gesture:
rospy
.
loginfo
(
"
Sending goal with motion:
"
+
"
o
"
+
str
(
conv_cell
))
rospy
.
loginfo
(
"
Sending goal with motion:
"
+
"
o
"
+
str
(
conv_cell
))
self
.
client
.
send_goal
(
goal
)
self
.
client
.
send_goal
(
goal
)
reproduce_text
(
text
_1
)
reproduce_text
(
text
)
rospy
.
loginfo
(
"
Waiting for result...
"
)
rospy
.
loginfo
(
"
Waiting for result...
"
)
action_ok
=
self
.
client
.
wait_for_result
(
rospy
.
Duration
(
30.0
))
action_ok
=
self
.
client
.
wait_for_result
(
rospy
.
Duration
(
30.0
))
...
@@ -542,27 +585,26 @@ class Gesture:
...
@@ -542,27 +585,26 @@ class Gesture:
#action completed
#action completed
return
1
return
1
# def main():
def
main
():
# robot_gesture = Gesture()
robot_gesture
=
Gesture
()
# robot_speech = Speech("en_GB")
robot_gesture
.
calibration
([
20
,
16
,
5
,
1
])
#
#tiago.wave()
# #tiago.wave()
# robot_gesture.pick_and_place(20,20)
# robot_gesture.pick_and_place(18, 1)
# rospy.sleep(2)
# rospy.sleep(2)
# robot_gesture.pick(15, 15)
# robot_gesture.pick_and_place(1, 18)
# rospy.sleep(2)
# rospy.sleep(2)
# robot_gesture.pick(5, 15)
# robot_gesture.pick_and_place(12, 2)
# rospy.sleep(2)
# rospy.sleep(2)
# robot_gesture.pick(1, 1)
# robot_gesture.pick_and_place(2, 12)
# rospy.sleep(2)
# rospy.sleep(2)
# robot_gesture.pick_and_place(15, 3)
# robot_gesture.pick_and_place(15, 3)
# rospy.sleep(2)
# rospy.sleep(2)
# robot_gesture.pick_and_place(3, 15)
# robot_gesture.pick_and_place(3, 15)
# rospy.sleep(2)
# rospy.sleep(2)
#
#
if
__name__
==
'
__main__
'
:
# if __name__ == '__main__':
main
()
# main()
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