Real-time robot control framework
Patent Information
- Application Number
- JP2023556921
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-04-30
- Filing Date
- 2022-04-29
- Publication Date
- 2025-02-13
- Estimated Expiration
- 2042-04-29
Smart Images

Figure 0007629538000008 
Figure 0007629538000009 
Figure 0007629538000010
Abstract
Description
[Background technology]
[0001] This specification relates to a framework for a software control system.
[0002] A real-time software control system is a software system that must execute within strict timing requirements to achieve normal operation. Timing requirements often specify that an action must be performed or an output must be generated within a specific time window to avoid the system entering a fault state. In a fault state, the system may stop execution or take some other action that interrupts normal operation. Such real-time software control systems are often used to control physical machines that have high precision and timing requirements. As an example, an industrial robot work cell may be controlled by a real-time software control system that requires each robot to repeatedly receive commands at a certain frequency, e.g., 1, 10, or 100 kHz. If one of the robots does not receive a command during one of the periodic time windows, that robot may enter a fault state by ceasing its operation or by automatically executing a recovery procedure to return to a maintenance position. As used herein, a work cell is the physical environment in which the robot operates. A work cell has certain physical characteristics, e.g., physical dimensions, that impose constraints on how the robot can move within the work cell.
[0003] Due to such timing requirements, software control systems for physical machines are often implemented by closed software modules that are specifically configured for highly specialized tasks. For example, a robot that picks up parts for placement on a printed circuit board may be controlled by a closed software system that controls each of the low-level pick and place actions. Summary of the Invention
[0004] This specification describes a real-time robot control framework that provides a unified platform for achieving multiple new capabilities for custom real-time control. As one example, the techniques described herein enable users to define custom real-time reactions for one or more physical robots. As another example, the techniques described herein enable custom real-time reactions to trigger callbacks to non-real-time functions, such as application-level control functions, in response to external stimuli detected in real-time while the real-time operation of the robot continues. As yet another example, the techniques described herein enable custom real-time processing of streaming inputs. Streaming inputs are real-time inputs that can arrive at varying rates, or non-deterministically, or both. Additionally, in some such examples, the techniques described herein provide a framework in which users can define custom real-time control code, custom callback code, custom streaming control code, or a combination thereof.
[0005] As used herein, a framework is a software system that allows a user to provide high-level program definition while implementing low-level control functions of a real-time robotic system. As used herein, an operating environment includes multiple subsystems, each of which may include one or more real-time robots, one or more computing devices having software or hardware modules that support the robot's movements, or both. The framework provides a mechanism for bridging, communicating, or coordinating between multiple systems, including transferring control parameters from a robot application system, providing sensor measurements to the real-time robotic control system for use in computing custom actions, and receiving computed hardware control inputs for custom actions from the real-time robotic control system, all while maintaining the tight timing constraints of the real-time robotic control system, e.g., on the order of one millisecond.
[0006] Particular embodiments of the subject matter described in this specification can be implemented to realize one or more of the following advantages.
[0007] Some existing robotics application frameworks define the interfaces of devices and software modules and do not allow users to customize the interfaces for specific use cases, much less real-time custom use cases. Some systems described in this application allow users to configure custom software modules that facilitate the execution of custom actions by one or more robots that fit their needs, and users can also formulate data interfaces for the constituent software modules of the real-time robotics control framework. Some such software modules can then be deployed into a control system that allows real-time control of the custom actions while also supporting asynchronous programming or streaming inputs or both. A real-time control system is a software system that is required to perform actions within strict timing requirements to achieve normal operation.
[0008] Under the design of the disclosed real-time robot control framework, custom software modules allow the robot to incorporate both real-time sensor information and custom control logic, even in hard real-time systems. The use of custom software modules may in some cases provide additional capabilities for the robot to react in a more natural and fluid manner, resulting in more precise movements, shorter cycle times, and greater reliability when completing specific tasks. The use of custom software modules may also facilitate easy integration with specific robot hardware through a hardware abstraction layer.
[0009] The details of one or more embodiments of the subject matter described herein are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, drawings, and claims. [Brief description of the drawings]
[0010] [Figure 1] FIG. 1 is a diagram of an exemplary system. [Diagram 2] FIG. 1 is a flow diagram of an exemplary process for performing custom real-time reactions. [Diagram 3] 1 shows an example of a real-time state machine of actions related by custom real-time reactions. [Figure 4] 1 illustrates modules that a user can define to implement custom real-time control code using the framework described herein. [Diagram 5] FIG. 1 is a flow diagram of an example process for implementing custom real-time reactions using callback functions. [Figure 6] FIG. 13 is an example diagram of an execution trace for a custom real-time reaction using a callback function. [Figure 7] FIG. 11 is a flow diagram of an example process for executing a custom action using streaming input. [Figure 8] FIG. 13 is an example diagram of an execution trace for a custom real-time reaction using streaming input.
[0011] Like reference numbers and designations in the various drawings indicate like elements. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] 1 is a diagram of an exemplary system 100. System 100 includes a real-time robotic control system 150 that drives multiple robots 172a-n in an operating environment 170. System 100 includes several functional components that may be implemented as computer programs installed on one or more computers at one or more locations, each of which is coupled to one another via any suitable communications network, e.g., an intranet or the Internet, or combination of networks.
[0013] System 100 is one example of a system that may implement the real-time robotic control framework described herein. In particular, system 100 may provide a unified framework that allows users to achieve multiple different types of custom real-time control while simultaneously supporting asynchronous programming and / or streaming input. Robotic control systems are described herein as real-time vehicles that are required to execute within strict timing requirements to achieve normal operation. Timing requirements often specify that an action must be performed or an output must be generated within a specific time window to avoid the system entering a fault state. For simplicity, each time window may be referred to as a tick or a control tick. In a fault state, after a tick has elapsed without completing its required computation or action, the system may stop execution or take some other action that interrupts normal operation, e.g., return the robot to a start pose or a fault pose.
[0014] As used herein, custom real-time control means that a user can specify how a robot in a work cell should act or react at each tick of the real-time control cycle. An action refers to a movement with precalculated motion parameters, such as moving a tool on a robot arm from point A to point B. A reaction refers to a real-time switch between actions due to certain specified conditions, which may include sensor data updated in real-time. Additionally, the system 100 allows a user to specify custom real-time control code that is executed to recalculate motion parameters on the fly at each tick of the real-time control cycle, as opposed to issuing low-level commands according to precalculated motion parameters.
[0015] An advantage of the framework provided by system 100 is that it can enable a user to specify such custom real-time control information with a relatively small amount of user code, which may be expressed in a high-level programming language, such as object-oriented programming (OOP) languages including C++, Python, Lua, and Go, to name a few. This ability to provide a high level of custom real-time control is much easier and more powerful than programming robot motion using only low-level commands related to joint angles or current levels.
[0016] A user of the system 100 can initiate custom real-time control execution by providing custom real-time control code to the real-time robotic control system 150. For example, the user can use a user device 190 to provide the custom real-time control code to the application layer 122a. The user device 190 can run, for example, an integrated development environment (IDE) compatible with the real-time robotic control system 150. An IDE is a software suite that provides tools to facilitate a user writing and, optionally, testing software for deployment in the real-time robotic control system 150. A user can develop a custom software application in an editor of the IDE. For example, a user can write code, e.g., class, object, or method instances, required to facilitate real-time control of one or more robots to perform custom actions. The system can also prompt the user to write code for different software modules to be included in the control stack 122 or different components of a single software module. For example, the user interface subsystem 190 may generate user interface presentations that, when deployed, prompt or guide a user to write code for the different classes, objects, or method instances that make up each software module contained within the control stack 122.
[0017] A class is a combination of methods and data encapsulated in a file that defines how the data is stored and accessed. A class may form a template from which an instance of executable code can be created or instantiated. An object, or code object, is code that can be interpreted, compiled, or both. An object may be an instance of a class instantiated for a particular purpose.
[0018] The real-time robotic control system 150 can then prepare the custom real-time control code for execution. Different portions of the custom real-time control code can be executed at different layers of the control stack, for example, at the client 123a, the non-real-time server 123b, the real-time control layer 123c, or some combination thereof.
[0019] In general, the control stack of the real-time robot control system 150 follows a client-server model where the client 123a provides commands to the non-real-time server 123b, which handles passing the commands across the boundary 124 between real-time and non-real-time code. The non-real-time server 123b can run on a common computer with the client 123a or on a different computer. As mentioned above, this configuration allows the non-real-time server 123b to implement custom real-time reactions that cause the real-time control layer 123c to switch the execution of actions in real-time. Thus, the real-time server 123b can be responsible for determining in which control cycle the real-time reaction should occur.
[0020] The real-time robot control system 150 is then configured to control the robots 172a-n in the operating environment 170 according to the custom real-time control code. To control the robots 170a-n in the operating environment 170, the real-time robot control system 150 provides commands, e.g., commands 155a-n, to be executed by one or more robots, e.g., robots 172a-n, in the operating environment 170. To compute the commands 155, the real-time robot control system 150 consumes observations 175a-n made by one or more sensors 171a-n that collect data in the operating environment 170. As illustrated in FIG. 1, each sensor 171 is coupled to a corresponding robot 172. However, the sensors need not have a one-to-one correspondence with the robots, nor need they be coupled to the robots. In fact, each robot can have multiple sensors, and the sensors can be mounted on stationary or movable surfaces in the operating environment 170. Any suitable sensor 171 can be used, such as distance sensors, force sensors, torque sensors, cameras, to name a few.
[0021] The real-time robot control system 150 may provide the commands via a control stack 122, which handles providing real-time control commands 155 to the robots 172a-n. The control stack 122 may be implemented as a software stack that is at least partially hardware independent. In other words, in some implementations, the software stack may accept as input commands generated by the control system 150 without requiring that the commands specifically relate to a particular model of robot or a particular robot component.
[0022] The control stack 122 includes multiple levels, each of which has one or more corresponding software modules. In FIG. 1, the lowest level is the real-time hardware abstraction layer 122c, and the highest level is the application layer 122a. Some of the software modules 122a-c may be high-level software modules that consist of one or more low-level software modules and data interfaces created by a user using the low-level software modules. That is, a custom high-level software module may depend on one or more low-level software modules.
[0023] The control stack 122 ultimately drives the robot components, including devices that perform lower-level actions and sensors that report lower-level status. For example, a robot can include various lower-level components, including motors, encoders, cameras, drivers, grippers, application-specific sensors, linear or rotational position sensors, and other peripheral devices. As an example, a motor can receive a command 155 indicating an amount of torque to be applied. In response to receiving the command, the motor can report a status message to a higher-level software stack, for example, using an encoder, specifying the current position of the robot's joints. As another example, the control stack 122 can directly receive observations generated by one or more sensors in the operating environment 170, which may or may not be physically coupled to the robot 172. For example, the observations can include image data generated by an arm-mounted camera or a wall-mounted camera.
[0024] Typically, command and status messages are generated periodically during each control cycle, e.g., one status message and one command per control cycle. Lower levels of the software stack generally have tighter time requirements than higher levels of the software stack. For example, at the lowest level of the software stack, the control cycle may have true real-time requirements.
[0025] In some implementations, the application layer 122a may provide target trajectory information for the robotic component. In the case of custom real-time control code, the target trajectory information may be based on status messages generated by other software modules in the control stack 122, real-time observations 175, or both. The trajectory information includes at least the trajectory setpoints ("goal states") of the robotic component and, optionally, other metadata. The goal states may include one or more of the position, velocity, or acceleration of the robotic component for each instant in time in a particular period of time. The trajectories generated by the application layer 122a may be in Cartesian space coordinates or in joint space coordinates.
[0026] The trajectory information may be consumed by real-time control layer 123c, which uses the trajectory information to generate continuous real-time control signals including, for example, real-time positions, velocities, or torques of robotic components such as robot joints, which determine how to drive motors and actuators of robot 172a-n to follow the desired trajectory. The continuous real-time control signals may then be consumed by hardware abstraction layer 122c. Hardware abstraction layer 122c may include software modules, for example, real-time controller modules, that interface with robot 172a-n by, for example, issuing real-time commands 155a-n to drive the motion of moving components, such as joints, of robot 172a-n within operating environment 170 to follow the desired trajectory.
[0027] A real-time controller generally has parameters that determine how a robot controlled by the controller is driven along a target trajectory. Thus, the behavior of a robotic system is determined not only by the trajectory information but also by the control parameters. Different tasks may require or benefit from different control parameters, which may also need to be changed during a task for best performance. In this specification, control parameters are values that specify how a real-time controller moves a robotic component to follow a trajectory.
[0028] The details of the timing constraints and the flexibility associated with the timing windows are generally configurable aspects of the real-time robotic control system 150 that can be tailored to the task being performed. In an exemplary system, the real-time requirements of the system 150 require that the hardware abstraction layer 122c provide commands at a first rate (or frequency), e.g., every 5, 10, or 20 milliseconds, while the non-real-time requirements of the system 150 specify that the control layer 122b should provide commands to the hardware abstraction layer 122c at a second rate, often lower than the first rate, e.g., every 25, 50, or 100 milliseconds. In addition, the rate need not be fixed. For example, the hardware abstraction layer 122c may provide commands at a fixed rate, while the application layer 122a may provide commands at a variable or sporadic rate.
[0029] To bridge the boundary between the non-real-time commands generated by higher-level software modules in the control stack 122 and the real-time commands generated by lower-level software modules in the control stack 122, the real-time robot control system 150 can use a control layer 122b, which in turn can include both a real-time control layer 123c and a non-real-time server 123b that collectively facilitate real-time control of custom actions from commands issued by a client 123a. The control layer 122b serves as a bridging module in the control stack that converts each non-real-time command into data that can be consumed by a real-time controller that is responsible for generating low-level real-time commands. Such low-level real-time commands can relate, for example, to the actual levels of current applied to the robot motors and actuators at each time to cause the movement specified by the command. For each custom real-time action, some or all of the constituent software modules of the control layer 122b can be developed by the user, including the constituent software modules of the real-time control modules in the control layer 122b. Once developed, the configuration software modules may be provided in the form of one or more application programming interfaces (APIs) and may interface with those in the application module 122b to facilitate custom real-time control of the robot.
[0030] The first type of custom real-time control is a custom real-time action. A user can define a custom real-time action by specifying a set of motion parameters. The motion parameters can be pre-calculated, meaning that the motion parameters can be generated before the action is defined, for example, as calculated by a cloud-based motion planner. A client can provide a definition of the custom real-time action to the non-real-time server 123b, which can then initialize all the motion parameters and other state variables for real-time execution. For example, the non-real-time server 123b can pre-allocate memory and perform data format conversion between non-real-time and real-time data formats. The client can then provide a start command to the non-real-time server 123b, which initiates the execution of the custom real-time action.
[0031] The second type of custom real-time control is custom real-time reactions. Custom real-time reactions define real-time transitions between two real-time actions according to one or more conditions. As an example, two motion actions can be chained together by associating the first action with a reaction condition that represents the end of the first action. When the condition is met, the real-time control layer automatically and in real-time switches to the execution of the second action. In other words, the real-time control layer does not have to wait for confirmation or instructions from a higher-level controller to start the execution of the second action. These mechanisms also allow users to easily define powerful and complex state machines of actions, whose transitions are executed in real-time.
[0032] Another powerful feature of the framework described herein is the integration of real-time sensor data into the mechanisms of custom real-time control. One way to do this is to make the conditions associated with the custom real-time reaction dependent on the sensor data. For example, a user can define a custom real-time reaction that changes the admittance control of a robot arm when the arm contacts a surface. To do so, a user can define a condition based on a force sensor such that the real-time control layer can automatically, and in real-time, switch execution to a different action when the force measured by the force sensor exceeds a certain threshold.
[0033] Another type of custom control is custom real-time control code. Unlike the code that defines custom actions and reactions, the custom real-time control code is generally executed by the real-time control layer itself to calculate the motion parameters for driving the robot in the operating environment. This configuration provides another mechanism for integrating real-time sensor data into the custom real-time control. For example, a user can define a custom real-time control code to maintain a specific distance, e.g., 0.5 mm, on the surface when performing a welding or gluing task. Both the actual current distance of the tool from the surface and the motion parameters for adjusting the distance can be calculated in real time according to the user's custom real-time control code.
[0034] Another powerful feature of the framework described herein is the integration of asynchronous programming into the mechanism of custom real-time control, allowing users to write a relatively small amount of code, e.g., in C++, Python, Lua, or Go, that defines one or more simple callback functions in the application layer 122a to react to events detected in real-time during the operation of the robots 172a-n.
[0035] Synchronous programming is simple: when a call is made to a function, the calling thread blocks, waiting until the function completes before unblocking. In contrast, in asynchronous programming, the calling thread, which initiates an asynchronous call to a function, is not blocked and can perform other processing, thereby allowing ongoing work to continue or other additional work to be performed while the computation is being performed. Once execution is complete, the calling thread can be notified of the result by a callback.
[0036] A callback function is a pointer to executable code that is passed as an argument to another function. A callback function may be code that handles an event when executed by the system 150. Thus, a callback function may be used to notify a client 123a that an event has occurred. In a general sense, an event is a message or signal that is sent when a situation occurs. For example, such events may include a change in the configuration of the robots 172a-n or a change in the layout of the operating environment 170, which may be observed by using the sensors 171a-n.
[0037] More specifically, the framework may enable custom real-time reactions in the control layer 122b running in a real-time thread to invoke application layer level control functions that perform some functions and return results to the custom real-time reaction. Furthermore, by implementing asynchronous operation within the framework, the control layer 122b does not wait or block for a response before continuing to execute real-time robot control as would be done in synchronous operation. Rather, the real-time thread controlling the robot operation continues and can accept results from the application layer level control functions at any time. As a result, the framework provides the real-time robot control system 150 with the ability to support additional tasks, including time-intensive tasks that involve controlling different components of the operating environment or interfacing with different systems, while still ensuring custom real-time control of the robots 172a-n.
[0038] A further powerful feature of the framework described herein is the integration of streaming inputs into the mechanism of custom real-time control. In other words, the framework facilitates custom real-time processing of streaming inputs. Streaming inputs are inputs to the control layer that may arrive at varying rates or non-deterministically, e.g., with incomplete information, or both. For example, client 123a may generate and provide streaming control commands to control layer 122b when executing some computationally expensive control function, such as a machine learning control algorithm.
[0039] To handle the gaps between streaming inputs, the real-time robot control system 150 may execute real-time streaming control functions in the non-real-time server 123b. For example, the real-time streaming control functions may implement some data interpolation or extrapolation logic to generate interpolated or extrapolated control parameter information that specifies a goal state of the robot, for example, in terms of the robot's position, velocity, acceleration, joint angles, or a combination thereof. Each interpolated or extrapolated control parameter may have a defined range of possible values that the robot may assume. For example, the real-time streaming control functions may generate control parameter values at each point in time during a period of time, or as a series of calculated control parameter values. The interpolated control parameters are used by the hardware abstraction layer 122c to, for example, drive the robot 172a-n along a trajectory generated by the client 123a to achieve the real-time guarantees of the system. This makes it feasible to execute some computationally expensive high-level control functions in the real-time robot control system 150 for use in controlling the robot 172a-n. This is also very different from conventional robot control systems, where the control parameters are typically set once during the setup of the robot installation and never changed again thereafter.
[0040] The framework also allows users to write and provide code that defines custom real-time streaming control functions, thereby explicitly defining how to handle gaps between streaming inputs. Alternatively or additionally, the framework allows users to select from a library of pre-defined real-time streaming control functions provided by the framework to handle such gaps, e.g., as a user-selected interpolation function for computing the goal state.
[0041] 2 is a flow diagram of an exemplary process for executing custom real-time reactions. The process may be implemented by one or more computer programs installed on one or more computers and programmed according to the present specification. For example, the process may be performed by the real-time robotic control system 150 shown in FIG. 1. For convenience, the process is described as being executed by a system of one or more computers.
[0042] As described above, the system executes a real-time robot control framework consisting of a stack of multiple software modules that can be repeatedly executed in a predetermined sequence to control one or more robots. One such software module is a bridging module in the control stack that converts each non-real-time command into data that can be consumed by a real-time controller that is responsible for generating low-level real-time commands to control one or more robots to perform custom actions.
[0043] The system receives (210) a definition of a custom real-time control function. The custom real-time control function specifies a sequence of actions to be executed with deterministic timing and one or more custom reactions that chain the sequence of actions. To chain the sequence of actions, each custom reaction may include one or more conditions for real-time switching between a pair of actions in the plurality of actions, i.e., between the completion of a first action of the robot and the start of a second action. Also, the reaction itself may be a user-defined custom reaction.
[0044] The custom real-time control functions may be provided by an entity different from the entity that runs or provides the real-time robot control framework. For example, the real-time robot control framework may be pre-configured by the manufacturer of the robot, or by an entity responsible for setting up the robotic plant, or by an entity that owns and operates the robotic plant. In other words, the real-time robot control framework allows users to easily provide their own real-time control of a robotic plant without relying on the robot manufacturer or the entity that initially sets up the plant.
[0045] The custom real-time control function may be provided at a number of different times. In some cases, the custom real-time control function may be provided at compile time, such as when code is compiled into the real-time control layer software. Alternatively or additionally, the custom real-time control function may be provided dynamically at run-time, for example as a plug-in, in the real-time control layer, and a user of the system may provide a definition by supplying a custom configuration of the custom real-time control function.
[0046] In some cases, a user of a system that controls one or more robots can design real-time state machines by defining custom actions and custom reactions for the robots, and definitions of custom real-time control functions can be provided by the user in the form of a real-time state machine of actions related by custom reactions.
[0047] As used herein, a real-time state machine is a representation of the behavioral transitions performed by a robot. The real-time state machine includes nodes and edges, each node representing a real-time state of the robot or a set of actions that the robot may perform, and each edge between a first node and a second node representing one or more "switch conditions" that, when met, transition the robot from performing the action represented by the first node to performing the action represented by the second node. Thus, when the system is within a particular node of the real-time state machine, the system sends a real-time command to drive the robot to perform the action represented by the particular node, while continuously monitoring the switching state of the node. Each time one of the switch conditions is met, the system may transition to a different node of the real-time state machine by sending a different real-time command to cause the robot to enter a state represented by a different node of the real-time state machine.
[0048] Table 1 contains examples of user code written to define and initiate custom real-time actions.
[0049] [Table 1]
[0050] The exemplary user code can be executed by a client of a real-time robot control system using a set of pre-calculated motion parameters.
[0051] In line 1, the client initiates a session with a non-real-time server.
[0052] In line 2, an action is defined. The action definition includes an ID (line 3), a type (line 4), and motion parameters (line 5). Line 6 indicates that there is no reaction associated with this action, so when executed, the system will simply execute it as a one-off real-time action and then terminate execution.
[0053] In line 7, the client initiates a real-time action by sending a command referencing the action ID to the non-real-time server. The control layer of the system then initializes the real-time environment and executes the action accordingly.
[0054] Table 2 contains examples of user code for defining custom real-time reactions.
[0055] [Table 2]
[0056] Two actions are defined, respectively, in lines 2 and 13. However, unlike the example in Table 1, each action has an associated reaction.
[0057] As shown in lines 7-10, the first action has a reaction that specifies a condition and a response. In this case, the condition is simply whether the action was performed in accordance with a control signal that indicates the action is complete.
[0058] To chain actions together, the associated response is to initiate a second action with an action_id of 1, as shown on line 10.
[0059] The other action, action1, has a similar associated reaction defined in lines 18 to 21. However, the reaction is simply to generate a signal that the sequence of actions is complete.
[0060] On line 31, a client application can use this signal to wait until the sequence is complete.
[0061] Table 3 contains an example of user code for defining a state machine that integrates real-time sensor feedback. This example moves a robot end effector up and down repeatedly for 30 seconds based on the readings of a distance sensor (the "rangefinder" sensor). The two states "move up" and "move down" are represented as actions, action0 and action1, respectively.
[0062] [Table 3]
[0063] In this example, the condition associated with the reaction uses a real-time sensor input, which is referenced in the client-side code by a variable with the name "rangefinder_distance." When the real-time robot control system prepares to execute the custom real-time control code, the system may automatically update instances of the variable name with the corresponding memory location where the rangefinder sensor results are automatically updated in real-time.
[0064] In this case, the first state of the state machine is represented by Action 1, where the end effector is moving downward. At each tick of the real-time control cycle, the system may check any conditions associated with the currently executing action. If none of the reaction conditions are met, the action continues, in which case, at each tick, the system moves the end effector according to the motion parameters generated by the function VelocityMoveWithRangefinderFixedParams() in lines 2 and 8. In this case, both actions have the same position motion parameters, but different target velocities.
[0065] During execution, the system may execute a software application corresponding to the exemplary code snippets shown above to calculate in real time control parameters associated with controlling a robot to perform a custom real time action. The system may then transmit the calculated control parameters to other relevant modules in the system (e.g., a real time software control module running on a server) to be executed in real time.
[0066] An example of a real-time state machine of actions related by custom real-time reactions is shown in Figure 3. In Figure 3, a robot is assigned to perform a gluing task to apply glue to an object in an operating environment, for example, in a work cell.
[0067] The exemplary real-time state machine 300 shown in FIG. 3 starts with a robotic articulation action 310. While performing the articulation action 310, the system evaluates whether conditions associated with reactions to the articulation action 310 are satisfied. Each action may be associated with multiple reactions, each with one or more conditions. Thus, at each control tick, the system may evaluate conditions associated with all reactions to the currently executing action. To improve latency, in some implementations, the system does not need to consider whether conditions for reactions of other actions that are not being executed have been satisfied. In other words, the system may only consider conditions of reactions associated with the currently executing motion.
[0068] As mentioned above, evaluating a condition may consume real-time sensor data. Thus, a common pattern is for the system to determine whether the robot has achieved a particular position or pose during an articulation action. In this case, the system may use a condition to determine, for example, whether the robot has reached a point where adhesion should begin.
[0069] If the conditions for a reaction are met, the system transitions to the next one in real time according to a state machine defined in the user's custom real-time reaction code. Thus, the system may transition to the glue application action 320 in real time. Importantly, the system does not need to evaluate a high-level plan or spend time calculating the next action. All real-time transitions between actions are explicitly specified by the user's custom real-time reaction code, which allows for reliable real-time switching between actions.
[0070] If the condition of the reaction is not met, the system performs the next control tick of the current action. Thus, when actions and reactions are used to define a state machine, there is an implicit loopback transition (denoted by the dashed line) whenever the condition associated with the reaction is not met.
[0071] In this example, the conditions for determining if the reaction is satisfied may include determining if the robot is in position for gluing, if the clamps are closed on the object to secure and glue the object, or both.
[0072] Once the reaction is satisfied, the system may update the current action to the gluing action 320 and accordingly control the robot to perform the action of applying glue onto the object. However, the gluing action 320 cannot occur until the robot is in position for gluing, the clamp is closed, or both.
[0073] From the apply glue action 320, the real-time state machine 300 may have two responses, the first response is to end the performance of the apply glue action 320 and transition to the articulate action 340, and the second response is to end the performance of the apply glue action 520 and transition to the stop action 340. For example, the condition for determining whether the first response is met may include determining whether the apply glue action 320 has been performed for a predetermined period of time, whether the clamp is open, or both. Also, the condition for determining whether the second response is met may include determining whether a human is detected in proximity to the robot during the apply glue action 320. Then, once the response is met, the system may transition to either the articulate action 330 to begin moving away from the object, or the stop action 340, i.e., "freezing" the apply glue action 320 in progress.
[0074] Referring back to FIG. 2, the system repeatedly executes a custom real-time control function at each given control tick of a real-time robotic control system that drives one or more physical robots. For example, the system may repeatedly execute the custom real-time control function at each control tick of the system according to a pre-determined control schedule, e.g., following the initiation of execution of the real-time control function. Briefly, this involves obtaining (220) current values of one or more state variables, evaluating (230) one or more custom responses specified by the custom real-time control function according to the current values of the one or more state variables, and updating (240) a current action in real time according to the satisfied custom response each time the custom response is satisfied, and executing (250) the next tick of the current action.
[0075] Some or all of the custom responses specified in the custom definition of the custom real-time control function may use sensor inputs in real time. Thus, during execution of the custom real-time control function, the system repeatedly acquires one or more sensor values generated by one or more sensors in the operating environment of the one or more robots. For example, the sensors may include distance sensors, force sensors, torque sensors, or cameras that observe within the operating environment.
[0076] The system may determine whether the custom reaction is satisfied by one or more sensor values generated from a sensor in the operating environment. In response to a positive determination, the system then performs a real-time switch between the first real-time action and the second real-time action. In some implementations, each time the custom reaction is satisfied, the system also obtains new sensor values to be used by the updated current action.
[0077] While the system is executing the current action, it obtains 220 current values of one or more state variables. State variables may generally include sensor values or information derived from sensor values, or both.
[0078] In the example of FIG. 3, when the system is in the articulation action 310, to determine if the reactions to transition to the glue application action 320 are satisfied, the system may obtain sensor values including distance readings generated by a distance sensor or camera images generated by a camera, and then use the sensor values to determine if the robot has entered position for gluing, if a clamp has closed on the object to secure and glue the object, or both.
[0079] The system evaluates (230) one or more custom responses specified by the custom real-time control function according to the current values of the one or more state variables.
[0080] In some implementations, to determine if the custom reactions are satisfied, the system may evaluate all of the custom reactions specified by the custom real-time control function. In other implementations, the system may evaluate only the custom reactions associated with the current action. In the example of FIG. 3, when the system is at the articulation action 310, only the reactions for transitioning to the glue application action 320 may be evaluated by the system, but not other reactions for transitioning to the articulation action 330 or the stop action 340.
[0081] Each time a custom reaction is satisfied, the system updates the current action in real time, i.e., within the current control tick, according to the satisfied custom reaction (240). Optionally, the system also obtains new sensor values to be used by the updated current action. In FIG. 3, for example, the condition for real-time switching between the glue application action 320 and the articulation action 330 may be that a predetermined thickness of glue has been applied on the object, and in response to a positive determination by evaluating the reaction according to the current value of the state variable related to the glue thickness, the system can stop performing the glue application action 320 and transition to the articulation action 330 to start moving away from the object.
[0082] Alternatively, if the custom reaction is not satisfied, the system continues to execute the next control tick of the current action (250), i.e., process 200 returns to step 220 where the system obtains new values for one or more state variables.
[0083] 4 shows modules that a user can define to implement custom real-time control code using the framework described herein. The above example illustrates how a user can define custom real-time reactions for actions that have pre-computed motion parameters and sensor data exposed by the underlying control system.
[0084] However, as mentioned above, the framework described herein may also enable a user to define custom real-time control code that is executed in real-time on the server to calculate motion parameters on the fly. In addition to giving the user the ability to define exactly how the motion parameters are calculated in real-time, the framework also provides user control over how the sensor data values are obtained, interpreted, and used.
[0085] At a high level, the modules are conceptually organized into two sub-graphs that execute in different domains: The first sub-graph 410 represents the order of execution by the non-real-time threads of the control layer, e.g., by the non-real-time servers 123b. In essence, the first sub-graph 410 shows how the framework prepares the execution environment for executing custom control code in real time. The functions defined in these modules do not have to be real-time safe, although some implementations require them to be thread-safe.
[0086] The second sub-graph 420 represents the execution order of the modules at each control tick of the real-time control cycle. Thus, the framework automatically executes these user-provided modules as state machines in this order at each tick in the control cycle to implement custom real-time control. Unlike the real-time reactive state machines described above, which typically execute over multiple ticks, the second sub-graph 420 can be executed completely in real-time from sensing to control at each control cycle.
[0087] As shown in Figure 4, the modules of the second subgraph 420 execute in one or more real-time threads and therefore must be real-time safe. They may optionally not be thread-safe. In particular, the system may perform compile-time checks to ensure that functions do not attempt to operate with non-deterministic timing, such as allocating memory or performing network communications. The example modules shown in Figure 4 may be written in any suitable programming language, such as C++, Python, Lua, or Go, to name just a few.
[0088] More specifically, the first sub-graph 410 includes non-real-time function calls between a static “Create” function 412 , a constructor 414 for a real-time action object, and a “PrepareParameters” function 416 .
[0089] Constructor 414 may be a program or class that, when executed by the system, creates an instance of a real-time action object. The real-time action object created by constructor 414 conforms to the concept of an object as defined by object-oriented programming (OOP), but is generally an encapsulated representation of actions and data that may or may not inherit its actions and data from other objects or allow its actions and data to be inherited by other objects. The constructor 414 concept includes a Create function 412.
[0090] The framework may define a robot action class for each real-time robot behavior that uses a specific type of input, a specific type of output, a specific control law, or a combination thereof. Each real-time object may be responsible for controlling a specific set of one or more moving components, e.g., one or more joints of the robot. One real-time object may execute all action instances for its action part group combination. Real-time action objects may be initialized based on the configuration of their moving components, e.g., according to the number of degrees of freedom (DoF).
[0091] To begin the process, the system may call a static Create function 412 to create a real-time action object. During this process, the Create function 412 may discover hardware interfaces or interfaces to higher layers of the control stack. For example, the Create function 412 may obtain feature interfaces for the real-time action object to read or control joint positions, calculate inverse kinematics, or read joint velocity limits for a particular deployment.
[0092] The system may then call the constructor 414 of the real-time action class to instantiate the real-time object and PrepareParameters 416 to prepare the control parameters for real-time execution. These functions may be called from non-real-time threads, so they may dynamically allocate memory and execute algorithms of any length. More specifically, the "PrepareParameters" function 416 may be utilized to unpack generic control parameters, convert them into real-time safe parameters, perform extensive checks to verify that the parameters are within limits, and prepare the inverse kinematic solution, if necessary. In particular, during the execution of a real-time action, the system may use the "PrepareParameters" function to convert any non-real-time control parameters into real-time control parameters. For example, the non-real-time control parameters may include different trajectory set points for the robot components, while the real-time control parameters may relate to the actual levels of current applied to the robot motors and actuators at each time to cause the motion specified by the command.
[0093] During real-time execution, the system automatically executes the modules in the order shown in sub-graph 420, which contains function calls between four real-time functions: “Sense” function 422, “GetStateVariable” function 424, “SetParameters” function 426, and “Control” function 428.
[0094] In the subgraph 420, the system may first utilize a "Sense" function 422 to read updated sensor values, e.g., the state and position of the robot's moving components. The system may then utilize a "GetStateVariable" function 424 to retrieve updated state variables. A state variable may be user-specified, the selection of which may include sensor values or information derived from sensor values, or both. For example, a state variable may include torque readings, velocity, position, or orientation of a robot component, such as a joint. As another example, one state variable may characterize the robot's progress toward completing a current action, e.g., distance to a goal position. Each state variable may be associated with one or more numerical values. In some cases, the "Sense" function and the "GetStateVariable" function are each called once per control tick. In other cases, these functions are called multiple times during each control tick to facilitate action switching in the same control cycle.
[0095] The system may use the "SetParameters" function 426 to apply changes to values of control parameters that are real-time safe. The system may use the "Control" function to execute custom control laws and set new control points for moving components. The "SetParameters" and "Control" functions are typically called once per control tick.
[0096] Unlike the "Constructor" and "PrepareParameters" functions in subgraph 410, which are called from a non-real-time thread and therefore may be dynamically allocated and execute longer algorithms, these functions in subgraph 420 are called from a real-time thread and must be implemented in a real-time safe manner, for example by avoiding allocations and non-deterministic time computations. In terms of computation time, the "Control" function must complete within the period of a control tick, while other real-time functions, including the "Sense" and "GetStateVariable" functions, may need to execute substantially faster since they may be called multiple times per control tick.
[0097] Table 4 contains an example of user code that defines the modules shown in Figure 4 to implement custom real-time control. In this simple example, the user code causes the joints to follow motion parameters that are calculated in real-time according to custom code, as opposed to being pre-calculated. The resulting calculations, when input to and executed by the framework, cause the robot joints to follow a sine wave through the robot's fourth joint, and therefore the real-time action class is named "SineWaveAction".
[0098] [Table 4-1] [Table 4-2]
[0099] Referring again to the example diagram of FIG. 4, the “SineWaveAction” constructor, the “SineWaveAction::Create” function, and the “SineWaveAction::PrepareParameters” function collectively configure the non-real-time sub-graph 410 .
[0100] And the “SineWaveAction::Sense”, “SineWaveAction::Control”, “SineWaveAction::SetParameters”, and “SineWaveAction::GetStateVariable” functions collectively constitute the real-time functions within sub-graph 420 .
[0101] During execution, the "SineWaveAction::Sense" function may be used by the system to retrieve an updated position of the robot, the "SineWaveAction::GetStateVariable" function may be used to retrieve updated state variables, and the "SineWaveAction:SetParameters" function may be used to apply changes to the values of control parameters, i.e., as a result of execution of the "SineWaveAction:Control" function.
[0102] Note that the "SineWaveAction::Control" function calculates the motion parameters in real time according to user-provided code to achieve the sinusoidal motion action. The code in the "SineWaveAction::Control" function contains user code that, when executed, can calculate the real-time target positions of the robot joints according to the sinusoidal control law and the joint limits of the robot.
[0103] Several use cases are now described. As a specific example, the framework may provide a user with the ability to achieve custom real-time admittance control of one or more robots. Admittance control may be useful when a user wants to tailor the robot's interaction with the environment. For example, to perform move-touch, touch manipulation, or contact-based interaction with an object, a real-time robot control system may use the framework to read force or torque readings from a sensor located, for example, on the robot tooltip and control the position or velocity of the robot arm in real time.
[0104] As another specific example, the framework may provide users with the ability to achieve custom real-time sensor-based control of one or more robots with a nominal path. For example, gluing, deburring, polishing, or other tasks generally require the robot to follow a continuous path, but if the part has variations, is freely positioned, or the cell is not precisely calibrated, the path currently followed by the robot arm may require modification, i.e., to adapt to the part. The adaptation must be done in a real-time control cycle using sensor inputs, e.g., force and torque inputs from sensors at the robot tool tip or from visual distance sensors.
[0105] As another specific example, the framework may provide a user with the ability to control one or more robots by following a real-time custom control strategy. For example, a custom control strategy for force pushing, hammering a peg into a hole, or an assembly task may require controlling the robot to follow a custom control law, e.g., an impedance-controlled spiral motion with reduced stiffness. In this example, the sensor may be a torque sensor in the robot arm, but the control law is provided by the user and is not part of the pre-configured robot control software.
[0106] 5 is a flow diagram of an exemplary process 500 for executing custom real-time reactions using callback functions. The process may be implemented by one or more computer programs installed on one or more computers and programmed in accordance with the present specification. For example, the process may be performed by the real-time robot control system 150 shown in FIG. 1. For convenience, the process is described as being executed by one or more systems of computers.
[0107] As described above, the system executes a real-time robotics control framework consisting of a stack of multiple software modules that can be repeatedly executed in a predetermined sequence to control one or more robots. One such software module is an application module in the control stack that performs custom real-time control functions and generates commands, some or all of which may be non-real-time commands for one or more robots. Another such software module is a bridging module in the control stack that converts each non-real-time command into data that can be consumed by a real-time controller that is responsible for generating low-level real-time commands for controlling one or more robots to implement custom actions.
[0108] The system receives 510 a definition of a custom real-time control function. The custom real-time control function may specify a custom callback function, an action, and a custom reaction that references the custom callback function. The custom reaction may include one or more conditions for triggering the real-time robot control cycle to invoke the custom callback function.
[0109] As also described above with reference to Figure 2, the custom real-time control functions may be provided by an entity different from the entity that executes or provides the real-time robotic control framework. For example, the system may receive from a user of the system, e.g., the user code received in step 210 of Figure 2 defining a sequence of actions to be performed with deterministic timing, and custom real-time control code defining a custom callback function as well as one or more custom reactions that chain the sequence of actions. Once received, the custom real-time control code may operate at an application layer of the real-time robotic control framework.
[0110] Unlike actions defined by custom real-time control functions that must be executed with deterministic timing, custom callback functions may implement control logic or other calculations of arbitrary complexity, some of which may not preserve the real-time guarantees of the system when triggered for execution. However, due to asynchronous programming, the execution of custom callback functions in the application layer does not prevent the system from maintaining custom real-time control of the robot. This gives the system additional capabilities to support a variety of different tasks, including time-intensive tasks that would otherwise be impossible due to tight timing constraints.
[0111] The system initiates (520) the action defined by the custom real-time control function. That is, the system begins controlling the robot to perform the action. To initiate execution of the action, the system may execute a software module in the application layer to provide a start command to a non-real-time server in the control layer of the framework. For example, the action may be the first custom real-time action in a real-time state machine specified by user code provided to the system.
[0112] The system repeatedly executes a custom real-time control function at each given control tick of a real-time robot control system that drives one or more physical robots by using a control layer of the real-time robot control framework. For example, the system may repeatedly execute the custom real-time control function at each control tick of the system according to a pre-determined control schedule, e.g., following the initiation of execution of the real-time control function. Briefly, this involves obtaining (530) current values of one or more state variables, evaluating (540) a custom reaction specified by the custom real-time control function according to the current values of the one or more state variables, and invoking (550) a custom callback function whenever one or more conditions of the custom reaction are met.
[0113] As mentioned above, the control layer in turn may include a non-real-time server that, during execution, executes a non-real-time thread configured to communicate with the application layer, and a real-time control layer that, during execution, executes a real-time thread configured to drive the robot along a real-time robot control cycle by interfacing with the hardware abstraction layer.
[0114] While the system executes the actions defined by the custom real-time control function, it obtains 530 current values of one or more state variables. As discussed above with reference to FIG. 2, state variables may generally include sensor values or information derived from sensor values, or both.
[0115] The system evaluates (540) a custom reaction specified by the custom real-time control function according to the current values of the one or more state variables, and whenever one or more conditions of the custom reaction are satisfied, the system invokes (550) the custom callback function.
[0116] Alternatively, if the custom reaction is not satisfied, the system continues to execute the next control tick of the current action, i.e., process 500 returns to step 530 where the system obtains new values for one or more state variables.
[0117] To invoke the custom callback function, a real-time thread running in the real-time control layer may provide a notification to a non-real-time thread running in the non-real-time server that the custom callback function should be invoked. The non-real-time thread may then provide a notification to the application layer of the framework that the custom callback function should be invoked. In response to receiving the notification from the non-real-time thread, the application layer of the framework may execute the custom callback function within the application layer of the framework.
[0118] This is illustrated in Figure 6, which graphically depicts an example execution trace for a custom real-time reaction using callback functions. In Figure 6, horizontal lines indicate time spent in thread execution, and arrows between the lines indicate causal relationships between threads, e.g., in the form of notifications. As illustrated, application level code and custom real-time control code are processed asynchronously.
[0119] In response to determining (1) that one or more conditions of the custom reaction are satisfied, real-time thread 610 provides a notification (2) to non-real-time thread 630. Non-real-time thread 630 then provides a notification (3) to the application layer, which then begins executing custom callback function 650. Meanwhile, real-time thread 610 continues to process the custom real-time control code (4). If the custom callback function produces a computation or execution result, such result may be returned to the real-time control layer (5) whenever execution of the custom callback function is completed, i.e., after non-real-time thread 630 has been notified to invoke the custom callback function, and at any time while real-time thread 610 is still processing the custom real-time control code.
[0120] Generally, a callback function is a pointer to executable code that is passed as an argument to another function. Thus, invoking a custom callback function may involve providing one or more elements of real-time data used by the real-time thread as arguments to the custom callback function.
[0121] More specifically, in some implementations, the system may do this by writing one or more elements of the real-time data to a memory location accessible by a non-real-time thread in the control layer, reading the updated value in the memory location by using the non-real-time thread, and providing the updated value written to the memory location by the real-time thread to the application layer by using the non-real-time thread.
[0122] For example, the real-time data element may include a timestamp representing when one or more conditions of the custom reaction were satisfied in a real-time thread. As another example, the real-time data element may include an identification of a previous action that was performed before the custom reaction was satisfied. As yet another example, the real-time data element may include an identification of a current action that triggered the custom reaction.
[0123] Table 5 contains examples of user code written to define callback functions.
[0124] [Table 5]
[0125] Exemplary user code is client-side code that may be executed by a client of a real-time robotic control system in response to an event when a robotic component, e.g., a robotic arm, moves within a threshold distance of 25 cm of a target position.
[0126] In line 1, a callback function is defined. In this case, the callback function simply prints the text, e.g., "Almost there!", on the client device 190. In practice, callback functions are typically much more complex, and some of them may generate computational or execution results and return such results to the calling thread.
[0127] An action is defined in line 4. The action definition includes an ID (line 5), a type (line 6), and motion parameters (line 7).
[0128] As shown in lines 8-16, an action has a reaction that specifies a condition and a response. In this case, the condition is whether the robot component has moved within a threshold distance of 25 cm of the target position, and the response is to invoke a callback function (line 14).
[0129] In line 17, the client initiates the real-time action by sending a command referencing the action ID to the non-real-time server. The control layer of the system then initializes the real-time environment and executes the action accordingly, including invoking a callback function whenever a condition is met.
[0130] 7 is a flow diagram of an example process 700 for executing custom actions using streaming input. The process may be implemented by one or more computer programs installed on one or more computers and programmed according to the present specification. For example, the process may be performed by the real-time robotic control system 150 shown in FIG. 1. For convenience, the process is described as being executed by one or more computer systems.
[0131] As described above, the system executes a real-time robotics control framework consisting of a stack of multiple software modules that can be repeatedly executed in a predetermined sequence to control one or more robots. One such software module is an application module in the control stack that performs custom real-time control functions and generates commands, some or all of which may be non-real-time commands for one or more robots. Another such software module is a bridging module in the control stack that converts each non-real-time command into data that can be consumed by a real-time controller that is responsible for generating low-level real-time commands for controlling one or more robots to implement custom actions.
[0132] The system receives (710) a definition of a custom real-time streaming control function. The custom real-time streaming control function may define a custom action ("custom streaming action") that uses streaming input. Streaming input is real-time input that may arrive at a varying rate or non-deterministically, e.g., with incomplete information, or both. The custom streaming action may specify a goal state of the robot within the operating environment. For example, the goal state may be defined in terms of the robot's position, velocity, acceleration, joint angles, or a combination thereof.
[0133] The custom real-time streaming control function may include functions that define custom processing of gaps between streaming inputs, e.g., between receipt of a current goal state and any updated goal states from the application layer. For example, the custom real-time streaming control function may include a user-defined interpolation or extrapolation function for calculating the goal state of the robot. As another example, the custom real-time streaming control function may make a function call to a user-selected function, i.e., a function selected from a library of predefined interpolation or extrapolation functions, to calculate the goal state of the robot.
[0134] As also described above with reference to Fig. 2, the custom real-time streaming control function may be provided by an entity different from the entity that executes or provides the real-time robot control framework. For example, the system may receive from a user of the system custom real-time streaming control code that defines the custom real-time control function in addition to the user code received in step 210 of Fig. 2, e.g., that defines a sequence of actions to be executed with deterministic timing, and one or more custom reactions that chain the sequence of actions. Once received, the custom real-time streaming control code may execute in an application layer of the real-time robot control framework.
[0135] The system starts the custom streaming action defined by the custom real-time streaming control function (720). That is, the system starts to control the robot to execute the custom streaming action. To start the execution of the custom streaming action, the system may execute a software module in the application layer to provide a start command to a non-real-time server in the control layer of the framework. For example, the custom streaming action may be a custom real-time action in a user-specified real-time state machine that uses one or more streaming inputs.
[0136] The system repeatedly provides updated goal states for the custom streaming actions to the control layer of the real-time robot control framework (730). The system may do this by executing custom real-time streaming control functions in the application layer of the framework.
[0137] In response to receiving the updated goal state, the control layer is configured to execute the custom streaming action, including driving the robot toward the latest goal state, at each given tick of a real-time robot control cycle. For example, the control layer may execute the custom streaming action repeatedly at each control tick of the system, e.g., following initiation of execution of the custom streaming action, according to a predetermined control schedule.
[0138] In various cases, the first rate at which the application layer provides updated target states to the control layer is different than the second rate of the real-time robot control cycle, for example, the first rate is a user-defined period specified in a custom real-time streaming control function and is lower, possibly much lower, than the second rate of the real-time robot control cycle.
[0139] In these cases, to achieve the real-time guarantees of the system, the control layer is further configured to drive the robot towards the latest goal state for one or more additional ticks of the real-time robot control cycle before receiving any additional updated goal states from the application layer.
[0140] To do so, a non-real-time server of the control layer running as a non-real-time thread may receive an updated target state from the application layer and select a current or future tick of the real-time robotics control cycle in which to provide the updated target state to a real-time control layer of the control layer running as a real-time thread, thereby allowing the real-time control layer to mitigate the effects of any jitter from the streaming input.
[0141] This is illustrated in FIG. 8, which graphically depicts an example execution trace for a custom real-time reaction using streaming input. FIG. 8 depicts a total of five real-time robot control cycles, beginning with "Cycle 0." The upward arrows between the horizontal line segments depict the control inputs, e.g., the robot's goal state, being transmitted between the two threads. As illustrated, the control inputs are streaming inputs because the application layer does not provide the robot's goal state to the control layer (including the real-time control layer and the non-real-time control server) for every tick of the real-time robot control cycle. For example, in ticks "Cycle 2," "Cycle 3," and "Cycle 5," no goal state reaches the non-real-time thread 830.
[0142] At each tick of a control cycle, e.g., at "cycle 0," control input including an updated goal state of the robot provided by the application layer (1) is received at non-real-time thread 830, which provides an updated goal state of the robot (2) to real-time thread 810 so that the control layer drives the robot toward the updated goal state.
[0143] In each tick of the control cycle where control inputs including any updated goal state of the robot provided by the application layer are not received in the non-real-time thread 830 (3), e.g., in "cycle 2," the non-real-time thread 830 running in the non-real-time control server may select a current or future tick of the control cycle for providing the interpolated goal state received from the application layer to the real-time thread. In particular, the interpolated goal state may be provided to the real-time hardware abstraction layer by either the non-real-time thread 830 or the real-time thread 810. For example, in "cycle 2," the non-real-time thread 830 provides the interpolated goal state (4) to the real-time hardware abstraction layer via the real-time control layer as the updated goal state of the robot so that the system drives the robot toward the latest goal state. As another example, in "cycle 5," the real-time thread 810 provides the interpolated goal state (5) to the real-time hardware abstraction layer as the updated goal state of the robot.
[0144] As mentioned above, the manner in which the interpolated goal state is generated may be a user-selectable option. For example, the non-real-time thread 830 (or real-time thread 810) may repeatedly use the most recent goal state received from the application layer as the interpolated goal state, i.e., until it receives any additional goal states from the application layer (or from the non-real-time thread 830). As another example, the non-real-time thread 830 (or real-time thread 810) may calculate the interpolated goal state by performing some custom interpolation or extrapolation function based on one or more most recent goal states received from the application layer (or from the non-real-time thread 830).
[0145] Table 6 contains an example of user code written to define a custom real-time streaming control function. This example uses a custom interpolation function to calculate the interpolated goal states of a 6-DOF robot. The goal states include target positions and target velocities for each of the robot's six joints.
[0146] [Table 6]
[0147] Lines 5 to 12 indicate that the motion parameters are streaming parameters.
[0148] In line 13, a streaming action is defined. The streaming action definition includes an ID (line 14), a type (line 15), and streaming motion parameters (line 16). Line 17 indicates that there is no reaction associated with this streaming action.
[0149] In line 19, a connection is initiated to the server to prepare it for streaming.
[0150] At line 24, the client initiates the streaming action by sending a command to the non-real-time server referencing the action ID. The control layer of the system then initializes the real-time environment and executes the streaming action accordingly.
[0151] Lines 27-38 show how to use an example 1-D interpolation function to find new target position values for the robot's joints.
[0152] Line 32: A loop is defined to repeatedly input the next value using the "stream.write" function.
[0153] The robotic functions described herein may be implemented by a hardware-independent software stack that is at least partially hardware-independent, or simply a software stack for brevity. In other words, the software stack can accept as input the commands generated by the planning process described above, without requiring that the commands specifically relate to a particular model of robot or a particular robot component. For example, the software stack may be implemented at least in part by the real-time robotic control system 150 of FIG. 1.
[0154] Embodiments of the subject matter and functional operations described herein can be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware, or a combination of one or more of them, including the structures disclosed herein and their structural equivalents. Embodiments of the subject matter described herein can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible, non-transitory storage medium for execution by or to control the operation of a data processing apparatus. The computer storage medium can be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them. Alternatively or additionally, the program instructions can be encoded on an artificially generated propagated signal, e.g., a machine-generated electrical, optical, or electromagnetic signal, which is generated to encode information for transmission to a suitable receiver device for execution by the data processing apparatus.
[0155] The term "data processing apparatus" refers to data processing hardware and encompasses any kind of apparatus, device, and machine for processing data, including, by way of example, a programmable processor, a computer, or multiple processors or computers. An apparatus may also be or further include special purpose logic circuitry, such as a field programmable gate array (FPGA) or an application-specific integrated circuit (ASIC). An apparatus may optionally include, in addition to hardware, code that creates an operating environment for a computer program, such as code that constitutes a processor firmware, a protocol stack, a database management system, an operating system, or one or more combinations thereof.
[0156] A computer program (which may be referred to or described as a program, software, software application, app, module, software module, script, or code) can be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A program can, but need not, correspond to a file in a file system. A program can be stored in one or more scripts stored in a portion of a file that holds other programs or data, for example, in a markup language document, in a single file dedicated to the program in question, or in multiple cooperating files, for example, files that store one or more modules, subprograms, or portions of code. A computer program can be deployed to be executed on one computer, or on multiple computers located at one site or distributed across multiple sites and interconnected by a data communications network.
[0157] When one or more computer systems are configured to perform particular operations or actions, it means that the systems have installed software, firmware, hardware, or a combination thereof that, when in operation, causes the systems to perform the operations or actions. When one or more computer programs are configured to perform particular operations or actions, it means that one or more programs contain instructions that, when executed by a data processing device, cause the device to perform the operations or actions.
[0158] As used herein, an "engine" or "software engine" refers to a software-implemented input / output system that provides an output distinct from an input. An engine may be an encoded functional block, such as a library, a platform, a software development kit ("SDK"), or an object. Each engine may be implemented on any suitable type of computing device, such as a server, a mobile phone, a tablet computer, a notebook computer, a music player, an e-reader, a laptop or desktop computer, a PDA, a smartphone, or other fixed or portable device, that includes one or more processors and a computer-readable medium. In addition, two or more of the engines may be implemented on the same computing device or on different computing devices.
[0159] The processes and logic flows described herein may be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows may also be implemented by special purpose logic circuitry, such as an FPGA or an ASIC, or by a combination of special purpose logic circuitry and one or more programmed computers.
[0160] A computer suitable for executing a computer program can be based on a general-purpose or dedicated microprocessor, or both, or any other type of central processing unit. Generally, the central processing unit receives instructions and data from a read-only memory, or a random access memory, or both. The essential elements of a computer are a central processing unit for implementing or executing instructions, and one or more memory devices for storing instructions and data. The central processing unit and memory may be supplemented by, or incorporated in, special purpose logic circuitry. Generally, a computer also includes one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or is operatively coupled to receive data from, transfer data to, or both. However, a computer need not have such devices. Furthermore, a computer can be incorporated in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device, such as a universal serial bus (USB) flash drive, to name just a few.
[0161] Computer-readable media suitable for storing computer program instructions and data include, by way of example, all forms of non-volatile memory including semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices, magnetic disks, e.g., internal hard disks or removable disks, and magneto-optical disks, as well as CD-ROM and DVD-ROM disks.
[0162] To provide for interaction with a user, embodiments of the subject matter described herein may be implemented on a computer having a display device, e.g., a cathode ray tube (CRT) or liquid crystal display (LCD) monitor for displaying information to a user, a keyboard, and a pointing device, e.g., a mouse, trackball, or a presence-sensitive display or other surface by which a user can provide input to the computer. Other types of devices may be used to provide for interaction with a user as well, e.g., feedback provided to the user may be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback, and input from the user may be received in any form, including acoustic, speech, or tactile input. In addition, a computer may interact with a user by sending documents to and receiving documents from a device used by the user, e.g., sending a web page to a web browser on the user's device in response to a request received from the web browser. A computer may also interact with a user by sending text messages or other types of messages to a personal device, e.g., a smartphone, executing a messaging application, and receiving a response message from the user in return.
[0163] An embodiment of the subject matter described herein can be implemented in a computing system that includes a back-end component, e.g., a data server, or includes a middleware component, e.g., an application server, or includes a front-end component, e.g., a client computer having a graphical user interface, a web browser, or an app through which a user can interact with an implementation of the subject matter described herein, or includes any combination of one or more such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include local area networks (LANs) and wide area networks (WANs), e.g., the Internet.
[0164] A computing system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. In some embodiments, a server sends data, e.g., HTML pages, to a user device for the purpose of, e.g., displaying data to and receiving user input from a user interacting with the device acting as a client. Data generated at the user device, e.g., a result of user interaction, may be received at the server from the device.
[0165] In addition to the embodiments described above, the following embodiments are also innovative.
[0166] Embodiment 1 is a method comprising: receiving, by a real-time robot control framework, a definition of a custom real-time control function, the definition specifying a plurality of actions and one or more custom reactions, each of the custom reactions including one or more conditions for real-time switching from execution of one action to execution of another action in the plurality of actions; repeatedly executing a custom real-time control function at each given tick of a real-time robotic system that drives one or more physical robots, said custom real-time control function being executed by a real-time robotic control framework; Obtaining a current value of one or more state variables; evaluating one or more custom responses specified by the custom real-time control function according to current values of the one or more state variables; updating the current action in real time according to the satisfied custom reaction each time the custom reaction is satisfied; and executing the next tick of the current action.
[0167] Embodiment 2 is a method as described in embodiment 1, in which executing the custom real-time control function includes acquiring one or more sensor values generated by one or more sensors in an operating environment of the one or more robots.
[0168] In a third embodiment, executing a custom real-time control function includes: determining that the response is satisfied by one or more sensor values generated from a sensor in the operating environment; 3. The method of any one of embodiments 1 or 2, comprising: in response to determining, performing a real-time switching between the first real-time action and the second real-time action.
[0169] Embodiment 4 is the method of embodiment 2, in which each time a custom reaction is satisfied, a new sensor value is obtained for use by the updated current action.
[0170] Example 5 is the method of example 2, wherein the one or more custom responses use sensor input in real time.
[0171] A sixth embodiment is a method according to any one of the first to fifth embodiments, wherein the definition of the custom real-time control function specifies a real-time state machine of actions related by a custom reaction.
[0172] Embodiment 7 is the method according to any one of embodiments 1 to 6, wherein the custom real-time control function is provided by an entity different from the entity that executes or provides the real-time robot control framework.
[0173] Embodiment 8 is a method according to any one of embodiments 1 to 7, wherein evaluating one or more custom reactions specified by the custom real-time control function includes evaluating only the custom reactions associated with the current action.
[0174] A ninth embodiment is a method according to any one of the first to eighth embodiments, wherein the custom real-time control function specifies a sequence of actions to be executed with deterministic timing.
[0175] An embodiment 10 is a method according to any one of embodiments 1 to 9, wherein executing the next tick of the current action includes converting a non-real-time control parameter into a real-time control parameter.
[0176] Embodiment 11 is a method according to any one of embodiments 1 to 10, wherein the real-time robot control framework includes an application layer in communication with the control layer, and receiving a definition of the custom real-time control function includes receiving the definition at the application layer and further includes sending the definition to the control layer for execution.
[0177] Embodiment 12 is receiving, by the control layer, a new definition of a custom real-time control function; 12. The method of embodiment 11, further comprising: switching execution to the first action defined by the new definition.
[0178] Embodiment 13 is receiving, by a real-time robot control framework, custom real-time control code that is executed by a real-time thread of a control layer to drive a position at each given tick of a real-time control cycle; Custom real-time control code is A custom state get function to get the current value of one or more state variables; a custom control function that uses the obtained values of one or more state variables to calculate motion parameters in real time; repeatedly executing custom real-time control code at each predetermined tick of a real-time robot control cycle by a real-time robot control framework; Executing a custom state retrieval function to retrieve the current value of one or more state variables; Executing a custom control function to calculate one or more updated motion parameters; and driving the real-time robotic system according to the updated motion parameters calculated by executing the custom control function.
[0179] Example 14 is the method of example 13, wherein executing the custom control function includes using updated sensor values in a current tick of the real-time robot control cycle.
[0180] Embodiment 15 is a method according to any one of embodiments 13 to 14, wherein the real-time robot control framework is configured to automatically execute a user-provided software module as a state machine at each tick in a control cycle to implement custom real-time robot control.
[0181] Embodiment 16 is a method according to any one of embodiments 13 to 15, wherein the real-time robot control framework is configured to automatically execute user-provided non-real-time software modules to prepare a real-time environment for real-time robot control.
[0182] In an embodiment 17, the custom real-time control code further includes a custom sensing function for acquiring real-time sensor data; Running custom real-time control code executing a custom sensing function to obtain an updated sensor value; 17. The method according to any one of embodiments 13 to 16, wherein executing the custom control function includes using the obtained updated sensor value.
[0183] Embodiment 18 is a method comprising: receiving, by a real-time robot control framework, custom non-real-time control code that defines a custom parameter preparation function; 18. The method according to any one of embodiments 13 to 17, further comprising: executing the custom non-real-time control code before executing the custom real-time control code.
[0184] Embodiment 19 is the method of embodiment 17, wherein the real-time robot control framework executes non-real-time control code in a non-real-time thread of the real-time robot control cycle and executes custom real-time control code in a real-time thread.
[0185] Embodiment 20 is a system comprising one or more computers and one or more storage devices that store instructions, which, when executed by the one or more computers, are operable to cause the one or more computers to perform a method described in any one of embodiments 1 to 19.
[0186] Embodiment 21 is a computer storage medium encoded with a computer program, the program including instructions operable, when executed by a data processing device, to cause the data processing device to perform any one of the methods of embodiments 1 to 19.
[0187] Although this specification contains many specific implementation details, these should not be construed as limitations on the scope of any invention or what may be claimed, but rather as descriptions of features that may be specific to certain embodiments of a particular invention. Certain features described herein in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Furthermore, although features may be described above as operating in a combination and initially claimed as such, one or more features from a claimed combination may in some cases be deleted from the combination, and the claimed combination may be directed to a subcombination or a variation of the subcombination.
[0188] Similarly, although operations are depicted in the figures in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown, or in a sequential order, or that all illustrated operations be performed, to achieve desired results. In certain circumstances, multitasking and parallel processing may be advantageous. Furthermore, it should be understood that the separation of various system modules and components in the embodiments described above does not require such separation in all embodiments, and that the program components and systems described may generally be integrated together in a single software product or packaged in multiple software products.
[0189] Particular embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. As an example, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some cases, multitasking and parallel processing may be advantageous.
Claims
1. 1. A computer-implemented method comprising: receiving, by a real-time robot control framework, a definition of a custom real-time control function, the definition specifying a plurality of actions and one or more custom reactions, each of the custom reactions including one or more conditions for a real-time switch from execution of one action to execution of another action in the plurality of actions; repeatedly executing the custom real-time control function at each given tick of a real-time robotic system that drives one or more physical robots, said real-time robotic control framework comprising: Obtaining a current value of one or more state variables; evaluating the one or more custom responses specified by the custom real-time control function according to the current values of the one or more state variables; updating a current action in real time according to the fulfilled custom reaction each time the custom reaction is fulfilled; and executing the custom real-time control function repeatedly, including executing a next tick of the current action.
2. The method of claim 1 , wherein executing the custom real-time control function includes obtaining one or more sensor values generated by one or more sensors in an operating environment of the one or more robots.
3. Executing the custom real-time control function includes: determining that a response is satisfied by one or more sensor values generated from a sensor in the operating environment; 2. The method of claim 1, further comprising: in response to said determining, performing a real-time switching between a first real-time action and a second real-time action.
4. The method of claim 2 , further comprising obtaining a new sensor value for use by the updated current action each time the custom reaction is satisfied.
5. The method of claim 2 , wherein the one or more custom responses use sensor input in real time.
6. The method of claim 1 , wherein the definition of the custom real-time control function specifies a real-time state machine of actions related by custom reactions.
7. The method of claim 1 , wherein the custom real-time control functions are provided by an entity different from an entity that executes or provides the real-time robotic control framework.
8. The method of claim 1 , wherein evaluating the one or more custom reactions specified by the custom real-time control function comprises evaluating only custom reactions associated with a current action.
9. The method of claim 1 , wherein the custom real-time control function specifies a sequence of actions to be performed with deterministic timing.
10. The method of claim 1 , wherein executing the next tick of the current action includes converting a non-real-time control parameter into a real-time control parameter.
11. 2. The method of claim 1 , wherein the real-time robotic control framework includes an application layer in communication with a control layer, and receiving the definition of a custom real-time control function includes receiving the definition at the application layer and further includes sending the definition to the control layer for execution.
12. receiving, by said control layer, a new definition of a custom real-time control function; The method of claim 11 , further comprising: switching execution to a first action defined by the new definition.
13. A system comprising one or more computers and one or more storage devices storing instructions, the instructions, when executed by the one or more computers, causing the one or more computers to perform a method according to any one of claims 1 to 12.
14. One or more non-transitory computer readable storage media storing instructions that, when executed by one or more computers, cause the one or more computers to perform the method of any one of claims 1 to 12.
15. 1. A computer-implemented method comprising: receiving, by a real-time robot control framework, custom real-time control code that is executed by a real-time thread of a control layer to drive a position at each given tick of a real-time control cycle; The custom real-time control code includes: a custom state get function for getting the current value of one or more state variables; a custom control function that uses the obtained values of the one or more state variables to calculate a motion parameter in real time; repeatedly executing the custom real-time control code at each predetermined tick of a real-time robot control cycle by the real-time robot control framework; executing the custom get state function to obtain the current values of the one or more state variables; executing the custom control function to calculate one or more updated motion parameters; and driving the real-time robotic system according to the updated motion parameters calculated by executing the custom control function.
16. The method of claim 15 , wherein executing the custom control function includes using updated sensor values in a current tick of the real-time robot control cycle.
17. The method of any one of claims 15 to 16, wherein the real-time robotic control framework is configured to automatically execute user-provided software modules as state machines at each tick in the control cycle to implement custom real-time robotic control.
18. 16. The method of claim 15, wherein the real-time robotic control framework is configured to automatically execute user-provided non-real-time software modules to prepare the real-time environment for real-time robotic control.
19. the custom real-time control code further includes a custom sensing function for acquiring real-time sensor data; executing the custom real-time control code executing the custom sensing function to obtain an updated sensor value; The method of claim 15 , wherein executing the custom control function includes using the obtained updated sensor values.
20. receiving, by the real-time robot control framework, custom non-real-time control code defining a custom parameter preparation function; 16. The method of claim 15, further comprising executing the custom non-real-time control code before executing the custom real-time control code.
21. 20. The method of claim 19, wherein the real-time robot control framework executes the non-real-time control code in a non-real-time thread of the real-time robot control cycle and executes the custom real-time control code in a real-time thread.
22. A system comprising one or more computers and one or more storage devices storing instructions, the instructions, when executed by the one or more computers, causing the one or more computers to perform a method according to any one of claims 15 to 21.
23. One or more non-transitory computer-readable storage media storing instructions that, when executed by one or more computers, cause the one or more computers to perform the method of any one of claims 15 to 21.
Citation Information
Patent Citations
Real time system
JP1992365138A
System and method for controlling robot
JP2002187082A
Interactive robot control system and method of use
JP2011067943A
Real-time device control system with hierarchical architecture and real-time robot control system using the same
JP2018527680A
Robot control system and robot control method
US20030114959A1