Scripts
StateMachine Module
ROS node for implementing a finite state machine FSM.
- Client:
/Battery_Switch to active the ROOM_E state
/Movement_Switch to active the RANDOM_MOVEMENT state
/Mapping_Switch to active the TOPOLOGICAL_MAP state
- Service:
/B_Switch to communicate the need for recharging the battery
-
script.StateMachine.Battery_State(req)[source]
Service callback.
- Parameters
req (bool) – notifies that the battery is low
- Returns
indicates successful run of triggered service
- Return type
res (bool)
-
class script.StateMachine.CHOOSE_DESTINATION[source]
Bases: smach.state.State
Class implementing FSM sub state concerning the choice of location
in which the robot is to move.
-
execute(userdata)[source]
Function that executes the status of the FSM by executing a function
to decide in which location the robot should move according to urgency.
- Returns
- Transition of the FSM to be carried out
-
-
script.StateMachine.ChangeState(State)[source]
Function for communicating which node to execute based on the status of the FSM.
- Parameters
State (int) –
current status of the FSM
TOPOLOGICAL_MAP
RANDOM_MOVEMENT
ROOM_E
-
class script.StateMachine.RANDOM_MOVEMENT[source]
Bases: smach.state.State
Class implementing FSM sub state concerning the random movement.
-
execute(userdata)[source]
Function that executes the status of the FSM by calling the service
related to the moving situation.
- Returns
- Transition of the FSM to be carried out
-
-
class script.StateMachine.ROOM_E[source]
Bases: smach.state.State
Class implementing FSM state concerning the room E.
-
execute(userdata)[source]
Function that executes the status of the FSM by calling the service
related to the recharging situation.
- Returns
- Transition of the FSM to be carried out
-
-
class script.StateMachine.TOPOLOGICAL_MAP[source]
Bases: smach.state.State
Class implementing FSM state concerning the topological map.
-
execute(userdata)[source]
Function that executes the status of the FSM by calling the service
related to the mapping situation.
- Returns
- Transition of the FSM to be carried out
-
-
script.StateMachine.main()[source]
This function initializes the ROS node, clients and service and waits for
the creation and execution of the FSM.
TopologicalMap Module
ROS node for implementing the TOPOLOGICAL_MAP state of the finite state machine FSM
- Client:
ArmorClient
- Service:
/Mapping_Switch to active the TOPOLOGICAL_MAP state
-
script.TopologicalMap.LoadMap()[source]
Function to load the topological map using the aRMOR client.
-
script.TopologicalMap.Mapping_Switch(req)[source]
Service callback
- Parameters
req (bool) – for enabling/disabling the service related to mappig simulation
- Returns
indicates successful run of triggered service
res.message (string): informational
- Return type
res.success (bool)
-
script.TopologicalMap.main()[source]
This function initializes the ROS node and service.
When the service /Mapping_Switch is called, map loading is simulated.
RandomMovement Module
ROS node for implementing the RANDOM_MOVEMENT state of the finite state machine FSM
- Client:
ArmorClient
MoveBaseAction
- Service:
/Mapping_Switch to active the RANDOM_MOVEMENT state
MoveBaseGoal
-
script.RandomMovement.MoveBaseA()[source]
Function to provide an implementation of an action which, given a position
goal, will attempt to reach it.
If the position is not reached within a certain time (3.0 seconds) or if the
signal of battery low is sent, the goal is cancelled.
-
script.RandomMovement.Movement_Switch(req)[source]
Service callback.
- Parameters
req (bool) – for enabling/disabling the service related to moving simulation
- Returns
indicates successful run of triggered service
res.message (string): informational
- Return type
res.success (bool)
-
script.RandomMovement.main()[source]
This function initializes the ROS node and service.
When the service /Mapping_Switch is called, random movement is simulated.
Battery Module
ROS node for implementing the ROOM_E state of the finite state machine FSM
- Client:
/B_Switch to communicate the need for recharging the battery
ArmorClient
- Service:
/Recharging_Switch to active the ROOM_E state
-
script.Battery.Battery_Switch(req)[source]
Service callback.
- Parameters
req (bool) – for enabling/disabling the service related to battery charging simulation
- Returns
indicates successful run of triggered service
res.message (string): informational
- Return type
res.success (bool)
-
script.Battery.main()[source]
This function initializes the ROS node, client and service.
A message is sent to the service /B_switch every random seconds to notify the need for recharging.
When the service /Recharging_Switch is called, battery charging is simulated.