Design of a Networked Controller for a Two-Wheeled Inverted Pendulum Robot
Zenit Music, Fabio Molinari, Sebastian Gallenm\"uller, Onur Ayan,, Samuele Zoppi, Wolfgang Kellerer, Georg Carle, Thomas Seel, J\"org Raisch

TL;DR
This paper presents a model-based networked control design for a two-wheeled inverted pendulum robot, addressing wireless communication delays to maintain stability and upright position, validated through experimental benchmarking.
Contribution
It introduces a novel networked control scheme using model predictive control that manages wireless delays by making them deterministic, improving stability in remote robot control.
Findings
The proposed control scheme maintains stability despite wireless delays.
Experimental results show improved performance over local control without delays.
The approach effectively handles uncertainties introduced by wireless communication.
Abstract
The topic of this paper is to use an intuitive model-based approach to design a networked controller for a recent benchmark scenario. The benchmark problem is to remotely control a two-wheeled inverted pendulum robot via W-LAN communication. The robot has to keep a vertical upright position. Incorporating wireless communication in the control loop introduces multiple uncertainties and affects system performance and stability. The proposed networked control scheme employs model predictive techniques and deliberately extends delays in order to make them constant and deterministic. The performance of the resulting networked control system is evaluated experimentally with a predefined benchmarking experiment and is compared to local control involving no delays.
Click any figure to enlarge with its caption.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8| Symbol | Unit | Description |
|---|---|---|
| rad | Body pitch angle | |
| rad | Rotation angle of the right (left) wheel | |
| rad | Rotation angle of the right (left) motor | |
| rad | Average rotation angle of the wheels | |
| rad | Yaw angle of the body |
| Local | NCS | |
|---|---|---|
| 2.4141 [rad] | 2.4512 [rad] | |
| 0.0116 [rad] | 0.0192 [rad] | |
| 0.0849 [rad] | 0.0888 [rad] |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Design of a Networked Controller
for a Two-Wheeled Inverted Pendulum Robot
Zenit Music
Fabio Molinari
Sebastian Gallenmüller
Onur Ayan
Samuele Zoppi
Wolfgang Kellerer
Georg Carle
Thomas Seel
Jörg Raisch
Control Systems Group - Technische Universität Berlin, Germany.
Chair of Network Architectures and Services - Technische Universität München, Germany.
Chair of Communication Networks - Technische Universität München, Germany.
Max-Planck-Institut für Dynamik komplexer technischer Systeme, Germany.
Abstract
The topic of this paper is to use an intuitive model-based approach to design a networked controller for a recent benchmark scenario. The benchmark problem is to remotely control a two-wheeled inverted pendulum robot via W-LAN communication. The robot has to keep a vertical upright position. Incorporating wireless communication in the control loop introduces multiple uncertainties and affects system performance and stability. The proposed networked control scheme employs model predictive techniques and deliberately extends delays in order to make them constant and deterministic. The performance of the resulting networked control system is evaluated experimentally with a predefined benchmarking experiment and is compared to local control involving no delays.
\DefineFNsymbolsTM
otherfnsymbols•∘§§‡‡‖∥¶¶
††thanks: This work was funded by Deutsche Forschungsgemeinschaft (DFG) within their priority programme SPP 1914 ”Cyber-Physical Networking” (CPN). Grant numbers RA516/12-1, CA595/71, and KE1863/5-1.
\DefineFNsymbolsTM
reset** ‡‡
1 Introduction
Advancements in communication and computation technology have led to the concept of Networked Control Systems (NCSs), cf. Hespanha et al. (2007). In an NCS, components are distributed and interact via a communication network. This allows a considerable increase in flexibility, but also raises many design challenges (Bemporad et al. (2010),Walsh et al. (2002)). In the case of wireless communication, non-deterministic delays and packet losses are characteristic phenomena. Delays are traditionally assumed shorter than the sampling time, see Nilsson et al. (1998), or compensated by adopting a Model Predictive Control scheme as in Mori et al. (2014). On the other hand, packet loss is commonly compensated by either employing H-infinity control design, see Ishii (2008), or gain-scheduling feedback, see Yu et al. (2008). A variety of further methods and approaches have been proposed to address these challenges (cf. Zhang et al. (2016)).
The purpose of this paper is to design a networked controller for a recently proposed benchmark problem. The benchmark, described in detail in Zoppi et al. (2019) and Gallenmüller et al. (2018), is to remotely control a two-wheeled inverted pendulum robot (TWIPR) over a wireless network, see Fig. 1. To make the benchmark inexpensive and easily reproducible, the widespread platform LEGO Mindstorm EV3 is used to realize the robot. All details regarding plant and controller are publicly accessible at https://github.com/tum-lkn/iccps-release.
The body of the robot is mounted on two wheels, on which two DC motors are splined. The control objective is to keep the robot in a vertical upright position while undergoing a predefined benchmarking experiment. To the best of our knowledge, the design of a networked controller for a TWIPR has not been addressed yet. Among other authors, Pathak et al. (2005) stabilized a TWIPR using local, i.e., non-networked, control. Ananyevskiy and Fradkov (2017) proposed a control strategy over internet for coordinating oscillations of a group of pendula and validated it experimentally using LEGO Mindstorm NXT. Synchronization was not always achieved, and the controller did not compensate for lost communication packets.
In the current paper we design a networked controller for a TWIPR by using two previously suggested strategies (cf. Hespanha et al. (2007)): (i) we deliberately extend the actuation delays of the NCS in order to make them constant and deterministic; (ii) a sequence of future control inputs is computed from a sequence of model-based state predictions and is sent to the robot via the wireless network. If a control packet is lost, the robot uses the last received sequence of control inputs and applies the input corresponding to the current instant.
The remainder of this paper is organized as follows: in Section 2, a discrete-time linear dynamical plant model is presented and the available sensor information is described. Section 4 introduces a local controller that is used as a baseline for the networked controller developed in Section 4. The performance of both controllers is compared in Section 5.
In the following, the set of nonnegative (positive) integers is (). The set of real numbers is . The set of nonnegative (positive) real numbers is denoted (). Given a time-dependent real-valued signal , its first and second derivative with respect to time are denoted and . Given a vector , , its transpose is , while the element in position is . Given a matrix , its i-th column, with , is .
2 Problem Description
2.1 Dynamical Model
Fig. 2 sketches the robot from the side and the top views and illustrates the sign convention; the depicted kinematic variables are given in Table 1. Throughout this section, the focus is not on the derivation of a dynamic model for the system, since this has been exhaustively addressed elsewhere, e.g. the nonlinear dynamic model of a TWIPR can be found in (Kim et al., 2005, pg. 33). With the model of the TWIPR at hand (Kim et al., 2005, pg. 33), let
[TABLE]
be the state vector and the input, where () is the voltage applied to the left (right) DC-motor at time . The nonlinear continuous-time model is
[TABLE]
and the linearized continuous-time dynamics (around the origin) is
[TABLE]
Matrices and are given in (Kim et al., 2005, pg. 38). Since sensors and controller are implemented based on a digital scheme, the system is discretized using the Forward Euler Method with a discretization step , which yields the discrete-time linear system, ,
[TABLE]
where , and
[TABLE]
Finally, for the specific hardware under consideration, a backlash occurs between each motor shaft and the respective wheel (see Nordin et al. (1997)), which is not captured by the model. We define a nonlinear function to model the impact of the backlash on the input to the motors. Then, (4) is rewritten as
[TABLE]
Further details are in (Nordin et al., 1997, pg. 55).
2.2 Sensors and Measurements
The robot is equipped with a single-axis digital gyroscope (mounted on the body) measuring the body pitch rate. Two digital encoders are splined on the two motor shafts and measure the left and the right motor angles. Let, be the measurement coming from the gyroscope, and let be the measurement bias of that gyroscope, which is determined from quasi-static measurements using standard bias estimation approaches, see Tin Leung et al. (2011). Finally, let be the left and right encoder measurements, respectively.
The states of system (4) can be estimated as follows:
[TABLE]
where , , , and . In the following, in order to avoid confusion between measured states and variables, the measured state vector at time will be denoted by .
3 Local Controller
3.1 Controller Design
Due to limited available input voltages, we choose a linear quadratic regulator (LQR) design, which allows us to balance between performance and control effort, see Aström and Murray (2010). The feedback control law uses the estimated state from Section 2.2, is based on (4), and has the form, ,
[TABLE]
where is the control gain matrix obtained by minimizing the cost function
[TABLE]
with and given111, . The control gain is obtained by solving the Algebraic Riccati Equation associated to (13), see (Magni and Scattolini, 2014, p. 171). This controller is responsible for keeping the TWIPR in its upright pose despite disturbances.
3.2 Benchmarking Experiment
In order to facilitate the comparison of different control strategies, benchmarking experiments are defined. The robot body is lifted manually, and measurements (6)–(11) are started. As soon as the measured pitch angle reaches a neighborhood of [math], say at discrete-time step corresponding to time , the loop is closed and (12) is applied for all . Results from one trial are presented in Figure 3. The local controller assures that all states remain close to zero.
In order to test a more dynamic and challenging scenario, we also implement the tracking control law
[TABLE]
where is a given reference state trajectory. We use the same gain as for the stabilitation problem, although we should note that it is no longer an optimal feedback gain for the reference tracking task (Anderson et al., 1972, pg. 247). In order to obtain smooth and approximately realizable reference trajectories , we choose low-pass filtered step changes for and , as illustrated in Figure 4, and determine and by integration and differentiation, respectively. Finally, and are chosen constantly zero. Note that a non-zero pitch angle trajectory is required if the robot accelerates and decelerates. However, for the slowly varying velocity reference signals considered in this contribution, zero is a close approximation of that trajectory.
Results from an exemplary run of the experiment are depicted in Figure 4.
The sampling time of could seem large. However, it is required by the employed platform, which does not exhibit state-of-the-art performance. Moreover, future work will study groups of TWIPRs communicating over the channel with orthogonal channel access methods, e.g. TDMA (Time Division Multiple Access), for which this large sampling time is required.
4 Wireless Controller
4.1 Networked Control System Architecture
A NCS is mainly composed of three parts, as illustrated in Figure 1: (i) the plant, in this case the TWIPR, equipped with sensors and actuators. It typically has limited computational power, which is often not enough for hosting the controller on-board; (ii) the communication network, in this case a wireless interface employing the W-LAN protocol; (iii) the controller, in this case executed on a computer with higher computational power.
Data transmission uses W-LAN according to IEEE 802.11g (WiFi) with a transfer rate of 54 Mbit/s in infrastructure mode. Both robot and controller are directly connected to the wireless access point, the controller via the Ethernet adapter Intel I219-LM, the Robot via the wireless dongle Edimax EW-7811Un. The WiFi operates indoor in the 2.4 GHz ISM band, which is shared between multiple wireless technologies such as other WiFi standards and Bluetooth, and employs UDP as a transport protocol. A realistic interfered office environment is used, where several neighboring WiFi networks are coexisting. In this environment, we observed random packet losses due to ”short-time” link failures, which could not be compensated on the communication layer. Zoppi et al. (2019) contains an exhaustive statistical analysis of communication delays for this experimental setup.
At this point, two considerations are derived: (i) experimentally, no packets sent by the robot are lost; this means that the random phenomenon of packet loss occurs only to packets sent by the controller (this asymmetry can be seen in Fig. 1); (ii) all transmitted packets eventually reaching the robot with delays above a given threshold are considered as lost.
4.2 Timing Scheme
Figure 5 shows a timeline of the k-th control cycle. The following times and delays between these steps will be of major relevance in the upcoming sections:
- •
: the robot reads from the sensors. In this moment, the control cycle starts;
- •
: the controller receives the transmitted packet;
- •
: the robot receives the control input;
- •
: time between data reception and actuation;
- •
: instant when the robot applies the desired input to the motors; is the actuation delay.
From a control perspective, besides dropped packets from controller to robot, also actuation delay must be taken into account, i.e. the control input applied at is computed based on data measured at . This actuation delay is time-variant, since, in general, , .
4.3 Wireless Controller Design
Control packets reach the robot before an arbitrary timeout if
[TABLE]
In the following, if (15) does not hold, the packet is acknowledged as lost. Define a boolean variable that indicates packet loss:
[TABLE]
So, packets are lost either because never delivered (trivial) or because they would arrive too late at the receiver. To avoid non-deterministic uncertainties resulting from the time-variance of the actuation delay, we deliberately dilate (by putting a waiting time before the processed signal is applied to the motors) such that
[TABLE]
In any where (15) holds, by (17), . This strategy leads to a larger but constant actuation delay.
We compensate this delay by model-based prediction. Define the following inputs, :
[TABLE]
where is the ideal control input based on states at time of actuation and is a control input, computed based on a state that is predicted from the last available measurement at , i.e. . The state is predicted by integrating the nonlinear dynamics (2):
[TABLE]
In case (15) does not hold, we use model-based prediction to compensate packet loss. The controller does not know a-priori whether a packet will be lost. Therefore, it calculates and sends a list of control inputs, which are computed based on model-based state predictions of the next steps, where is chosen larger than the expected maximum number of packet losses. Formally, , the controller computes and sends the control input matrix
[TABLE]
where, ,
[TABLE]
with, ,
[TABLE]
If the computation time at the remote controller is such that (15) is in general violated, predictions (18) and (20) can be computed using the linearized discrete-time system (5), which is computationally faster but less accurate. The control matrix sent to the robot would, then, be
[TABLE]
where,
[TABLE]
with
[TABLE]
and , . Then, the most recent control matrix is
[TABLE]
and the TWIPR applies the control input
[TABLE]
with
[TABLE]
being the number of sampling periods that have passed since the last control matrix was received.
The described Networked Control System is implemented with predictions based on the linearized model (5).
4.4 Experimental Evaluation of the Networked Controller
First, we analyze stability of the proposed NCS and robustness with respect to packet losses. Results are given in Figure 6. Just as the local controller, the networked controller assures that the states remain stable but with clearly larger deviations from zero, at least for the wheel angle.
The proposed networked control strategy is found to exhibit robustness against up to 3 sequential packet losses, i.e. the controller can maintain stability for at least without measurement updates.
The reference tracking experiment described in Section 3.2 is repeated with the proposed networked controller. Result of one trial are given in Figures 7 and 8. Despite two consecutive double packet loss at , measurement noise, and actuation delay of , the robot does not lose stability.
5 Performance Comparison
We compare the performance of the local and the networked controller for the reference tracking experiment. The local controller has a negligible delay, whereas the networked controller has an actuation delay of (up to in case of packet loss). Performance degradation due to these delays is evaluated by three root mean squared error (RMSE) indices defined by
[TABLE]
where . These RMSE indices are averaged over a set of ten trials. The results are given in Table 2. While differences in - and -movement errors are marginal, RMSEΘ is almost twice as large for the networked controller than for the local controller, although still small in magnitude.
6 Conclusion
In this work, common networked control strategies have been implemented for stabilizing a TWIPR, built with an inexpensive and highly reproducible platform (LEGO Mindstorm EV3). The networked controller is able to stabilize the TWIPR over a wireless channel despite time-varying delays and packet loss. Benchmark experiments have been defined, so that local and remote controllers could be compared.
Future work will consider both practical and theoretical advancements: on one hand, custom hardware is being developed. On the other hand, aiming at improving performance shown in Section 5, both a state observer and an optimal control strategy for reference tracking (computationally more expensive than the solution here adopted) will be employed.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Ananyevskiy and Fradkov (2017) Ananyevskiy, M.S. and Fradkov, A.L. (2017). Control over internet of oscillations for group of pendulums. In Dynamics and Control of Advanced Structures and Machines , 205–213. Springer.
- 2Anderson et al. (1972) Anderson, B., Moore, J., and Molinari, B. (1972). Linear optimal control. IEEE Transactions on Systems, Man, and Cybernetics , (4), 559–559.
- 3Aström and Murray (2010) Aström, K.J. and Murray, R.M. (2010). Feedback systems: an introduction for scientists and engineers . Princeton university press.
- 4Bemporad et al. (2010) Bemporad, A., Heemels, M., and Johansson, M. (2010). Networked control systems , volume 406. Springer.
- 5Gallenmüller et al. (2018) Gallenmüller, S., Günther, S., Leclaire, M., Zoppi, S., Molinari, F., Schöffauer, R., Kellerer, W., and Carle, G. (2018). Benchmarking networked control systems. In 2018 IEEE Workshop on Benchmarking Cyber-Physical Networks and Systems (CPS Bench) , 7–12. IEEE.
- 6Hespanha et al. (2007) Hespanha, J.P., Naghshtabrizi, P., and Xu, Y. (2007). A survey of recent results in networked control systems. Proceedings of the IEEE , 95(1), 138–162.
- 7Ishii (2008) Ishii, H. (2008). H ∞ \infty control with limited communication and message losses. Systems & Control Letters , 57(4), 322–331.
- 8Kim et al. (2005) Kim, Y., Kim, S.H., and Kwak, Y.K. (2005). Dynamic analysis of a nonholonomic two-wheeled inverted pendulum robot. Journal of Intelligent and Robotic Systems , 44(1), 25–46.
