Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CARESSER
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
CARESSER
Commits
6006023e
Commit
6006023e
authored
4 years ago
by
pal
Browse files
Options
Downloads
Patches
Plain Diff
Add SOCIABLE as param
parent
f8c464ea
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
launch/bring_up.launch
+2
-1
2 additions, 1 deletion
launch/bring_up.launch
scripts/settings.py
+0
-113
0 additions, 113 deletions
scripts/settings.py
with
2 additions
and
114 deletions
launch/bring_up.launch
+
2
−
1
View file @
6006023e
...
...
@@ -8,9 +8,10 @@
<param name="/user_id" value="$(arg user_id)" />
<arg name="assistive_actions" default="$(find xml_reader)/src/xml_reader/assistive_actions_definition_es.xml" />
<param name="/assistive_actions" value="$(arg assistive_actions)" />
<arg name="objective" default="ascending" />
<param name="/objective" value="$(arg objective)" />
<arg name="SOCIABLE" default="True" />
<param name="/SOCIABLE" value="$(arg SOCIABLE)" />
<!-- Final tokens locations -->
<rosparam param="solution_ascending">
...
...
This diff is collapsed.
Click to expand it.
scripts/settings.py
deleted
100644 → 0
+
0
−
113
View file @
f8c464ea
'''
In this class we set all the connecting with the external sources and we
initialise all the classes instances
'''
#import from ros
import
rospy
import
time
#sub/pub, services and actions from ros
from
std_msgs.msg
import
String
,
Int8
from
iri_rfid_board_scanner.msg
import
BoardIds
#import from libraries
import
pygame
class
Settings
(
object
):
def
__init__
(
self
):
rospy
.
init_node
(
'
big_hero
'
,
anonymous
=
True
)
# subscriber for getting data from the hr sensor
rospy
.
Subscriber
(
"
/rfid_board_scanner/board_ids
"
,
BoardIds
,
self
.
get_electro_board_callback
)
self
.
robot_language
=
rospy
.
get_param
(
"
/language
"
)
self
.
user_id
=
rospy
.
get_param
(
"
/user_id
"
)
self
.
ids
=
list
(
map
(
int
,
rospy
.
get_param
(
'
/rfid_id
'
).
split
()))
self
.
tokens
=
rospy
.
get_param
(
'
/tokens_number
'
)
solution_board_from_launch
=
rospy
.
get_param
(
'
/solution_board
'
)
# getting the ids from the rfids sensors
self
.
ids
=
[
int
(
self
.
ids
[
i
])
for
i
in
range
(
len
(
self
.
ids
))]
# coupling ids with numbers
self
.
electro_board_from_ids_to_tokens
=
self
.
convert_electro_board_ids_to_tokens
(
self
.
ids
,
self
.
tokens
)
self
.
solution_board
=
solution_board_from_launch
self
.
electro_board
=
list
()
self
.
electro_board_with_tokens
=
dict
()
self
.
previous_board_state
=
dict
()
self
.
current_board_state
=
dict
()
def
play_sound
(
self
,
file_path
,
sleep
):
'''
play a sound using pygame
'''
pygame
.
mixer
.
init
()
pygame
.
mixer
.
music
.
load
(
file_path
)
pygame
.
mixer
.
music
.
play
(
0
)
time
.
sleep
(
sleep
)
def
get_tokens_id
(
self
):
return
self
.
tokens
# def get_robot_personality(self):
# return self.robot_personality
def
get_robot_language
(
self
):
return
self
.
robot_language
# def get_robot_gender(self):
# return self.robot_gender
def
get_user_id
(
self
):
return
self
.
user_id
# get value from the topic
def
get_electro_board_ids
(
self
):
return
self
.
electro_board
# topic subscriber
def
get_electro_board_callback
(
self
,
msg
):
self
.
electro_board
=
(
msg
.
id
)
def
get_electro_board
(
self
):
return
self
.
get_tokens_by_ids
(
self
.
electro_board_from_ids_to_tokens
,
self
.
electro_board
)
def
convert_electro_board_ids_to_tokens
(
self
,
ids
,
tokens
):
'''
:param ids:
:param tokens:
:return: this method creates a dic where the ids are the keys and the values are the tokens
'''
from_ids_to_tokens
=
dict
()
for
i
in
range
(
len
(
ids
)):
from_ids_to_tokens
[
ids
[
i
]]
=
tokens
[
i
]
return
from_ids_to_tokens
def
get_tokens_by_ids
(
self
,
from_ids_to_tokens_dict
,
msg
):
'''
:param electro_board:
:param msg:
:return: given a dictionary where key is the id and value is the token change the msg according (0 empty !0 a token id)
'''
for
i
in
range
(
len
(
msg
)):
if
msg
[
i
]
==
0
:
# i+1 because the id start
self
.
electro_board_with_tokens
[
i
+
1
]
=
'
0
'
else
:
self
.
electro_board_with_tokens
[
i
+
1
]
=
from_ids_to_tokens_dict
.
get
(
msg
[
i
])
return
self
.
electro_board_with_tokens
def
main
():
settings
=
Settings
()
while
not
rospy
.
is_shutdown
():
print
(
settings
.
get_electro_board
())
if
__name__
==
"
__main__
"
:
main
()
\ No newline at end of file
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