Tight Slalom Control for Sailboat Robots Mael Le Gallic Joris Tillet ENSTA Bretagne ENSTA Bretagne mael.le gallic@ensta-bretagne.org joris.tillet@ensta-bretagne.org Fabrice Le Bars Luc Jaulin Lab-STICC Lab-STICC ENSTA Bretagne ENSTA Bretagne fabrice.le bars@ensta-bretagne.fr lucjaulin@gmail.com Abstract Existing controllers for sailboat robots are usually developed for speed performances and for long straight lines. In this context, the accuracy is not the main concern. In this paper, we consider the tight slalom problem which requires accuracy. We propose a feedback-linearization based method combined with a vector field approach to control the sailboat. Some simulations show that the robot is able to perform the slalom without missing any gate. 1 Introduction We consider a mobile robot described by the state equations (Jaulin, 2015a)  ẋ = f (x, u) (1) p = g(x) with an input vector u = (u1 , . . . , um ), a state vector x = (x1 , . . . , xn ) and a pose vector p = (p1 , . . . , pm+1 ) with n ≥ m + 1. The goal of this paper is to show we can follow a chosen vector field in the p space (Khatib, 1986)(Pêtres et al., 2011)(Schmitt et al., 2016), using a feedback-linearization based method. It means that we can control m + 1 state variables and not only m of them, as given by the theory (Isidori, 1995). This is due to the fact that we perform a path following instead of a trajectory tracking where the time is involved. In practice, the vector p corresponds to the position of the center of the robot and may be of dimension 2 (if m = 1) or 3 (if m = 2). This is consistent with the fact that we need one actuator to control the direction of a 2D vehicle such as a car or a boat and two actuators for a 3D vehicle such as a plane. The approach we propose is to find a controller so that the vector ṗ be collinear (instead of equal) to the required field. This is illustrated in this paper in the case where the mobile robot is a sailboat (Miller et al., 2012)(Cruz and Alves, 2008)(Holger et al., 2009). The input u is scalar (i.e., m = 1) and corresponds to the rudder. Moreover, we will show that this approach is particularly adapted to sailboats where the speed is hardly controllable (Neumann and Schlaefer, 2012)(Stelzer et al., 2007). Copyright c by the paper’s authors. Copying permitted for private and academic purposes. In: S. M. Schillai, N. Townsend (eds.): Proceedings of the International Robotic Sailing Conference 2018, Southampton, United Kingdom, 31-08-2018 87 ROBOTIC SAILING 2018 2 Method In order to facilitate the understanding of our approach, we will deal with a Dubins car, which is much simpler than a sailboat. The extension to other type of mobile robots is straightforward. 2.1 Line following for a Dubins car To introduce our approach, we consider a robot (here a Dubins car) moving on a plane and described by the following state equations:   ẋ1 = cos x3 ẋ2 = sin x3 (2)  ẋ3 = u where x3 is the heading of the robot and p = (x1 , x2 ) are the coordinates of its center. The state vector is given by x = (x1 , x2 , x3 ). Let us choose as the control output the variable y = x3 + atan(x2 ). (3) and let us find a classical feedback linearization based controller (Jaulin, 2015b) such that the output y (which can be interpreted as an error) converges to 0. In such a case, we will have x3 + atan(x2 ) = 0 and the robot will perform a line following. Differentiating (3) we have ẋ2 sin x3 ẏ = ẋ3 + =u+ . (4) 1 + x22 1 + x22 Since u occurs in (4), the relative degree of the system is 1. We may thus choose a first order equation for the error y, such as ẏ + y = 0, (5) We then choose u to have this error equation satisfied. From (4) and (5), we get: u = −y − sin x3 1+x22 (6) = −x3 − atan(x2 ) − sin 1+x2 x3 2 Note that we do not have any singularity. As illustrated by the simulation depicted on Figure 1, the associated vector field makes the car attracted by the line x2 = 0. Figure 1: Precise line following Remark. For more robustness with respect to small uncertainties, a sliding mode effect could be added. It suffices to take for required error y = x3 + atan (x2 + α · sign (x2 )) , 88 Manoeuvre & Route Planning where α is a small positive coefficient, e.g., α = 0.1. In such a case, the robot will go to the line in a finite time (and not asymptotically, as previously). Moreover, it will remains exactly on the line even if some small uncertainties occur. 2.2 Generalization We want our robot to follow the field ψ(p), more precisely, we want that ψ(p) and ṗ point toward the same direction. This condition can be translated into the form ϕ (ψ(p), ṗ) = 0, where ϕ is a collinearity function which satisfies ϕ (r, s) = 0 ⇔ ∃λ > 0, λr = s. (7) Typically, this function corresponds to one angle (the heading) if m = 1 and two angles (heading, elevation) for m = 2. Note that the function ϕ cannot be expressed with a determinant since r, s should not point toward opposite directions. We define the output   ∂g y = ϕ (ψ(p), ṗ) = ϕ ψ(g (x)), (x) · f (x, u) . (8) ∂x Since y ∈ Rm , we can apply a feedback linearization method and we get y → 0. This means that the robot will follows the required field. Note that we have no control on the speed, which is not our main concern in this paper. 2D case. Consider for instance the case where m = 1. We have   ψ1 (p) ψ(p) = . (9) ψ2 (p) ∂g We take as an output y, the angle between the actual heading vector ṗ = ∂x (x) · f (x, u) and the desired heading vector given by ψ(p). Denote by θ (x) the argument of the vector ṗ. We have (8)   ∂g y = = angle ψ(g (x)), ∂x (x) · f (x, u)    cos θ = angle ψ(g (x)), (10) sin θ = sawtooth(θ−atan2(ψ2 (g (x)), ψ1 (g (x)))) | {z } | {z } b a The sawtooth function is given by:   e = 2atan tan θe = mod(θe + π, 2π) − π sawtooth(θ) (11) 2 As illustrated in Figure 2, the function corresponds to an error in heading. The interest in taking an error θe filtered by the sawtooth function is to avoid the problem of the 2kπ modulus: we would like a 2kπ to be considered non-zero. Figure 2: Sawtooth function used to avoid the jumps in the heading control We have b a ẏ = θ̇ − (− 2 2 · ȧ + 2 · ḃ) a +b a + b2 | {z } | {z } (12) ∂atan2(b,a) ∂atan2(b,a) ∂a ∂b = u + b·aȧ−a· ḃ 2 +b2 , 89 ROBOTIC SAILING 2018 if we assume that the input u corresponds to the desired angular velocity. We propose a feedback linearization based control based on the required equation ẏ = −y. We have (12) (b·ȧ−a·ḃ) u = ẏ −a2 +b2 (b·ȧ−a·ḃ) (13) = −y − a2 +b2 (since ẏ = −y) (10) (b·ȧ−a·ḃ) = − (sawtooth(θ − atan2(b, a)) − a2 +b2 . We thus have the guarantee that after some time, the error angle y is 0 and that we follow exactly the vector field. 2.3 Dubins car following the Van der Pol cycle We would like our Dubins car to follow a path corresponding to the limit cycle of the Van der Pol equation:   p2  ψ(p) = . (14) − 0.01 p21 − 1 p2 − p1 T Take g (x) = (x1 , x2 ) which means that we want to build the paths in the (x1 , x2 )-space. We have   x2  ψ(g (x)) = (15) − 0.01 x21 − 1 x2 − x1 and     cos x3 ∂g 1 0 0 (x) · f (x, u) = ·  sin x3  (16) ∂x 0 1 0 u Thus a = x2 b = −(0.01 x21 − 1)x2 − x1 (17) θ = x3 and ȧ = sin x3  ḃ = − (0.01 · 2x1 ẋ1 ) x2 − 0.01 x21 −  1 ẋ2 − ẋ1 (18) = −0.02 · x1 x2 cos x3 − 0.01 x21 − 1 sin x3 − cos x3 From (13), we get that final controller is    2   x1 u = −sawtooth x3 − atan2 − 100 − 1 x2 − x1 , x2      2   x2 x1 x2 cos x3 x1 1 100 −1 x2 +x1 ·sin x3 +x2 · 50 + 100 −1 sin x3 +cos x3 (19) +  2 x1  2 x22 + 100 −1 x2 +x1 The behavior of the control law is illustrated by Figure 3. The car is very close to the true limit cycle, which is not the case if we consider a classical linear controller. Indeed, the controller anticipates the fact that the required trajectory have to take into account the curvature of the vector field. 3 Application to the slalom problem We consider the following model which corresponds to a simplified version of the sailboat model given in (Jaulin and Le Bars, 2013). The state equations are 90 Manoeuvre & Route Planning Figure 3: Dubins describing accurately the Van der Pol cycle    ẋ1 = v cos θ   ẋ2 = v sin θ       θ̇ = −ρ2 v sin 2u1     v̇ = ρ3 kwap k sin (δs − ψap ) sin δs − ρ1 v 2  σ = cos  ψap + cos u2 (20)   π + ψap if σ ≤ 0   δs =    −sign (sin ψ ) · ap  2u otherwise     −a sin (θ) − v   wap =   −a cos (θ)  ψap = angle wap where ρ1 = 0.003, ρ2 = 0.2, ρ3 = 3. In this equation u1 , u2 correspond to the tuning of the rudder and the sail, respectively. We would like our robot to follow a path which makes a tight slalom through doors that have to be passed. We assume that we have a Cartesian equation for our path. For instance, we consider that the path is described by p  1 e (p) = 10 sin − p2 = 0 (21) 10 where e (p) corresponds to an error. This path corresponds to a path that should be possible for a normal sailboat robot for crosswind conditions. We take a vector field which corresponds to a pole placement strategy. For instance, we want the error satisfies ė = −0.1 e, so that it will converge to zero in about 10 sec. Thus p  1 p   1 1 cos ṗ1 − ṗ2 = − 10 sin − p2 (22) | 10{z } 10 | 10 {z } ė(p) e(p) We take ṗ1 = 1, to go to the right. As a consequence, we get the following field:     ṗ1  1   ψ(p) = = (23) ṗ2 cos p101 + 10 1 10 sin p101 − p2  which is attracted by the curve p2 = 10 sin p101 . We have    1   ψ(g (x)) = x 1 x (24) cos 1 10 + 10 10 sin 10 1 − x2 91 ROBOTIC SAILING 2018 and   ∂g cos x3 (x) · f (x, u) = . (25) ∂x sin x3 Thus a =  1  x1 x1 1 (26) b = cos 10 + sin 10 − 10 x2 and ȧ =  0  ḃ = 1 −ẋ1 10 sin x101 + ẋ1 10 1 cosx101 − 10 1 ẋ2 (27) 1 x1 x1 1 = 10 cos x3 · cos 10 − sin 10 − 10 sin x3 . From (13), we get that the desired angular velocity should be (b·ȧ−a·ḃ) . (28) ω̂ = − (sawtooth(θ − atan2(b, a)) − a2 +b2 Now, since the true angular velocity is θ̇ = −ρ2 v sin 2u1 , we take    1 ω̂ u1 = − arcsin tanh . (29) 2 ρ2 v The saturation function tanh is needed since the rudder cannot respond to any required ω̂. Indeed, if our controller ask to turn too fast for the boat, ρω̂2 v will be more than 1, and the rudder can only do its best. The behavior of our controller is illustrated by Figure 4, where the sailboat has to slalom tightly between doors. We can see that the trajectory follows exactly the sine path (magenta). The Python source codes associated to the simulation can be found at: https://www.ensta-bretagne.fr/jaulin/slalompy.zip wind Figure 4: The sailboat robot slaloms through the blue doors 4 Conclusion In this paper, we have proposed a new controller for sailboat robots which allows to take into account the curvature of the required field in order to anticipate as much as possible the required trajectory. To our knowledge, this is not considered by existing controllers (Le Bars and Jaulin, 2013) which are devoted to straight lines (Plumet et al., 2018). It has been shown that the required vector field could be followed exactly. This anticipation is crucial if we want to maneuver quickly and precisely as needed when we want to avoid an obstacle. This has been illustrated on a simulated test-case where a tight slalom is performed by a sailboat robot. References Cruz, N. and Alves, J. C. (2008). Ocean sampling and surveillance using autonomous sailboats. In Proceedings of the 1st International Robotic Sailing Conference. Holger, K., Roland, S., Karim, J., and Mellinger, D. K. (2009). AAS endurance: An autonomous acoustic sailboat for marine mammal research. In 2nd International Robotic Sailing Conference. 92 Manoeuvre & Route Planning Isidori, A. (1995). Nonlinear control systems: An Introduction, 3rd Ed. Springer-Verlag. Jaulin, L. (2015a). Automation for robotics. John Wiley & Sons. Jaulin, L. (2015b). Mobile robotics. Elsevier. Jaulin, L. and Le Bars, F. (2013). An interval approach for stability analysis: Application to sailboat robotics. IEEE Transactions on Robotics, 29(1):282–287. Khatib, O. (1986). Real-time obstacle avoidance for manipulators and mobile robots. In Autonomous robot vehicles, pages 396–404. Springer. Le Bars, F. and Jaulin, L. (2013). An experimental validation of a robust controller with the vaimos autonomous sailboat. In Robotic Sailing 2012, pages 73–84. Springer. Miller, P. H., Hamlet, M., and Rossman, J. (2012). Continuous improvements to usna sailbots for inshore racing and offshore voyaging. In 5th International Robotic Sailing Conference, pages 49–60. Springer. Neumann, T. and Schlaefer, A. (2012). Feasibility of basic visual navigation for small sailboats. In 5th Interna- tional Robotic Sailing Conference, pages 13–22. Pêtres, C., Romero-Ramirez, M.-A., and Plumet, F. (2011). Reactive path planning for autonomous sailboat. In 15th International Conference on Advanced Robotics (ICAR), pages 112–117. IEEE. Plumet, F., Briere, Y., and Le Bars, F. (2018). Les voiliers robotisés. (ref. article : s7815). fre. Schmitt, S., Le Bars, F., Jaulin, L., and Latzel, T. (2016). Obstacle avoidance for an autonomous marine robot—a vector field approach. In Quantitative monitoring of the underwater environment, pages 119–131. Springer. Stelzer, R., Proll, T., and John, R. I. (2007). Fuzzy logic control system for autonomous sailboats. In Fuzzy Systems Conference, 2007. FUZZ-IEEE 2007. IEEE International, pages 1–6. IEEE. 93