robot_brain module
Robot brain data for control and planning executed in the script .
- class robot_brain.ChooseCorridor(interface_cortex, ontology_cortex)[source]
Bases:
StateA state that chooses a random point in the environment and sends a planning goal to the planner action server to find a path to that point through via-points.
- Parameters:
interface_cortex (CortexInterface) – The interface with the other nodes of the architecture.
ontology_cortex (CortexOntology) – The ontology interface with knowledge of the environment and robot’s current position.
- Outputs:
robot_position (string): The robot’s current position in the environment. target (string): The target location for the robot to navigate to. random_plan (list of Points): The via-points planned by the planner to reach the target location.
- Outcome:
‘Robot_recharging’: The robot’s battery is low and it needs to go recharge. ‘corridor_chosen’: The planner has finished computing a plan through via-points to reach the target location. ‘urgentroom_chosen’: The target location is a room that requires an urgent transition.
Bases:
StateA SMACH state for moving the robot along a planned path.
- Parameters:
interface_cortex (CortexInterface) – An instance of the CortexInterface class.
ontology_cortex (OntologyCortex) – An instance of the OntologyCortex class.
- Input keys:
random_plan (list): A list of PoseStamped messages representing the planned path. robot_position (PoseStamped): The current pose of the robot. target (str): The target location.
- Output keys:
robot_position (PoseStamped): The new pose of the robot.
- Outcomes:
Robot_recharging: The robot’s battery is low and it needs to recharge. robot_moved_corridor: The robot has reached its target location.
Execute the Navigationway state.
- Parameters:
userdata (UserData) – An object that contains input and output keys.
- Returns:
The outcome of the state.
- Return type:
str
- class robot_brain.PlanningAction[source]
Bases:
objectA class that creates a motion plan with a number of points spanning in a given range and each point generated with a delay spanning in another given range. The plan is executed from a start point to a target point within a given environment size.
- Variables:
_random_plan_points (list[int]) – A list of two integers indicating the minimum and maximum number of points in the motion plan.
_random_plan_time (list[float]) – A list of two floats indicating the minimum and maximum delay time between each point generation in the motion plan.
_environment_size (list[float]) – A list of two floats indicating the maximum x and y values of the environment where the motion plan is executed.
_as (SimpleActionServer) – A SimpleActionServer object that handles the motion planning action.
- class robot_brain.Recharging(interface_cortex, ontology_cortex)[source]
Bases:
StateThis class defines a state in a SMACH state machine that sends a robot to recharge if its battery is low.
- Parameters:
interface_cortex (interface_cortex) – An instance of the interface_cortex class used to communicate with the robot’s control system.
ontology_cortex (ontology_cortex) – An instance of the ontology_cortex class used to interact with the robot’s knowledge base.
- Returns:
The outcome of the state, which is always ‘recharged’.
- Raises:
Any exceptions thrown by the underlying code.
- class robot_brain.RobotState[source]
Bases:
objectThis class represents the state of the robot in terms of its position and battery status.
- battery_notifier_(publisher)[source]
A helper method that publishes the current battery status to the publisher object.
- Parameters:
publisher – A rospy.Publisher object that is used to publish the battery status.
- Returns:
None
- get_pose(request)[source]
Service callback method for getting the robot’s current position.
- Parameters:
request – An object of GetPoseRequest type, which contains no arguments.
- Returns:
A response object of GetPoseResponse type, which contains the current pose of the robot.
- class robot_brain.emergency(interface_cortex, ontology_cortex)[source]
Bases:
StateThis state handles emergency situations in the robot navigation system. It generates a random goal to be reached through some via-points planned by an action server. If the battery is low or the target is a corridor, the planner goal is cancelled and the appropriate transition is taken. When the controller finishes its computation, the ‘urgentroom_chosen’ transition is taken.
Required parameters: - interface_cortex: an object that provides interfaces with other nodes of the architecture - ontology_cortex: an object that provides the robot’s knowledge of the environment
Optional parameters: - None
Input keys: - None
Output keys: - robot_position: the robot’s current position - target: the target to be reached - random_plan: the planned via-points to reach the random goal
Outcomes: - ‘Robot_recharging’: if the battery is low and the robot needs to go to the charging station - ‘urgentroom_chosen’: when the controller finishes its computation - ‘corridor_chosen’: if the target is a corridor and the robot needs to go there
- class robot_brain.emergencylocation(interface_cortex, ontology_cortex)[source]
Bases:
StateThis class defines a state in a SMACH state machine that sends a robot to a target location using a given plan. If the robot’s battery is low, the state will cancel the plan and send the robot to recharge.
- Parameters:
interface_cortex (interface_cortex) – An instance of the interface_cortex class used to communicate with the robot’s control system.
ontology_cortex (ontology_cortex) – An instance of the ontology_cortex class used to interact with the robot’s knowledge base.
- Returns:
The outcome of the state. Either ‘Robot_recharging’ if the robot needs to recharge, or ‘robot_moved_urgent’ if the robot reaches the target.
- Raises:
Any exceptions thrown by the underlying code.