2.1. Structure of the HiSMoT Controller
The controller proposed in the HiSMoT-project is shown in
Figure 1. It comprises two main components: the Trajectory-based Latent Space (LS) controller, which generates the reference motion for the robot and has been presented in separate work [
4], and the low-level motion planning of the robot, which is presented in this article. The LS-Controller generates human motion that serves as a reference for the dynamic motion planner. It is based on a data-driven model for synthesizing natural human motions proposed by Min et al. [
32]. This model was later extended by Manns et al. [
33,
34], enabling the identification of clusters of natural motions in assembly contexts by mapping human motion data into a low-dimensional latent space (LS), where each point represents an entire body motion. By learning the distribution of these points the model can generate new motions that fit within the learned natural variation. This model was further specified by Saeed et al. [
4] to generate human movements for handling a rigid body object during assembly tasks. In the scope of this paper, a movement where a human and a cobot collaboratively move a rod from location A to location B is investigated. The human motion generator model is not in the scope of this research article. It is assumed that the human and the robot have already grasped their respective sides of the rod. The movement to reach the rod is disregarded. It is assumed that the LS-Controller knows the current location where the human grasps the rod in location A and a desired goal location B. The LS-Controller now generates a set of natural movements for all joints of the human skeleton model. From that, the most probable motion is extracted [
4].
To properly control the robot, only the movement of the hand, which is coupled to the rod, is extracted. Because the rod is a rigid body with a known length, and the human hand is assumed to be fixed to the rod, the trajectory of the TCP of the robot can be derived from that. Hereafter, this is referred to as the reference trajectory . Due to the individual character of each human movement, it is clear that the human motion will differ from the guessed reference trajectory at some point. As long as the movement continues, the more likely deviations from the proposed trajectory will occur. So the LS-Controller needs feedback from the human hand to update the guessed trajectory in real-time. From the known robot TCP position , the position of the human hand can be inferred. During motion, the LS-Controller continuously updates the probabilities of possible human movements and determines the most likely trajectory. Based on the observed motion history from location A to the current point, it then generates a human trajectory toward the desired goal. Once the new reference trajectory is generated, is changed. The new reference is then the input for the motion planner.
Since the LS-Controller updates the reference trajectory online, the robot needs a planning strategy capable of adapting to these real-time changes. The primary focus of this paper is the motion planning of the robot, aiming to track a reference trajectory that could be obtained from a human motion model. In the scope of this work, it is assumed that the output of such a motion model always represents physically possible motion, as it is intended to reflect natural human movement. Since the reference trajectory changes in real-time, the robot must support real-time control. Therefore the output of the motion planner are joint commands that are directly executed by the robot.
There are several reasons why a robot may not be able to track a Cartesian trajectory with a simple motion planner that only transforms Cartesian positions into joint state commands via IK. The first reason is that the reference can lead the robot into a singularity. If the robot gets too close to a singularity, the IK cannot find a solution for the joint states, or leads the robot into very fast joint movements. Therefore, singularities need to be avoided by the movement of the robot. The second reason is the violation of joint and acceleration limits in the joint space. Even slow movements in CS can lead to fast movements of the single joints of the robot. So the velocity of every joint of the robot is constrained. When constraining velocity and acceleration, a deviation from the reference trajectory will occur. Those two reasons are the leading causes for the robot not being able to track a given Cartesian reference trajectory. In those cases, the robot should assume a dominant role and try to move on a trajectory that minimizes the error between the reference motion and the robot motion.
2.2. Path Following
The proposed motion planner is presented in the following. The formulation begins with the task of tracking a Cartesian path that may change dynamically and is subsequently extended to trajectory tracking with singularity avoidance and compliance with joint velocity limits. To this end, a set of simplifying assumptions is introduced first and then gradually relaxed in later sections, thereby increasing the complexity of the motion planner:
- 1.
The path lies within the workspace of the robot and every point is reachable
- 2.
The path does not change
- 3.
The TCP velocity is assumed as constant
- 4.
There are no singularities on the path that the robot has to avoid
- 5.
There are no constraints on velocity and acceleration for the joints of the robot
The path is generated by the LS-Controller depicted in
Figure 1, which gives a sequence of points
that represent a natural human motion, where
is the start location and
is the destination. The points contain Cartesian coordinates where the orientation of the gripper is first assumed as fixed. A discrete series with varying distances between neighboring points is not suitable for directly controlling the robot. Therefore, the path
P is approximated with a cubic-spline. To apply the spline approximation, the given points are parameterized over the Cartesian distance between neighboring points
Those parameters are then normalized in the interval
with
Now
indicates the relative position and the relative arc length on the parameterized curve that connects the points of
P with a linear approximation. When approximating the movement of the human this is not sufficient because the linear approximation is not smooth enough. To ensure a smooth transition between the waypoints,
steadiness is applied, which means that the first and second derivative are continuous at the transition points and so the velocity and acceleration are steady in those points too.
Because the sequence of points P is assumed to represent realistic motion and the waypoints are sampled at an approximately uniform frequency of around 60 Hz, no significant changes in velocity or acceleration are expected between neighboring waypoints. Furthermore, because the original trajectory is unlikely to be highly curved due to the naturalness of human motion and because the distance between neighboring waypoints is small, the error between the linear approximation and a spline-based representation remains small. The difference between arc length and chord length is of second-order with respect to the waypoint spacing and is therefore negligible for the considered sampling rate.
To modulate such a function cubic splines
with
are used. With linear algebra and the Thomas-Algorithm [
35] the coefficients of the cubic spline are
where the coefficients
are calculated recursively. The coefficients in
are
with
and the initial values of
and
. With these coefficients, the cubic splines Equation (
4) can be calculated from the support points of the path Equation (
1) and the parameterization of the curve Equation (
3). The spline is now used as the reference path, which the robot’s TCP has to track.
To control a real or simulated robot using position control, discrete commands are required. Within the scope of this work, the 7-DoF KUKA LBR iiwa is used. The KUKA Fast Robot Interface (FRI) package [
36] enables direct position control of the real robot in hard real time at a frequency of 200 Hz. The proposed motion planner operates in soft real time with a control frequency
f of 20 Hz. Therefore,
Section 2.7 introduces a buffering structure that transmits commands to the robot at the required control frequency of 200 Hz.
Now the goal is to derive the next position command
. With known constant control frequency
f of the robot and constant Cartesian TCP velocity
, the distance between the current position and next commanded position follows as
Because
and the distance
are known
can be calculated with Equation (
4). Therefore it is assumed that for small deviations in
t the curve
is linear. The arc length between two values of
t can be calculated with
where the integral is approximated using a numerical Riemann sum, which sums straight-line distances between sampled positions on the curve
. To find a
that satisfies this equation from above
is chosen very small and
N is increased stepwise. It is obtained with
With knowledge of the spline Equation (
4) the next Cartesian joint command can be obtained with
With the assumptions made in the beginning of this section, the robot can track a given path with constant velocity. Those equations are summarized by the Next Point Generator (NPG) as depicted in
Figure 2. The inputs of the NPG are the current position of the robots TCP
, the control frequency of the robot
f, the desired constant TCP-velocity
and the given support points
P. From that, first the spline
is calculated with Equation (
4) and after that
with Equation (
7).
A key characteristic of human movement is its high variability. When a robot works with a human, it can not be assumed that the human stays on an initially predicted path. So, the robot needs to be able to track a changing path. Therefore, Assumption 2 is modified such that the reference path is no longer considered fixed but can instead change dynamically during the robot’s motion. If the reference path is changing, two things are essential. On the one hand, the robot needs to be able to accept movement commands in real-time, which is guaranteed by the above mentioned position control. On the other hand the robot needs to move smoothly to the new path.
Therefore, the reference
is discretized with Equation (
6) and
so that a sequence
of equidistant points
on
is obtained. One exception is the distance between
and the last point of the entire movement
, which could be less than
l because the length of the approximated curve is, with high probability, not a multiple of
l. To reach the next target
, the NPG is modified. The last target position
is saved in a buffer. From there, the TCP should move in a straight line to
. The NPG is modified so that
where the fraction on the right hand side is the normalized direction from
to
. Now, when the reference spline
changes to
the sequence of equidistant points
W changes to
accordingly. This has also consequences for
, a transition to the new path
becomes necessary. The sketch in
Figure 3 illustrates a reference spline
, which is updated at the next time stamp to
. The black crosses mark the sequences of support points
P and
, which do not need to be equally spaced. In contrast, the red crosses indicate the sequences of equidistantly spaced points
W and
along the reference spline.
Because the new path
has not necessarily the same length as
W a metric is derived to avoid that the NPG gives points that are not in the direction of the target point and steer the TCP closer to the start. Imagine a scenario where the arc length of
is longer than that of
W. The target of the NPG is
. Now the question arises: which point in
one has to choose in order to avoid a movement backwards in the direction of the starting point. The first guess would be the target point
corresponding to
. When the arc length of
is longer than the arc
most likely lies not in the direction of the end point. To measure this, the cosine similarity
is used, with
where
is called the candidate vector with an initial
and
the vector that points in the direction of the target of the entire movement. Now
is evaluated, if it is greater than zero it means that
lies roughly in the same direction from
as
. This means that the target is viable and could be approached. If
is equal to or less than zero, it means that
does not lie in the direction of
. In that case,
k is increased and
is re-evaluated. This is repeated until
has a positive value. Then
is used as the next target of the NPG. If it happens that
is shorter than
W it is possible that for
no corresponding
exist. In such a case, the NPG chooses
as next target. So the next position command sent to the robot is
In summary, this method ensures that the NPG does not set a target that lies not in the direction of the end position of the movement. So no backwards movement is possible. This method is used for paths
that could be longer or shorter than
W. Summarized the changes made to the NPG in
Figure 2 are that the spline is now discretized and those discrete points are used as intermediate goals. The next position command
is calculated based on a straight line from the current position to the next intermediate goal on the reference. It is also checked whether the path has changed, and the next intermediate goal is found based on the method explained above, which finds the next position command roughly in the direction of the target position of the entire movement. The TCP of the robot is now able to track a dynamically changing path under the assumptions named above.
2.3. Trajectory Tracking
Human movement is inherently variable, and it is highly unlikely that a person maintains a constant velocity during motion. Instead, velocity continuously fluctuates over the course of the movement. In the context of HRC, the robot must be capable of tracking a trajectory while dynamically adjusting the velocity of its TCP. Accordingly, the third assumption from
Section 2.2 has been revised to account for a time-varying TCP velocity.
Therefore, the given set of points (see Equation (
1)) is modified to a set of tuples
which defines the position of the TCP and the velocity at the specified position. This implies that a trajectory, rather than only a path, is now specified. The path itself is still approximated using Equations (
2)–(
4). The resulting spline
is then roughly parameterized by its arc length. After that, due to the small distances between the known points and the naturalness of the approximated curve, no sudden changes in velocity are expected. Therefore, the velocity along this path is approximated linearly using
with
So the trajectory is defined by
where the path and velocity are interpolated separately. Since the sequence in Equation (
10) changes rapidly, interpolation methods such as Hermite splines [
37], which compute the velocity as the derivative of the spline, are too computationally demanding to be executed at the robot’s control frequency. For the approximation, it is assumed that the path between two consecutive points is approximately linear and that the velocity changes linearly between those points, either increasing or decreasing. Now the trajectory is discretized into control points regarding its arc length
where the points
are discretized in the same way as in
Section 2.2, and the velocity
is obtained by evaluating
. To determine the corresponding step size
for the next Cartesian joint command, the constant velocity
in Equation (
5) is replaced with
and must be evaluated in every sample. Since the current position
, the previous control point
and the next control point
are known the velocity for the next position command can be calculated with
which performs a linear approximation between the given control points. The last term was added to guarantee a minimum velocity
at the start and before the stop of the movement. This ensures that the robot motion is properly initiated and that the final waypoint can be reached. The exponential decay form enables a smooth transition between the minimum velocity and the velocity profile generated by the trajectory approximation. The damping factor
must be selected sufficiently large such that the last term vanishes for adequately high velocities
, thereby having a negligible effect on the trajectory approximation outside the start and stop regions. With known
, the next position command can be obtained from Equation (
8).
If the reference trajectory changes at runtime, the same strategy as described in
Section 2.2 is applied. For a new trajectory
, the next target point
and the corresponding
are found as described and then used as the target control point. The new target is again approached linearly in position and velocity so that the step distance
in Equation (
9) with
is modified and becomes the dynamic step distance
Using Equation (
14), the NPG can track a changing reference trajectory.
Figure 4 illustrates an example of position commands for both increasing and decreasing velocity between
and
. For clarity, the example is shown in two-dimensional space. As can be seen, when the velocity increases, the distance between consecutive position commands becomes larger, whereas it decreases when the velocity is reduced. If the target changes due to a new reference trajectory, both the direction and the spacing of the position commands adapt accordingly. It should be noted that the NPG generates Cartesian position commands to track the given reference, without yet verifying whether the robot is capable of executing these commands.
2.4. Avoidance of Singularities
When sending position commands to a robot, it must be verified whether they can be executed. In this section, assumption 4. from
Section 2.2 is relaxed, allowing for the possibility that the robot may be driven toward a singularity. Nonetheless, it is still ensured that the motion remains entirely within the robot’s workspace. For the purposes of this paper, the robot under consideration is a 7-DoF KUKA iiwa, as mentioned above, which can be controlled via position commands. The robot accepts joint commands
, with
corresponding to the number of joints.
This section presents a strategy for avoiding singularities. The robot’s kinematics are briefly reviewed to introduce the manipulability measure employed in the approach. From given joint states the Cartesian position and orientation of the TCP of the robot can be calculated with
where
corresponds to the Cartesian position and
to the orientation of the TCP, which together form a
DoF representation in CS. The function
f is obtained from the known geometry of the robot and the Denavit–Hartenberg parameters [
38]. It is expressed as a concatenation of transformation matrices, each parameterized by
. The NPG for trajectory generation provides the Cartesian position
with fixed orientation, as the object to be handled should not change its orientation while moving in the collaboration investigated here. So the orientation
is set to an angle where the gripper mounted on the robot is in a vertical position above the rod. This means every position has the same orientation. The joint states can be obtained with the Newton-Raphson method in an iterative manner
with appropriate initial values
and the goal to minimize the error term err. The Moore-Penrose inverse [
39]
is used because the Jacobian
is of dimension
and thus cannot be inverted. In the following, the iterative process to retrieve the IK is denoted as
The robot accepts joint states that fulfill the condition
which means the desirable motion can be executed. If the above-named condition is violated and
then the manipulator is in a singular state. In a singular configuration, the IK may fail to produce an executable solution for
. When sending position commands to the robot in real time, it is therefore necessary to check at each time stamp whether the motion is approaching a singularity. For this purpose, the manipulability measure
introduced by Yoshikawa [
24], is used. A small value of
indicates close proximity to a singularity. The objective is to prevent the robot from executing movements that approach such configurations.
In the following, a singularity avoidance strategy is proposed that avoids singularities and brings the TCP back to the reference trajectory afterwards. For this purpose, the manipulability measure
must not fall below a threshold
. At each time stamp, the next target
provided by the NPG is evaluated. If the manipulability measure is above the threshold
, no action is necessary, as the robot is not close to a singularity. If the manipulability measure is below the threshold, corrective action is required to ensure proper movement. Between the points of the discretized trajectory, the robot moves linearly toward the next target
. To avoid a singularity, the direction of the motion must be adjusted. Since the location of the singularity is unknown, it is not clear in which direction the robot should move to avoid it. Therefore, a set of candidate commands
, illustrated in
Figure 5, is provided.
To maintain the Cartesian TCP velocity it is required that the distance between each candidate and
must be the same as the distance between
and
. To reach the next control point
, it is also necessary that the candidates lie roughly in that direction. So a cone with its tip in
and a height
is defined. The center of the cone should be aligned to the direction
of the desired movement in order to reach the next waypoint. The cone’s alignment and its slant height, which corresponds to
, are fixed. The only adjustable parameter is the angle
, which defines the cone’s aperture and must be less than
. This angle specifies the allowable deviation from the original direction and must be chosen such that the candidate directions deviate sufficiently from
to avoid singular configurations. Within the scope of this work, the cone angle was set empirically to
, as this value provided a good compromise between effective direction adaptation and maintaining proximity to the original reference trajectory. The aim is to obtain a function that returns candidate points located on the edge of the cone’s base. The radius and the height of the cone are defined with
The center of the base of the cone is computed with
Points on the edge of the cone’s base are described by the function
where
and
are the orthonormal basis vectors spanning the plane in which the candidate points lie. The first basis vector is defined as
where
is the first unit vector. If
is aligned with
, the cross product yields the null vector. To avoid this case, the norm
is checked; if it is less than
, the second unit vector
is used instead. The second basis vector
is orthogonal to both
and
and is computed as
Finally, to obtain the orthonormal basis required for Equation (
19),
and
are normalized to
and
, respectively. With that equation the candidates
can be obtained. Those candidates are equally spaced on the edge of the cone, which is aligned to the direction
. Because the slant length of the cone is chosen with
, it is also guaranteed that the velocity when moving to one candidate is the same as when moving to
.
Now, the candidate with the best manipulability is searched. Therefore the fixed orientation
is added to the position candidates to obtain a vector
that describes the location of the robot as shown in Equation (
16). Those candidate locations can be transformed with the IK (Equation (
17)) into an amount of candidate joint states
Afterward, the manipulability measure from Equation (
18) is evaluated for all candidate configurations, and the best one is selected according to
This configuration can then be used as the next joint state command, steering the robot away from a singularity while maintaining the desired Cartesian TCP velocity.
When applying this strategy at every time stamp, the robot’s trajectory is repelled from singular configurations. However, to both avoid singularities and track the given trajectory as closely as possible, the strategy requires refinement. Consider two neighboring control points,
and
, that are far apart, with a singularity lying between them. In this case, the robot would move away from the singularity until it could resume moving directly toward
. In practice, the distance between neighboring control points is small, since
is intended to approximate a spline smoothly. If a singularity is close to
, the robot may be repelled from the target and the TCP ends up circling around it. To address this issue, the strategy is adapted as illustrated in
Figure 6. For simplicity, the sketch is shown in two dimensions, though the same principle applies in three dimensions. Around each control point
, an initial blending radius
of
is defined. If the robot’s TCP enters the sphere of this radius,
is considered reached, and the next control point becomes the target. The modification is to increase the blending radius around
whenever
is adapted by the avoidance strategy. This ensures that the current goal is eventually considered as reached. Once the next control point is targeted, the blending radius is reset to its initial value and then increased again if further adaptations to
are required.
An example of the strategy is shown in
Figure 6. Each sketch indicates the current position
, the next two control points
and
, the next position command
generated by the NPG, possible candidate points, and the blending radius. In
Figure 6a–d,
(marked in red) lies in the direction of the target but has low manipulability. Two example candidates (marked in blue) are considered, and the one with the highest manipulability measure is selected. With each subsequent sketch, the blending radius increases, and in
Figure 6d, the selected next command lies within this radius. At this point,
is considered reached,
j is incremented, and the next control point becomes the target. In the final sketch,
Figure 6e, no adaptation of
is necessary, as it already has good manipulability.
Algorithm 1 summarizes the avoidance strategy and is explained in the following. This algorithm describes the behavior of the modified NPG for singularity avoidance and is evaluated at every time stamp. Its inputs are the current discretized trajectory
, the index
j of the last reached control point, the constant initial blending radius
, the increment
l by which the blending radius is increased whenever an adaptation of
becomes necessary, and
h the number of blending radius increments. In the scope of this work the increment is chosen with
, which means that
increases by 2 cm per second when considering the constant control frequency of
and ongoing violation of the manipulability threshold
. The output is the next joint command
. The integer
h is initialized with zero at the begin of the movement, increased each time
is adapted, and reset whenever a new target is set. First,
is obtained from the NPG and transformed into a joint state command. If
lies within the blending radius of the target
, the index
j is incremented to set the next target. In that case,
is computed again, now pointing toward the updated target. If
is not inside the blending radius, the manipulability measure of
is evaluated. If it is below the threshold, movement candidates are generated, and the one with the highest manipulability measure is selected as
. In this case, the integer
h, which controls the growth of the blending radius, is also increased.
| Algorithm 1 Singularity Avoidance |
Require: , j, , l, h Init:
- 1:
while
do - 2:
Obtain with Equations ( 8) and ( 12) - 3:
Obtain with Equation ( 17) - 4:
Adjust blending radius with - 5:
compute the distance to the next control point with - 6:
if then - 7:
Increase the target - 8:
Reset blending radius - 9:
else - 10:
if then - 11:
Find candidates with Equation ( 20) - 12:
Obtain candidate joint States with Equation ( 21) - 13:
Choose with Equation ( 22) - 14:
Increase blending radius for the next time stamp
return Next joint command |
2.5. Compliance to Joint Velocity and Acceleration Limits
In the previous section, the robot’s joint velocity and acceleration limits were neglected. Therefore, assumption 5 from
Section 2.2 is modified so that joint velocity and acceleration constraints must be respected when sending the next position command. Since the reference trajectory is defined in CS, it is not directly possible to determine the required joint velocities for accurate tracking. In the previously described control approach, the joint states obtained from IK would be transmitted to the robot without verifying compliance with its physical velocity and acceleration limits. The following section introduces a method that ensures adherence to these limits by modulating the robot’s motion speed, thereby maintaining compliance while preserving the reference path. It is assumed that the current joint states
are known, and that the next joint command
has already been adapted by the singularity avoidance strategy described in the previous section. For a discrete function with closely spaced values, the mean difference quotient can be used to estimate the derivative at a given point. Due to the high control frequency, and the resulting small distances between successive configurations in CS, as well as the assumption that
remains sufficiently far from singular configurations, the difference between consecutive joint commands is expected to be small. This approximation introduces a discretization error that is proportional to the sampling interval and is therefore negligible for the control frequency used in this work. The computation is performed individually for each joint. With
and
the value of the derivatives at
can be estimated. The time difference
between two consecutive joint commands corresponds to the inverse of the control frequency
f. Let
denote the previously executed joint command, and let
denote the joint command that follows after
which is generated by the NPG using
as the start value.
For the analysis of the velocity and acceleration limits, it is assumed that those values increase or decrease steadily between two consecutive joint commands. With Equations (
23) and (
24) the joint velocity
and acceleration
are estimated. Next, the relative violations of the joint velocity and acceleration are evaluated. For this purpose, the relative quotients of velocity and acceleration with respect to their maximum values are defined for each joint as
These quotients are composed of the desired velocity and acceleration divided by the maximum value for the corresponding joint. If a quotient is greater than one, the desired velocity or acceleration exceeds the limit and must be capped. If every quotient is less than one, the velocity and acceleration required for
is within the robot’s limits and can be realized. The maximum relative deviation of velocity and acceleration
is extracted, which is then used to cap the velocity or acceleration at the maximum value given by the limitations of the robot. The idea is to fix the velocity or acceleration of the joint with the largest relative deviation to the maximum velocity or acceleration and adjust the velocities of the other joints accordingly so that the path is not changed. Therefore
is adapted in a way so that
is closer to
than the initial
. Summarized this method makes it possible that the TCP of the robot at least tracks the path of a trajectory planned in CS with reduced speed.
2.6. Summary of Dynamic Robot Motion Planner
The dynamic motion planner is illustrated in greater detail in
Figure 7. This sketch summarizes the concepts introduced in
Section 2.2,
Section 2.3,
Section 2.4 and
Section 2.5. Given a reference trajectory defined by points with associated time stamps, the output of the motion planner is the next joint command, which can be sent either to the real robot or to the simulation. The motion planner is able to track a trajectory that changes dynamically, with the following properties:
- 1.
The path lies within the workspace of the robot, and every point is reachable
- 2.
The path can dynamically change when the robot moves
- 3.
The TCP velocity can change dynamically
- 4.
There could be singularities on the path, which need to be avoided
- 5.
The joint velocity and acceleration are limited
The dynamic motion planner (
Figure 7) is responsible for sending joint commands to the robot with the required motion properties. It consists of the following modules: the Discretizer, the Check Waypoint module, the Target Generator, the NPG, and the subsequent safety checks (Singularity Check and Velocity Cap). The Discretizer converts the incoming time-stamped trajectory into a sequence of equidistant points in CS on the reference trajectory. The Check Waypoint module checks whether the next control point has been reached. Then, the Target Generator selects the active reference control point and provides the current direction of motion. The NPG generates the next Cartesian command along this reference, which is subsequently transformed into joint space. Finally, the Singularity Check and Velocity Cap modules modify the resulting joint command if necessary before it is sent to the robot.
In the Discretizer, the time-parameterized input sequence is approximated using a spline representation and reparameterized from uniform sampling in time to approximately uniform sampling in CS. The resulting output is a sequence of equidistant points in CS with corresponding velocities.
In the Check Waypoint module the motion planner checks whether the next control point has been reached. The robot’s current position is obtained by applying forward kinematics to the current joint configuration . This position serves as the basis for selecting the next waypoint on the trajectory. The Cartesian velocity is implicitly determined by the distance between and . A goal is considered reached if the TCP lies within its blending radius . The index variable j tracks the last reached control point and is incremented once the goal is reached.
In the Target Generator, the next control point is set as next goal. Therefore, it first checks if the current sequence of equidistant control points differs from the previously used reference . If unchanged, the next control point is simply . If the trajectory has changed, a control point that lies in the direction of the known endpoint of the movement is selected and j is set appropriately. This avoids using a control point, which could steer the TCP closer to the start point again. Given the current position , the control frequency f, and the next target, the NPG computes the next Cartesian command along the trajectory. Combined with a fixed orientation , this point is transformed into a joint configuration via IK.
The Singularity Check modifies if necessary and ensures that does not steer the robot into a singularity. The variable governs the angle on which the avoidance path deviates from the straight line path to the next control point. In cases of adaptation, the blending radius is enlarged by an offset l to prevent circling around a goal. The variable h tracks how often this enlargement occurs and is reset once the next control point is reached. Since the trajectory is planned in CS, the NPG is unaware of joint velocity and acceleration constraints.
In the Velocity Cap block, these are checked based on and the subsequent configuration which the NPG also generates with assumed as current robot state. Using the control frequency f, the expected joint velocities and accelerations are estimated. If any joint exceeds its velocity or acceleration limits, the velocity of the fastest joint is capped, and the subsequent joint command is adjusted accordingly by proportionally scaling the velocities of all other joints. This ensures that the TCP remains on the path of the trajectory, albeit at a reduced speed. Finally, the resulting joint command is sent to the real or simulated robot.
2.7. System Architecture
For real-time control, the KUKA FRI-package is used, which enables hard real-time robot control at 200 Hz. The Quality of Service (QoS) specifications require that consecutive commands be provided precisely every 5 ms. To satisfy these requirements, the proposed motion planner must compute new joint commands in less than 5 ms to satisfy the QoS. While the planner meets this requirement in most cases, occasional violations occur due to two main factors. First, the communication delay between the planning hardware and the robot hardware is approximately 1 ms in the current setup. Second, the computation time of the inverse kinematics solution depends on the robot’s configuration. In regions of low manipulability, an ill-conditioned Jacobian matrix must be inverted, where the determinant is close to zero. This can significantly increase computation time and may exceed the available time budget, leading to violations of the QoS requirements and, in the worst case, interruptions in communication between the application and the controller. Therefore, computing joint positions strictly just-in-time is not sufficient, as the robot controller requires commands at a fixed update rate. To address this, a command buffer is introduced that stores joint commands computed in advance. This approach decouples command generation from communication, introducing a controlled delay to ensure a continuous and stable data stream to the robot controller. In summary, the proposed motion planner generates joint commands that track a dynamically changing reference in soft real-time, while the command buffer stores these commands and supplies them to the robot at a fixed control frequency. In the unlikely event that the motion planner fails to compute the next joint values within the required control cycle of the command buffer, the robot performs a controlled stop.
The buffer is designed following a publisher–subscriber architecture and operates in two phases. First, the motion planner is initialized with the current joint configuration
. In this phase, the buffer requests the first two joint commands,
and
, from the motion planner, forming two segments
and
. Every segment is interpolated such that the joint velocity within a segment changes linearly, using a 1:10 interpolation ratio between the motion planner frequency (20 Hz) and the robot control frequency (200 Hz). The concept of the buffer is illustrated in
Figure 8, where black dots denote the joint commands generated by the motion planner and blue strips represent the interpolated commands
produced by the buffer; the initialization phase is shown on the left side of the figure, while the operation phase is shown on the right. Once the initial segments are computed and buffered, motion execution begins, marking the end of the initialization phase. During operation, whenever a joint command
is reached, the buffer triggers a request to the motion planner for the next point
. At this point, the subsequent command
is already available in the buffer, and the interpolation between
has already been performed. This lookahead provides sufficient time for the motion planner to compute
and for the buffer to interpolate the segment
before
is executed. If the trajectory is completed and no further commands are provided by the application, the buffer maintains the last control point as the active command to ensure continuous communication with the controller.
Compared to just-in-time computation, the proposed buffer structure ensures that the robot controller receives commands that satisfy the required QoS, at the expense of hard real-time trajectory tracking. Consequently, adaptations to changes in the reference are subject to a short delay and do not take effect in hard real-time. The interpolation rate is chosen conservatively but could be increased if more capable hardware is available. A larger interpolation rate of the motion planner would improve tracking performance and reduce the influence of the command buffer delay. For HRC, the soft real-time performance provided by this buffer is sufficient, as the resulting delays remain below typical human reaction times [
40].
The overall system architecture for controlling the robot with the proposed motion planner is shown in
Figure 9. It consists of four components: the real robot, which receives commands
at a fixed control frequency; a trajectory generator, which provides references
based on the current joint configuration
; the robot motion planner, which computes the next joint command
for a given reference
and a start configuration
; and the buffer, which supplies the joint commands
to the robot at the required control frequency in a continuous manner.