## 3 Description of the Method
### Trajectory Generation  
We parametrize a set of admissible trajectories by Bezier curves in joint angle space, which is free of singularities from arbitrary movements. The reason for the choice of Bezier curves was motivated by the fact that the direct use of PSO points as node points of a trajectory generate very curved trajectories that frequently led to abrupt motions and protective stops of the robotic arm. Bezier curves serve as a smoothing mechanism. These curves have low curvature and smooth trajectories with continuous derivatives of all orders and are, therefore, compatible with our goal to search for trajectories with minimal energy consumption.  
Bezier curves are defined by \(n+1\) control points: \(P_{0},P_{1},\ldots,P_{n}\), with the following equation:  
\[C(u)=\sum_{i=0}^{n}B_{n,i}(u)P_{i} \tag{4}\]  
where \(B_{n,i}\) are Bernstein basis polynomials of degree \(n\), defined as:  
\[B_{n,i}(u)=\frac{n!}{i!(n-i)!}u^{i}(1-u)^{n-i} \tag{5}\]  
At the beginning of our experiments, we tried optimization with only one waypoint in the middle of the trajectory. This simple approach led to an energy consumption reduction. However, the extension of the searchable trajectory space that was controlled by seven control points in the robotic arm six-dimensional joint space led to a further improvement of the energy consumption.  
Two of the seven Bezier curve control points are the start and end points of the trajectory and they are not subject to optimization. The next two control points in the immediate vicinity of the start and end points are optimized by the PSO algorithm over a smaller range in order to avoid abrupt starts and stops of movement, which could cause a protective stop of the robotic arm. In other words, we demand that the proposed trajectories have smaller time derivatives in the endpoints, which physically means that they have a lower velocity close to the endpoints.  
The last three control points are used for proper energy optimization of the trajectory and they are responsible for the variation of the shapes of PSO proposed trajectories. See Figures 3 and 4 for a graphical explanation of this point.  
Control points of Bezier curves are generated in specific ranges \(\Delta_{1}-\Delta_{5}\), which serve as PSO search space limits (see Figure 3 and Table 1). The control points regulate the size and shape of the joint angle trajectory space \(\theta(t)_{0-5}\) of robotic arm movements. In our experiments, we chose such a range that the arm could not hit any obstacle--we ensured enough free space around the manipulator to avoid any collision. In real applications, a proper collision detection would be necessary during the PSO algorithm (penalizing particles that represent a trajectory with some collisions).  
The maximum velocity of individual joints is set by the steepest line segment of the blue area in Figure 3, i.e., the line with the highest absolute value of the time derivative. Robotic arm  
Figure 4: Convergence of particle swarm optimization (PSO) optimizations. The blue line represent default energy consumption by individual PTP movement, red crosses are energies consumed by execution of optimized trajectories.  
Figure 3: PSO search space for the i-th joint angle. The space is given by Bezier control points in the blue area. The blue area is a convex hull of all admissible PSO trajectories.  
manufacturers usually provide information of the maximal achievable velocity of individual joints. Another mechanism is to set this by trial and error.  
Maximum acceleration control was performed by manual adjustment of the control points 2 and 6, see Figure 3. In the uncontrolled case, reaching the end position sometimes led to a too fast deceleration, which invoked the UR3 protective stop. Another mechanism for acceleration control would be the computation of second derivatives from known formulas of the Bezier curve second derivatives. This would involve more manual work and lower practicability, especially in the case when one is not aware of the safe values of maximum acceleration.