{'fraction_non_alphanumeric': 0.027190332326283987, 'fraction_numerical': 0.005886029794770289, 'mean_word_length': 4.448070374574347, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Design, modelling and tests of a barycenter offset locomotion mechanism for cylindrical robots

—Various designs of spherical robots using barycenter offset mechanisms were previously reported. This kind of robots offers advantages such as turning in place or moving in any direction at any time. Yet, the approaches resulting in a balanced robot, which could roll with reduced energy costs once accelerated, are scarce. We introduce a novel robot of this type. The feasibility of the approach is veriﬁed on a cylindrical robot. This paper presents an open-source, remotely controlled, robotic cylinder. The robot uses a speciﬁcally designed mechanism to displace a mass in its center, which causes the cylinder to roll forwards or backwards. The movement characteristics of the cylinder, as well as the mathematical and physical limitations of the mechanism were studied. An intuitive user interface allows the robot to be controlled through WiFi. This robot was manufactured only with readily available and inexpensive materials, which would make it a suitable platform for education, typically in the ﬁelds of physics and engineering.


I. INTRODUCTION
In the last twenty years, research in the field of spherical robots was actively undertaken [1]. This growing interest can be easily explained by the variety of applications such robots offer. Indeed, they can be used instead of regular wheels [2], or as standalone robots for surveillance and exploration [3]. Spherical robots are particularly interesting for their ability to move in any direction at any time.
However, the mechanisms used in these robots often consist of an internal drive mechanism, whose wheels lay on an outer, rigid shell [1]. More recently, another approach was developed, which consists in finding a way to displace the center of mass of the robot, hence inducing movement. These mechanisms were previously referenced as "gravity offset mechanisms" in the literature [4]. Two common designs were previously documented. Firstly, a pendulum based design, which consists of an actuated pendulum fixed on the diameter of the sphere. To turn, the robot uses a mass fixed on the pendulum, which can be titled to either side, commonly using a servo motor [5]. This locomotion mechanism is interesting because it results in an underactuated robot, which implies a reduced amount of electronics. The other approach consists in having four masses which move radially along axes [6]. Depending on the placement of the masses, the sphere is able to move in any direction at any time. With this work, a novel possibility to induce movement to a sphere is explored. The focus is put on the 2D version for prototyping purposes, a cylinder, because the manufacturing process is simpler. The goal is therefore to design and build a remotely controlled cylinder that uses a gravity offset mechanism which could be extended to a sphere. Moreover, the actual prototype of the robot is built using only easily available materials and technologies. In this way, the robot can be used as a new education platform. Topics such as physics electronics and mechanics could be taught using it. To ensure an easier replication of the robot, all the results were published as open-source on GitHub [7] [8].
Firstly, an approach to displace a mass inside the cylinder is designed. The criteria on which the decision for the final mechanism is made are: price, weight, size, energy consumption and availability. Indeed, the philosophy underlying the project requires the use of technologies that allows other people to easily recreate this robotic cylinder.
The design that matches those requirements consists of three servo motors placed on an equilateral triangle (refer to Fig. 1). The motors are connected to the mass with rigid bars, and their coordinate movement leads to place the mass at a desired position. While two motors would have been sufficient, using three has many advantages. It ensures a symmetrical distribution of the mass around the cylinder, which lets the cylinder roll freely with reduced energy costs when the mass is in the center. Additionally, it cuts down the mechanical stress of the motors and produces a greater torque.
The paper is organized in four sections, a theoretical section introducing the mathematical model of the mechanism is followed by an experimental section describing the building process. The third section shows the experimental results, which are discussed in a fourth and final section.

II. MATHEMATICAL MODEL
Once the approach is chosen, the formula f linking the angles of the three servo motors to the position of the mass in the center is expressed. This formula is necessary to accurately position the mass and induce movement. Its implementation is discussed in the next section. Fig. 2 shows a scheme of the problem to be solved, whereas Table I lists all the variables that are used in further calculation.

A. Geometrical model
To demonstrate the feasibility of the idea and gain insights about the behavior of the mechanism, a parametric and animated model is built using the free mathematical tool Mass that needs to be moved on the circle c. R Distance between the servo's axis and G. d Distance between the end of the servos arm and m. s Length of the servos arms. r Radius of the circle c. P Position of the mass. x, y Coordinates of the position of the mass. θ Angle between R, G and P . Q End of the arms of the servo motor. a, b Coordinates of Q. α Angle of the servo motor.  Values obtained for the angle α of one of the servo motors depending on the angle θ that expresses the mass' position. Variables s and R are constant, r is varied and r = s. [10] GeoGebra [9]. In this model, the angles of the servo motors are driven by the position of the mass. Variables s, r, R and d can be changed as well. The angles of the three servo motors are exported and plotted in order to see the physical limitations of some parameters. For instance, Fig. 3 plots the angle α of the servo motor depending on the position θ of the mass on a circle, when the servo arm's length r is varied.
Based on this simple model, the main findings are: • Since the mechanism is symmetrical, the angles of the motors at a given moment are f (θ), f (θ + 120°) and f (θ + 240°). • Given that r = s, the maximal angular speed of the servos tends to infinity when r = R. This is shown in Fig. 3. The ratio r R is therefore limited by the servo motors maximal speed in real-life applications. • The maximal possible value of r is 1 3 R. If this limit is crossed, the servo motors axes exceed the perimeter of the cylinder at some point of their trajectory.

B. Parametric model
To solve this problem, variable a is first expressed in terms of the constants x, y, d, R and s, because it is then easy to determine α using a cosine function. Based on Table I and Fig. 2, as well as the vector properties, the magnitude of vector d is given by: On the other hand, using the Pythagorean theorem, we can express b as the following.
Thus, is eventually solved for a, and yields to (4). This equation shows that the angle α of the servo motors is a function of the coordinates x and y of the mass, the distance R between the servo axis and the center of the cylinder, the length s of the servo arm and the length d of the rigid bar connecting the mass to the end of the servo motor arm. Where: It is demonstrated experimentally that the correct solution for a between the two possibilities is given by: Finally, to obtain the servo motor angle α, we have the following relationship: This formula is proved to be correct after it was implemented in the software and tested.

A. Mechanics
After some research, it is concluded that the easiest way to obtain a cylinder is to have two rings of the same dimensions connected with rigid bars. The final 2D model of the rings is depicted in Fig. 4. Efficiency is a main preoccupation, which is why any unnecessary material on the rings is removed, in order to reduce the overall inertia of the cylinder, and therefore allow it to output greater accelerations. For the same reason, the back ring has a perforated platform in its center which allows to easily fix the electronics. This configuration ensures a more balanced robot.  The mass in the center is made out of brass, for it has a high density and is easy to process. On another hand, the cylinder rings are made of 6 mm thick acrylic glass, which is commonly available and can be laser-cut easily. The mass to servo motor connection is designed specifically for this application, for the purchasable servo arms are not sufficiently long. The parts of the servo to mass connection are shown in Fig. 5.
To ensure that the cylinder's center of mass is at its geometrical center, three small brass masses are added in the radial slots on the back ring (see Fig. 4), which can be fixed at different distances from the center of the cylinder. This allows for instance to compensate for the slightly offcentered and asymmetrical electronics.

B. Electronics
The selection of the most suitable controller is based on two criteria: it has to be as light as possible and allow remote control over WiFi. A Raspberry Pi Zero W is finally used, which memory and speed are sufficient, and that can appear as a WiFi hotspot once properly configured [11]. This choice brings up many challenges in terms of real-time programming, that are solved using existing JavaScript (JS) libraries. In addition, this controller ensures that a single programming language, JS, can be used on all levels of the project: implementation of the mathematical resolution, motion control and User Interface (UI).
To determine the speed and direction of the cylinder, a gyroscope coupled with an accelerometer is used. That solution is a common and inexpensive technology adapted to this project since it provides the orientation and the acceleration of a device along the Cartesian space dimensions. Many circuits of this kind are available online, but the MPU5060 is preferred for its low price (approx. 2 USD), precision and small size [12]. On the other hand, a PCA9685 is used for the control of the servo motors, which is an I 2 C controlled Pulse Width Modulation (PWM) driver [13]. MG995 high speed servo motors with metal gears are used to optimize performance, for they present a high stall torque (9.4 kg/cm at 5 V) to weight (55 g) ratio [14]. Finally, three AA batteries are used as a power supply, which provides an operating current of approx. 4.5 V and an estimated autonomy of approx 4 hours.
A dedicated Printed Circuit Board (PCB), that acts as a shield for the Raspberry Pi is developed. The essential I 2 C peripherals, an I 2 C motor driver and an IMU, are included on the board. Having this extension board ensured a reduced clutter and a higher reliability, compared to a breadboard and wires setup.

C. Programming
JavaScript ECMAScript 6 is selected as the main programming language. Consequently, a specific JavaScript engine, Node.js, is used, which embeds the V8 JS engine and allows to execute JS scripts from the terminal. Moreover it allows to use easily hundreds of thousands packages 1 . A bottom-up approach is chosen for coding: small pieces of program responsible for specific functions are written, tested, and then assembled into higher level structures. This course of action has the advantage of providing a well-structured code, easy to test, debug and maintain. Furthermore, the various parts are not specific to the application and can be reused in other projects. The control of the peripherals is based on the Johny-Five library [16]. This library wraps the I 2 C communication with the IMU and the servo motors controller in real time, to provide simple event based functions.
Two main functionalities are implemented for the robot. Firstly, to achieve fluid backwards and forwards motion, the mass m is kept on a line through the center of the cylinder and perpendicular to gravity thanks to the IMU orientation data. The mass can then be moved away from the center of the cylinder in one direction or the other, varying radius r, which ensures a maximal acceleration backwards or forwards. Additionally, this should provide a constant acceleration, since the relative height of the mass to the ground is constant, which leads to a constant torque of the mass on the cylinder. Experiments are carried out to verify this assertion. The results are presented in subsection IV-C. The second functionality implements a PID algorithm to stabilize the robot. In this mode, the cylinder can remain balanced on a slope that varies between 0°and 3°. The PID coefficients are set using a trial and error method, in order to visually minimize oscillation.
The cylinder can be controlled from a Terminal using an ssh connection. Yet, implementing a UI that is accessible to everyone seemed to be an interesting addition. Therefore, a static control web page using basic CSS and HTML is coded. Standard HTTP connections can not be used for this interface, since parameters modified by the user have to be sent to the robot in real-time. Therefore, the decision is  made to use WebSockets 2 , a JS library which provides a bi-directional, event-based message handler that allows to interact constantly from client to server and inversely [17].

A. Prototype specifications
The robot is made using only commonly available materials and technologies. The robot has a total mass of 1.7 kg, whereas the mass that is moved weights 150 g, which represents less that 9% of the total mass. The final prototype that is built has an acrylic glass structure with a diameter of 32 cm and a width of 15 cm. A dedicated extension board includes a driver for four servo motors and a 6-axis Inertial Measurement Unit (IMU). The cylinder can be controlled remotely over WiFi and can roll forwards and backwards with a maximal speed of 1 m/s, stop and keep itself balanced on a gentle slope of max. 3°. Fig. 6 shows a picture of the prototype, whereas Table II lists

B. Motion of the mass
The last cylinder's prototype has a maximal radial displacement of the mass of 40 mm. To verify the precision of the mass' movement, long-exposure pictures of the cylinder are taken, with a small LED module fixed to the mass. That way, the trajectory that the mass follows can be observed. One of these tests is shown on Fig. 7. The image illustrates how precise the movement is, since the spiral maximal diameter is only 8 cm. Also, it appears that, with the parameters used, the overall movement of the mass is less circular when it is moved along a smaller radius. Based on these figures, the incertitude on the mass position can be estimated to 2 mm.

C. Motion of the cylinder
Experiments are carried out to quantify the movement of the cylinder depending on the radius on which the mass in the center moves. The experiment is performed on a tiled floor. Radius r is varied, using values from 10 mm to 40 mm, with an increase of 5 mm every time. We used the LoggerPro software to analyze the data [18]. Indeed, this software allows to import movies and to place points on the images at different times. Therefore, the position of an object depending on time can be inferred. Charts are made based on the exported data. Fig. 8 confirms that there is a linear phase in the speed of the cylinder, which implies a constant acceleration, as predicted in subsection III-C. Yet, these results also fit a logarithmic curve very well, especially the final values. This can be explained by the fact that the cylinder reaches a limit speed that is caused by the servo motors' reaction time.

V. DISCUSSION
In general, the results obtained in this research are convincing. Indeed, all the initial goals are reached: the cylinder can roll forwards and backwards with a decent speed, and it Fig. 8. Speed of the cylinder versus time for different mass' radii with linear trendlines. [10] can be easily controlled remotely using an intuitive UI. Also, the device is reliable and has sufficient autonomy for regular use. Furthermore, the control of the mass position is accurate enough, since its incertitude is of about 2 mm, as shown by Fig. 7. However, further improvements can be made: the acrylic glass rings can be optimized to be lighter and the mass can be heavier, which might increase the reactivity. Also, it would be interesting to make an hermetic version, which would be resistant to dust and water. In regard to mechanical implementation of the concept, one thing that can be enhanced as well, would be to use the electronics and the batteries as the mass in the center, which would optimize the inertia. Additionally, we have proved that pure JS can be used to program the back-end functionalities and the UI of a robot with real-time requirements. The approach that we describe could potentially be extended to a spherical robot, where four servo motors would be placed on the vertices of a tetrahedron. It is clear that compared to a standard pendulum based approach, the mechanism described in this paper can seem unnecessarily complex. However, it offers a significant advantage: the possibility to place the mass in the center of the cylinder and therefore have a symmetrical distribution of the mass around the center, which lets the cylinder roll with reduced energy costs. The same feature was achieved by the robot presented in [3], where four masses are moved radially in the sphere. Symmetry has a second advantage, as pointed out in [4], which is that the mathematical model for the motion of the robot is less complex than in an asymmetrical robot. Additionally, such a robot can potentially roll down slopes faster, since it is not limited by the motors having to spin accordingly.
Looking further, other applications can be considered. For instance, the cylinder's concept can be adapted to personal transportation. One possibility would be to make a humansized cylinder in which the person would act as the mass in the center (as shown in Fig. 9). Finally, connecting two of these cylinders together would allow to move on a plane and turn in place (refer to Fig. 10). Such a system would actually be conceptually similar to the robot described in [19], which uses two pendulums moving in opposite directions to turn in place. This kind of mechanism can also be used instead of regular wheels in systems that require stabilization.

VI. CONCLUSIONS
We demonstrate that three servo motors can be used to displace a mass inside a cylinder and accurately control its motion. The presented robot is low-cost and uses easily available materials. It can therefore be used to educate students about physics and robotics. Moreover, the presented approach can be extended to a sphere, in the case where four servo motors would be placed on the vertices of a tetrahedron. This would result in a truly holonomic robot, since a torque could be induced to the sphere in any direction at any time. Additionally, the approach would have advantages that other methods lack, as the possibility to place the mass in the center of the sphere. This configuration results in a symmetrical robot, which can roll freely with minimal energy costs.