## 4 Event-Based Programming Model With Geometric Spatial Semantics
### Semantic
#### 4.3.2 **ea** Execution Semantic in GeFB
The _object_, e.g., box and cylinder, which contains the parameters needed for the operation, like setting _pre-and post-grasp_ (line 5-10). _Target_ contains the pose information, which informs the robot where and what pose to fetch (line 1-4). The _Place_ is similar to _Fetch_ except that _Place_ use _move_group.place_ function at line-15. The _Check_ action performs motion planning to determine whether the target position is reachable, as shown in Algorithm 6. If reachable, it will return a true value. The motion planning process does not control the actual motion of the robot. ```
1://Setting grasp pose;
2:\(grasp\_pose\_header.frame\_id\leftarrow\) \"\(panda\_link0\)\";
3:\(pose\_orientation\gets target\_orientation\);
4:\(pose\_position\gets target\_position\);
5://Setting pre-grasp approach;
6:\(pre\_grasp\_approach.direction\_header.frame\_id\leftarrow\) \"\(panda\_link0\)\";
7:\(pre\_grasp\_approach.params\leftarrow\) object.preParams;
8://Setting post-grasp retreat;
9:post\_grasp_retret.direction\_header.frame\_id\leftarrow\) \"\(panda\_link0\)\";
10:\(post\_grasp\_retret.params\gets\) object.postParams;
11:\(open\_Gripper(grasps.pre\_grasp\_posture)\);
12:\(closed\_Gripper(grasps.grasp\_posture)\);
13://Do fetch
14:\(move\_group.setSupportSurfaceName()\);
15:\(move\_group.pick(object.name,grasps)\);
```

**Algorithm 5**\(Fetch(move\_group,object,target)\)

(b) GeFB Design

The implementation of GeFB contains four modules:

* _Ge_ event parse module that is used for getting _Exp_, \(\Delta M\), and _obj_ from the _Ge_, which is equivalent to the semantics of Definition 9. Figure 3: Scenarios of robot assembly line. * Task selection module that is used for selecting task by making a decision based on _obj_ and task list, and updating the state of task list. * Task list module that stores the assembly sequences of product. * Actions module that contains different action primitives corresponding to different tasks, e.g., action _Check_ with parameters _Exp_, \(\Delta M\), and _obj_, which regarded as the guard function, g, in Definition 8. The instance of the prototype of GeFB is _Robot1_ as shown in Figure 3(a), which has two _Ge_ events: _PARTNERACTIONEXE_ and _OWNACTIONEXE_. The ecc of _robot1_ encapsulate geometric information processing and the control logics as shown in Figure 3(b). The event parse module and task selection are implemented in _normalExecution_ state of _ecc_. Whenever an external event, _PARTNERACTIONEXE_, triggers FB with time and spatial parameters--_partnerExpParam_, _partnerDeltaMParam_, _partnerObj_, and _partnerTime_--the _ecc_ will turn into the _normalExecution_ state for task selection and constraint checking. If a true feedback of constraint checking, the feedback event, \(GUARDCHECK\_RESPONSE\), will trigger action _Fetch_ with parameters of current task. The action _Place_ is triggered after finishing _Fetch_ and the _OWNACTIONEXE_ event will be generated with current behavioral constraint parameters--_ownObj_, _ownExpParam_, _ownDeltaMParam_, and _ownExeTime_--to trigger the downstream FB. Note that the downstream FB can be itself. The GeFB related parameters are instantiated as follows; _ownObj/partnerObj_ are instantiated with geometric centers of the manipulated object, _ownExpParam_/_partnerExpParam_ are instantiated with the geometric dimensioning and pose of object, _ownDeltaMParam/partnerDeltaMParam_ are instantiated with the value of rotation and translation of an object before and after it is manipulated, and _ownExeTime/partnerTime_ are instantiated with the time that executing one action needs. The application for robot assembly line can be easily developed by system designer through dragging the GeFB, as shown in Figure 5. The Sub and Pubs are ROS nodes for getting feedback and invoking hardware actions, respectively. The red connection (as shown in Figure 4(a) and the connection between _PARTNERACTIONEXE_ and _OWNACTIONEXE_ in Figure 4(b) represent _Ge_ event that transfers the geometric information to itself. Figure 4: The GeFB and _ecc_ for robot.