Workspace – package – node Topic is a way to communicate between nodes. ros2 topic list – command to see topics ros2 topic info /topicname teleopkey – move with keyboard Continuously process inputs and determine outputs o Inputs = sensor readings, communication received, internal state o Outputs = control signals, communication sent Principled way of organising a control system Many different options, but broadly there are 3 categorisations Reactive architectures Don’t “think”, just (re)act Deliberative architectures “Think” about what to do, then act Consider inputs, and “think” about what to do next o Early approach called Sense-Plan-Act cycle Plan the next action(s) based on available information o Usually several possible actions - may need to predict their outcome Hybrid architectures Deliberative at high level, reactive at low level State machines may be used to design a reactive controller. FSM – one way control transfer. ROBOCHART In a module, everything that is required, must be provided somewhere RoboTool will check and enforce these constraints when building a RoboChart model All well-formedness conditions of RoboChart described in its reference manual Module’s the main structuring element for a single robotic system and is characterized by interactions between: One robotic platform o Records the services used by the software in terms of: shared variables, events and operations One or more RoboChart controllers o That specify behaviour of interest as a composition of one or more state machines Robochart examples A collection of examples is available online o Alpha algorithm o Robot-assisted dressing o Firefighting UAV o and much more! When checking out examples, focus on RoboChart models o o Online page also has references to notations not covered in this module, such as: RoboSim (software and physical modelling) RoboWorld (modelling of environment assumptions) Some examples make use of older versions of the notation For the latest version check the RoboChart reference manual A robotic platform represents an abstraction of the robot in terms of the variables, events and operations available to the software. A controller describes possibly parallel behaviours, containing one or more state machines. Modules are the top level constructs of RoboChart, and they associate one or more controllers with exactly one robotic platform. Operation Definitions as reusable State Machines In RoboChart common behaviour in a state machine can be factored out into a software operation, which can then be called from another state machine. Junctions, indicated by a black circle: o Junctions represent a decision point (think if/else) o A transition out of an Initial Junction may not have a condition o An initial junction indicates the start of the control flow (back circle with white i): o Transitions out of a Junction must form a cover ie. a state machine is not allowed to get stuck in a junction States o Have names and actions: o Entry, during, exit Final states have no actions: ROS2 Nav A managed life cycle for nodes allows greater control over the state of ROS system. A managed node presents a known interface, executes according to a known life cycle state machine, and otherwise can be considered a black box. This allows freedom to the node developer on how they provide the managed life cycle functionality, while also ensuring that any tools created for managing nodes can work with any compliant node. BT is a tree structure of tasks to be completed. Unlike a Finite State Machine, a behavior Tree is a tree of hierarchical nodes that controls the flow of execution of "tasks". It creates a more scalable and human-understandable framework for defining multi-step or many state applications. This is opposed to a finite state machine (FSM) which may have dozens of states and hundreds of transitions. An example would be a soccerplaying robot. Embedding the logic of soccer game play into a FSM would be challenging and error prone with many possible states and rules. Additionally, modeling choices like to shoot at the goal from the left, right, or center, is particularly unclear. With a BT, basic primitives, like “kick”, “walk”, “go to ball”, can be created and reused for many behaviors. A signal called "tick" is sent to the root of the tree and propagates through the tree until it reaches a leaf node. Any TreeNode that receives a tick signal executes its callback. This callback must return either o SUCCESS o FAILURE o RUNNING The LeafNodes, those TreeNodes which don't have any children, are the actual commands, i.e. the Nodes where the behavior tree interacts with the rest of the system. Action nodes are the most common type of LeafNodes. A Sequence is the simplest ControlNode: it executes its children one after the other and, if they all Succeed, it returns SUCCESS too. In the classical formulation, there exist four categories of control flow nodes (Sequence, Fallback, Parallel, and Decorator) and two categories of execution nodes (Action and Condition). They are all explained below and summarized in Table 1.1. 2.2 Hierarchical Finite State Machines Hierarchical FSMs (HFSMs), also known as State Charts [29], where developed to alleviate some of the disadvantages of FSMs. In a HFSM, a state can in turn contain one or more substates. A state containing two or more states is called a superstate. In a HFSM, a generalized transition is a transition between superstates. General ized transitions can reduce the number of transitions by connecting two superstates rather than connecting a larger number of substates individually. Each superstate has one substate identified as the starting state, executing whenever a transition to the superstate occurs. Figure 2.2 shows an example of a HFSM for a computer game character. 3.3 Handling Different Cases using a Decision Tree Structure Sometimes, a reactive switching policy can be easily described in terms of a set of cases, much like a Decision Tree. Then, the fact that BTs generalize Decision Trees can be exploited, see Section 2.5.2. A simple Pac-Man example can be found in Figure 3.4. The cases are separated by the two conditions Ghost Close and Ghost Scared. If no ghost is close, Pac-Man continues to eat pills. If a ghost is close, the BT checks the second condition, Ghost Scared, which turns true if Pac-Man eats a Power Pill. If the ghost is scared, Pac Man chases it, if not, Pac-Man avoids the Ghost. Encoders use different types of technologies to create a signal, including: mechanical, magnetic, resistive and optical – optical being the most common. In optical sensing, the encoder provides feedback based on the interruption of light.