-
Notifications
You must be signed in to change notification settings - Fork 0
erl_2018_madrid_navigation
Rodrigo Serra edited this page Nov 28, 2023
·
1 revision
- When using a state machine, setup a sm state to perform a dynamic reconfiguration as exemplified:
import mcr_states.common.basic_states as gbsAdd a new state to the state machine:
# sets the desired navigation configuration: navigating_only_front/navigating_only_backwards/navigation_front_and_back
smach.StateMachine.add('UPDATE_NAVIGATION_CONFIG', gbs.set_named_config('navigating_only_backwards'),
transitions={'success':'NEXT_STATE_WITH_SUCESS',
'failure':'NEXT_STATE_WITH_FAILURE',
'timeout':'NEXT_STATE_WITH_TIMEOUT'})Create a yaml file (suggestion: save it in mbot_world_model) with:
forbidden_zones: {kimble: [], postman: [entrance_hall, hallway, bedroom, living_room, dining_room, kitchen, bathroom], deliman: [bathroom], plumber: [bedroom]}With a python file you can get the dictionary using the following:
self.permissions_file = rospy.get_param('~people_and_zones_permissions_file')
# Load raw data
with open(self.permissions_file) as fh:
self.meta = yaml.load(fh)
# get all forbidden zones per person from .yaml file
# dict of type {'person_name': [ zone1, zone2 ...]}
self.forbidden_zones = self.meta['forbidden_zones'] if 'forbidden_zones' in self.meta else {}To check if a person is in a forbidden zone:
zone = msg.data
if zone in self.forbidden_zones.get(self.last_seen_person):
rospy.loginfo("You are not allowed in %s, please exit that room", zone)
# Replace the rospy.loginfo() by espeak-
Copy the map image and yaml files to the same folder
-
Name the files
map_colored.pgmandmap_colored.yaml, respectively -
map_colored.yaml: Change the first line to:
image: map_colored.pgm-
map_colored.yaml: Add the following line:
zones: {entrance_hall: color_id_1, hallway: color_id_2 , bedroom: color_id_3 , living_room: color_id_4 , dining_room: color_id_5 , kitchen: color_id_6 , bathroom: color_id_7}- Use GIMP to edit the
map_colored.pgmfile and color (grey scale) the different zones:- Save the color id of each zone in
map_colored.yaml, in the zones line - All color_id_n should be replaced with the color number of that specific zone
-
Select a color id (marked in red rectangle) and paint the zone with that color, then, save that number (eg: 50) in
map_colored.yamlnext to the corresponding zone (e.g:corridor: 50) -
Advice:
- To generate a grey scale color, choose a number (0<n<255) and set the color as shown in the red rectangle.
- It helps to draw the outline of the zone with the chosen color and, then, paint the zone.
- For an example go to
mbot_world_model/maps/isr-lab/
- Save the color id of each zone in

Instructions to the Navigation component of TBM4 are available in Using a Point Cloud in Navigation