robot_state_machine module
This script is a ROS-based state machine for a robot to navigate through a topological map of an environment. It loads the ontology map of the environment, initializes the robot’s sensors, and defines a state machine with three states: Load_Environment, Normal_mode, and Emergency_mode.
In Normal_mode state, the robot chooses the next corridor to move or switch to Emergency_mode. In Navigationway state, the robot navigates through the selected corridor. In Emergency_mode state, the robot navigates to the nearest emergency location.
The robot’s sensors are instantiated in the main() function, and the state machine is initialized using the StateMachine() class. The transitions between states are defined using the add() and add_transition() methods of the StateMachine class. The script uses the ArmorClient library to manipulate the ontology map of the environment.
The script also defines a function to load the ontology map from a file and apply buffered changes to the ontology, and a function to save the ontology file when the script ends. The script uses the rospy library to initialize a ROS node and log information. The script uses the smach library to define and execute the state machine.
- class robot_state_machine.LoadEnvironment[source]
Bases:
StateA state in a state machine that loads the ontology map of the environment.
- Returns:
“map_loaded” outcome when the ontology map is loaded