<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Real2Sim2Real Transfer for Control of Cable-driven Robots via a Differentiable Physics Engine</title></titleStmt>
			<publicationStmt>
				<publisher>IEEE</publisher>
				<date>10/01/2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10471898</idno>
					<idno type="doi"></idno>
					
					<author>Kun Wang</author><author>William R Johnson III</author><author>Shiyang Lu</author><author>Xiaonan Huang</author><author>Joran Booth</author><author>Rebecca Kramer-Bottiglio</author><author>Mridul Aanjaneya</author><author>Kostas Bekris</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Tensegrity robots, composed of rigid rods and flexible cables, exhibit high strength-to-weight ratios and significant deformations, which enable them to navigate unstructured terrains and survive harsh impacts. They are hard to control, however, due to high dimensionality, complex dynamics, and a coupled architecture. Physics-based simulation is a promising avenue for developing locomotion policies that can be transferred to real robots. Nevertheless, modeling tensegrity robots is a complex task due to a substantial sim2real gap. To address this issue, this paper describes a Real2Sim2Real (R2S2R) strategy for tensegrity robots. This strategy is based on a differentiable physics engine that can be trained given limited data from a real robot. These data include offline measurements of physical properties, such as mass and geometry for various robot components, and the observation of a trajectory using a random control policy. With the data from the real robot, the engine can be iteratively refined and used to discover locomotion policies that are directly transferable to the real robot. Beyond the R2S2R pipeline, key contributions of this work include computing non-zero gradients at contact points, a loss function for matching tensegrity locomotion gaits, and a trajectory segmentation technique that avoids conflicts in gradient evaluation during training. Multiple iterations of the R2S2R process are demonstrated and evaluated on a real 3-bar tensegrity robot.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>Tensegrity robots are actuated systems composed of rigid struts (rods) and flexible elements (cables) connected to form lightweight, deformable structures. Their natural compliance makes them adaptable and safe robots that are well-suited for many applications, such as manipulation <ref type="bibr">[1]</ref>, locomotion <ref type="bibr">[2]</ref>, morphing airfoils <ref type="bibr">[3]</ref>, and spacecraft landing <ref type="bibr">[4]</ref>.</p><p>At the same time, tensegrity robots are difficult to accurately model and control due to their many degrees of freedom (DoF) and complex dynamics <ref type="bibr">[5]</ref>. The difficulty in modeling has led some researchers to propose modelfree solutions for learning control <ref type="bibr">[6]</ref>, but these strategies still encounter challenges since they require a large amount of training data, and collecting trajectories from tensegrities is time-consuming, cumbersome, and expensive. The authors have previously introduced a differentiable, but modular and explainable, physics engine <ref type="bibr">[7]</ref>- <ref type="bibr">[9]</ref> as a dataefficient tool to identify physical parameters and develop This work has been supported by NSF Robust Intelligence award 1956027. The opinions expressed here are those of the authors and do not reflect the positions of the sponsor. 1 Computer Science, Rutgers University, NJ 08901, USA. Email: {kun.wang2012, shiyang.lu, mridul.aanjaneya, kostas.bekris}@rutgers.edu. 2 Mech. Eng. &amp; Material Sc., Yale University, New Haven, CT, USA. Email: {will.johnson, xiaonan.huang, joran.booth, rebecca.kramer}@yale.edu. locomotion policies for tensegrity robots. Yet, the transfer of simulated policies to real hardware is typically impeded by the so-called simulation-to-reality (sim2real) gap <ref type="bibr">[10]</ref>, <ref type="bibr">[11]</ref>. Sim2real transfer can be improved by tuning the simulation to minimize differences between predicted and real robot trajectories for the same controls.</p><p>To overcome the sim2real gap, many methods are applied <ref type="bibr">[11]</ref>- <ref type="bibr">[15]</ref>, however, the robot is assumed to be rigid <ref type="bibr">[16]</ref> as a prior. Systems that include compliance, such as tensegrity robots, are less frequently targeted, as compliance makes closing the sim2real gap more challenging. Only recently have Real2Sim2Real (R2S2R) frameworks been developed that focus on deformable elements (e.g., a system that manipulates deformable cables <ref type="bibr">[17]</ref>).</p><p>This work applies the principle of R2S2R to the control of deformable robots composed of both rigid and soft elements. More specifically, this work introduces an R2S2R pipeline for tensegrity robots, through which a policy learned on a differentiable engine is transferred to a 3-bar tensegrity robot (Fig. <ref type="figure">1</ref>) by first training the engine with data from the real robot. This paper contributes: &#8226; A complete pipeline for identifying the parameters of a differentiable simulator from real tensegrity robot trajectories, generating locomotion policies in the simulator, and transferring the policies back to the real robot. &#8226; A method to compute non-zero gradients at contact points to enable efficient learning of contact parameters in the optimization step of the engine's identification process. &#8226; A loss function and trajectory segmentation strategy to avoid conflicts in gradient direction during training under noisy observations. Non-convex trajectories lead to gradients with opposite directions at different time steps. Thus, the trajectory is segmented into convex segments to ensure the gradient directions computed are aligned.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. RELATED WORK</head><p>Sim2real transfer has been applied in autonomous underwater vehicles <ref type="bibr">[18]</ref>, drones <ref type="bibr">[19]</ref>, <ref type="bibr">[20]</ref>, muscles <ref type="bibr">[21]</ref>, quadruped robots <ref type="bibr">[22]</ref>, soft robots <ref type="bibr">[23]</ref>- <ref type="bibr">[25]</ref>, and grasping manipulators <ref type="bibr">[26]</ref>. To the best of the authors' knowledge, this is the first work that mitigates the sim2real gap for a tensegrity robot.</p><p>Differentiable physics has been actively applied to system identification. Compared to artificial evolution approaches (e.g., genetic algorithms, particle swarm optimizations, and covariance matrix adaptation evolution strategies) and domain-randomization methods, gradient-based methods like differential physics are data-efficient and can lead to faster convergence for complex robot systems <ref type="bibr">[27]</ref>, <ref type="bibr">[28]</ref>. We previously developed a differentiable engine for tensegrity robots <ref type="bibr">[7]</ref>- <ref type="bibr">[9]</ref>, although prior work has been limited to only sim2sim transfer and never demonstrated on a real tensegrity robot.</p><p>Prior work on tensegrity locomotion <ref type="bibr">[29]</ref>- <ref type="bibr">[31]</ref> has achieved complex behaviors, sometimes on uneven terrain, using the NASA Tensegrity Robotics Toolkit (NTRT) simulator <ref type="bibr">[32]</ref>, which was manually tuned to match a real platform <ref type="bibr">[33]</ref>, <ref type="bibr">[34]</ref>. Many prior approaches use reinforcement learning (RL) to learn policies given sparse inputs, which can be provided by onboard sensors <ref type="bibr">[30]</ref> and aim to address the large data requirements of RL <ref type="bibr">[31]</ref>, including by training in simulation. Simulated locomotion, however, is hard to replicate on a real platform, even after hand-tuning, which emphasizes the importance of training a simulator that can produce policies that can be transferred to a real system. A website accompanying this paper with videos and additional evaluation is available 1 .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. ROBOT DESIGN</head><p>This work demonstrates and evaluates the R2S2R pipeline on the untethered 3-bar prismatic tensegrity robot shown in Fig. <ref type="figure">1</ref>. The tensegrity robot has a rod length of 36 cm, and it is driven by motors that extend and contract its cables to shift its center of mass. The six short cables (three on each side) are actuated by the motors while the three longer tendons in the middle are passive elastic elements. These passive tendons double as stretch sensors, and there are also six sensor tendons in parallel with the six actuated cables. The design and characterization of the stretch sensors are detailed in previous work <ref type="bibr">[35]</ref>. Each sensor is calibrated individually by fitting a linear model to map capacitance measurements to corresponding lengths <ref type="bibr">[36]</ref>. The stretch sensors are used both for feedback control and for pose estimation, as described in section IV-B.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. REAL2SIM2REAL PIPELINE</head><p>The following discussion describes the various components of the proposed R2S2R pipeline as outlined in Fig. <ref type="figure">2</ref>. 1 An appendix with addtional material and accompanying multimedia can be found at: <ref type="url">https://sites.google.com/view/sim2real</ref> Fig. <ref type="figure">2</ref>: R2S2R pipeline. A randomly generated policy is executed first on the robot. An overhead RGB-D camera captures the trajectory to estimate the robot's state at each frame. Internal robot parameters are then identified with a differentiable physics engine given robot states and offline measurements. Given the identified model, new policies are generated and executed on the robot. The process can be repeated to further close the sim2real gap. Red blocks correspond to real-robot tasks; blue blocks correspond to simulation tasks. Labels correspond to sections in the text.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Random Policy and Real World Execution</head><p>The first step in the R2S2R pipeline is to generate a random policy and execute it on the real robot. The policy is defined as a list of robot cable lengths (0 means fully contracted and 1 means fully extended) that represent a series of target robot shapes. To transition between these high-level shapes, a PID controller extends or contracts the actuated cables by sending low-level control signals based on the feedback from the robot cable length sensors until the robot reaches the next target shape. All policies start from the robot rest state where the robot sits on the ground with the six actuated cables fully extended, as shown in Fig. <ref type="figure">1</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. State Estimation</head><p>The next step is to estimate the robot states, i.e., the position and orientation of each rod, at each time frame. We adopt a state estimation method <ref type="bibr">[37]</ref> designed for tensegrity robots. This method tracks the 6-DoF pose of each rod given a multi-modal input sequence of RGB images, depth images, and measured cable lengths from the onboard stretch sensors. The tracking method incorporates a variety of physical constraints, and it performs state estimation with high accuracy and robustness to self-occlusions. Further, RANSAC <ref type="bibr">[38]</ref> is used for ground detection so that contacts between end caps and the ground could be found(Section IV-D). </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Offline Robot Measurements</head><p>Physical parameters inside a simulator (e.g., mass, radius of the end caps, lengths of the rods, inertia tensor, stiffness coefficient, coefficient of friction, etc.) are key to modeling a real robot with high fidelity. However, identifying all of these parameters in one optimization is challenging. Instead, we measure some of these parameters offline and use them as inputs to the simulator. The measured mass and physical dimensions of the robot's components are listed in Fig. <ref type="figure">3</ref>. We also collected stiffness data for the long, passive tendons. A batch of 11 sensor tendons was measured on a materials testing system (Instron 3345) and fit with a third-order polynomial; we averaged the curves to input a single model into the simulator. The short, actuated cables are inelastic and modeled with high stiffness in the simulation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. System Identification</head><p>Physical parameters like the coefficient of friction and the speed of the robot's motors are difficult to measure offline. We have previously introduced a differentiable physics engine that uses gradient descent to identify system parameters from ground truth data <ref type="bibr">[7]</ref>- <ref type="bibr">[9]</ref>. However, this engine has been demonstrated only in simulation. This section describes the key differences that are necessary for system identification when a real robot is the target platform.</p><p>Some parameters, such as the cable attachment points, are not measured on the real robot but are crucial for the success of the simulation. The benchmark tensegrity simulator, NTRT <ref type="bibr">[32]</ref>, attaches cables at the ends of each rod, which simplifies the modeling process. However, this attachment strategy can lead the simulated robot to collapse and get stuck, unable to recover because all the actuated cables are coplanar, as shown in Figure <ref type="figure">4</ref> (Left). Although, this never happens to the real robot. Instead, we put the cable attachment points on the surface of the end caps. This setup prevents the collapsing and results in a more stable simulation, as shown in Figure <ref type="figure">4</ref> (Right). Note that these attachment points are not available in the observations; we implement a heuristic to infer their positions.</p><p>Each rod has six attachment points that are distributed symmetrically and evenly on two end caps. Attachment points are placed evenly at robot construction every 2&#960;/3 along the disk that is perpendicular to the rod. So it is possible to infer all attachment points from only one of them. At the robot rest state, one rod is in the center and the other two rods are on the side. Referring to Fig. <ref type="figure">5</ref>  Before each trajectory, the real robot resets itself to the rest state. We also reset the simulator to align with the real robot's initial state using the data collected at time t = 0, including both cable lengths and end cap positions. The initial pose generated by the state estimation algorithm (Section IV-B) may not have the robot perfectly resting on the ground due to the limitations of the sensors. Thus, we added gravity to the simulation to force the lowest end caps to come in contact with the ground.</p><p>After initializing the robot in simulation, we use the differentiable physics engine to identify the remaining physical parameters by performing gradient descent over a trajectory. To accomplish this task, we introduce a detachment method to compute nonzero gradients at contact points in order to efficiently learn contact parameters. Furthermore, the longhorizon trajectories and noisy observations from the real robot can lead to conflicts in the gradient direction. To combat these conflicts, we introduce the Key Frame Loss (KFL) function to segment the trajectories and compute losses at gait transitions. The detachment method and KFL are described in Sections IV-F and IV-G, respectively.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E. Developing Policies with Symmetry Reduction</head><p>Policy search on tensegrity robots is challenging due to combinatorial explosion since a sequence of control signals for each actuation cable with unknown time horizon are need to be discovered. Symmetry reduction has been developed for 6-bar tensegrity robots <ref type="bibr">[31]</ref>, <ref type="bibr">[39]</ref> to reduce the policy search space. Here, we apply symmetry reduction to our 3-bar tensegrity robot and combine it with hybrid control, where a high-level planner outputs the next target state and a low-level PID controller commands the cable lengths. To reduce the state space via symmetry reduction, we use a relabeling scheme defined with respect to the support triangle. We define the robot's state in Fig. <ref type="figure">6</ref> (Left) as the reference state, from which we can rotate the robot about its principle axis (the yellow line in Fig. <ref type="figure">6</ref>) by intervals of &#960;/6 to get 2 types of support triangles with opposite forward and backward directions. To map from one type of support triangle to the other, we rotate the robot by &#960; around the ground normal. After all rotations, we identify the mapping by computing the closest end caps to the reference state.</p><p>To generate gaits, i.e., time-ordered sequences of target poses, we conduct a graph search starting from the rest pose. These short gaits are mapped to long control policies via symmetry expansion. The nodes of the graph are robot poses represented by binary cable lengths (0 is retracted and 1 is extended), and the edges of the graph are cable controls (retract, extend, or hold). To limit the search space, we search to a depth of 4. The root node and leaf nodes are in the same rest pose where all cables are fully extended. We use the center of mass displacement as the reward function to generate one forward and one backward rolling gait. We use principal axis rotation as the reward function to generate clockwise and counterclockwise turning gaits.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>F. Detachment Approach for Contact Gradients</head><p>Impulse-based dynamics can't be directly applied to differentiable simulations due to a zero gradient issue <ref type="bibr">[40]</ref>. We propose a "detachment" method to obtain nonzero gradients for contact parameters e, &#181;. Passive forces, such as restitution and friction generate equal gradients in opposite directions, and gradients of these forces should not be backpropagated. The detach() function <ref type="bibr">[41]</ref> returns a new tensor detached from the computational graph, truncating the gradient propagation path.</p><p>Our detachment method can be applied to learn the restitution e and the force F = mg -N , which is shown in Algorithm 1. The difference of speed (&#8710;v) and position (&#8710;x) at time t + 1 and time t are detached to stop the passive force gradient from backpropagating. Otherwise, the gradient would be dx t+1 /de = 0.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Algorithm 1 Detachment Method for Restitution</head><p>The detachment approach is also used for learning friction parameters, as shown in Algorithm 2. We detach &#8710;v because the friction force is a passive force. We add the term -&#8710;p f + &#8710;p f .detach() to pass the gradient to &#181; in the case where there is only static friction. This term guarantees that &#181; can always be updated by the gradient, no matter if the initial &#181; is higher or lower than the actual one. The evaluation of the contact gradients and integration with Time of Impact (ToI) computations can be found in the accompanying appendix available online 1 .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>G. Key Frame Loss</head><p>System identification with long trajectories is difficult due to sensing noise and the non-monotonicity of trajectories.</p><p>As shown in Fig. <ref type="figure">7</ref>, the later observations are preferable to reduce the fitting error. Consider a simple example of a 1D trajectory from x = vt with length T . We are given two data points, p i = (t i , x i ) and p j = (t j , x j ). t i is close to 0 and t j is close to T . x i and x j have the same observation error relative to the ground truth. v is the parameter to estimate. Fig. <ref type="figure">7</ref> (Left) shows that the fitted line by p j is better than that by p i . Moreover, if x = f (t) is a nonmonotonic function, which is closer to reality for tensegrity robot trajectories, the fitted line by p i is worse as shown in Fig. <ref type="figure">7</ref> (Right). The trajectory of an end cap is noisier around time t = 0 because of the sudden motor activation. Note that the loss landscape may be non-convex due to contradictions in gradient directions, which can interfere with the optimization step. As shown in Fig. <ref type="figure">8</ref>, three losses yield opposite gradient directions. The multiple-shooting (MS) method has been applied for system identification with long trajectories <ref type="bibr">[42]</ref>. MS, however, needs full robot observations (i.e., positions and velocities of each end cap) to initialize the simulator. The defects may lead to contradicting gradient directions.</p><p>We introduce the Key Frame Loss (KFL) function, which splits the robot trajectory into a list of monotonic segments using unidirectional control intervals. We only consider the loss from the last frame in each segment. There are four departures of KFL from MS: 1) KFL only needs partial observation, i.e., it only requires end cap positions, not their velocities; 2) In the intermediate time steps, we do not aim to recover the simulator from the partially observed state since we do not know velocities; 3) The observation frequency does not have to be constant; 4) The shooting time window size is not fixed. Fig. <ref type="figure">9</ref> provides a comparison between MS and KFL.</p><p>The benefits of KFL are that it 1) eliminates the factor of time, 2) makes system identification robust to observation noise, and 3) ensures the correct gradient direction. This strategy can be generalized to other optimization problems using trajectories as ground truth data: trajectories can be split into monotonic segments, and the KFL can be applied at the final frame of each segment like in this work. To get the key frames, we split the trajectory into gaits for monotonic segmentation, as in Fig. <ref type="figure">10</ref>. In each gait, each cable follows only one of the possible controls: retracting, holding, or extending. These controls form a convex trajectory segment, avoiding the zig-zag trajectory that leads to contradicting gradients shown in Fig. <ref type="figure">8</ref>. The key frame (KF) is the last time step of each gait. Consider an example trajectory with three gaits, as shown in Fig. <ref type="figure">10</ref>. Both the ground truth (red) and the engine-predicted trajectory are split into three gaits. The corresponding gaits are remapped, and the KFs are the last time frames of their intersections. The KFL is the system difference, i.e., the sum of the differences in the positions of the end caps at the KF. We select the last time step because 1) the observation noise around the start of each gait may lead to worse fitting as shown in Fig. <ref type="figure">7</ref> and<ref type="figure">2</ref>) the gait transition point is where one gait is finished; however, whether the gait execution is complete is determined by measurements from the cable length sensors, so it is possible the gait transition occurs earlier or later than predicted, as shown by the gaps in Fig. <ref type="figure">10</ref>.</p><p>Losses from different gaits may have contradicting gradients. In Fig. <ref type="figure">10</ref>, the predicted trajectory takes less time for gait 0 and 2, but it takes more time for gait 1. These contradicting gradients can confuse the optimizer, as it will not know whether to speed up or slow down. Some possible reasons for these time differences are 1) The ground truth timestamp is noisy due to the limitations of the sensors;</p><p>2) The noisy cable length sensor readings lead to early or later gait transitions; 3) The starting states are not perfectly aligned; 4) There are gaps between the simplified physics engine and the real robot. To solve the problem, we adopt a mask filter to handle the contradicting gradients. Our heuristic states that the identified engine should execute the same gaits on the robot with similar time and behavior. Then, we take the execution time of the whole trajectory as an indicator to filter out the opposing gradients. For example, in Fig. <ref type="figure">10</ref>, since the predicted trajectory takes a shorter length of time than the ground truth, we only consider key frame losses of gait 0 and gait 2 to slow down the engine, and we ignore the loss from gait 1. Additional evaluation about the KFL can be found in the link to the appendix 1 .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. EXPERIMENTAL RESULTS</head><p>Our experiments evaluate the R2S2R pipeline both in simulation and on the real 3-bar tensegrity robot. Section V-A evaluates key components of the proposed process, i.e., the detachment strategy and the Key Frame Loss (KFL), using synthetic data. Section V-B evaluates the full R2S2R pipeline on the 3-bar tensegrity robot shown in Fig. <ref type="figure">1</ref> with the dimensions in Fig. <ref type="figure">3</ref>. Section V-C shows the additional improvement when a second iteration of the R2S2R pipeline is performed.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. System Identification with Synthetic Trajectories</head><p>We evaluate KFL by comparing three different loss functions: 1) The average defects from all time steps (All Step) in each window; 2) The average defects of the last time step (Last Step) in each window; 3) Our method (Ours) with KFL, which averages defects of the last time step in each window and detaches the observations between each window. The difference between these three methods is shown in Fig. <ref type="figure">11</ref>. To simplify the problem, only motor speed is identified in this task (in addition to motor speed, the friction coefficient is also identified in V-B). A synthetic trajectory where the motor speed is set to 0.5 is used as ground truth. The defects are the differences in end cap positions. An Adam optimizer with learning rate 0.1 is applied. Fig. <ref type="figure">12</ref> shows that our method converges fast, smooth and stable. The curve of the Last Step method fluctuates more due to the gradient propagation across windows, even if the motor speed is close to the target in later iterations. This shows the neeed for detaching. The multiple windows approach considering all time steps performs worse. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Complete Evaluation of the R2S2R Pipeline</head><p>The R2S2R pipeline has been applied twice to show continuous improvement each iteration. In the first iteration, a single robot trajectory given random controls is used to identify the physics engine parameters, including motor speed and friction coefficient. From the identified engine, we generate three policies corresponding to "forward rolling," "backward rolling," and "counterclockwise turning" behaviors. These policies are mapped to two long, openloop gaits with symmetry reduction: a straight gait (Straight) composed of forward and backward rolling policies and a counterclockwise turning gait (CCW Turning) composed of "counterclockwise turning" polices. These two gaits are executed in simulation and on the real robot, and these executions are shown as blue and orange lines, respectively, in Figure <ref type="figure">13</ref>. We also execute these gaits starting from different positions on the ground to test the repeatability on the real platform (Table <ref type="table">I</ref>). The Center of Mass (CoM) and orientation are measured at the end of each trajectory. We observe greater variability in the CCW Turning gait. In the simulator, this gait capitalizes on uniform friction to rotate the robot's principal axis; however, in the real world, the friction between the ground and the end caps is nonuniform. This discrepancy explains the higher variability.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Continuous Improvement with R2S2R</head><p>The second iteration re-identifies the engine using the two real robot trajectories from the first iteration, and then we execute these policies again in simulation to show how the R2S2R pipeline reduces the sim2real gap. The trajectories sampled from the refined simulation are plotted as green lines in Fig. <ref type="figure">13</ref>. The robot position and orientation at the end of the trajectories are compared in Table <ref type="table">II</ref>. Generally, the CoM and orientation errors go down in the refined simulation; however, the slightly increased CCW Turning orientation error shows the limitations of simulating nonuniform environment friction with a uniform friction coefficient. Qualitatively, the trajectory executed on the robot has the same behavior as the initial simulation. After the second iteration, the simulation trajectory is even more similar to the real robot trajectory, as shown in Fig <ref type="figure">15</ref> and<ref type="figure">16</ref>.</p><p>After the second iteration of system identification, two new clockwise turning polices are generated, and these policies are mapped to two long, open-loop gaits (Figure <ref type="figure">14</ref>). The deviations are larger for the arching gait (Figure <ref type="figure">14</ref> Left) because of the nonuniform friction between the end caps and the ground. This gait covers a larger area, and the coefficient of friction is not uniform everywhere on the floor.  We observe smaller deviations for the in-place turning gait (Figure <ref type="figure">14</ref> Right) where the robot is confined to a much smaller region. Qualitative visualization is also avaliable in </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VI. CONCLUSION</head><p>This paper demonstrates an R2S2R pipeline that mitigates the sim2real gap for tensegrity robots and develops locomotion policies that can be seamlessly transferred to real robots. The sim2real gap is reduced by using a differentiable physics engine that learns system parameters from real robot data via gradient descent. The simulation can then generate new locomotion policies and extend them for long trajectories via symmetry reduction. After transferring these policies to the real robot, the simulation can be continuously improved by re-identifying the system parameters from the recorded trajectories. To enable efficient system identification, we introduce and experimentally validate the detachment approach for computing contact gradients and the Key Frame Loss with a trajectory segmentation strategy. In future work,  the accuracy of the physics engine could be improved by allowing the system to identify the physical parameters of each component (e.g., the stiffness of each sensor tendon) and adapt online as these parameters change over time.</p><p>Fig. <ref type="figure">19</ref>: We train a drone to lift off the ground to evaluate our "Detaching" method. Loss is the MSE of the distance from drone x to target x at t = 500. The drone is initialized resting on the ground. The gradient &#8706; x &#8706;F is zero with clamping contact. However, after detaching the contact response &#8710;v(dv) from the computation graph, the correct gradient on F can guide the optimizer to increase F and reach the target.</p><p>We bring the box problem, pulling a box to the target position in 200 time steps, to evaluate Algorithm 2. The pulling force F is known and the ground friction coefficient &#181; is to be estimated. We take the MSE of box position and target position as a loss function.</p><p>The initial &#181; is 1 and box can't be moved with such large friction. Our detach method can generate correct negative gradient to reduce &#181; and the loss. However, without our method, the gradient is always zero and the loss curve never goes down. In general, we suggest to apply the "detach" method to clamping contacts of all actuated objects. However, this method should not be applied to objects whose movement only relies on these passive contact forces, e.g. the billiard. The philosophy is that we keep the "trending" gradient from the small actuation force even if the object can't move. This avoids the gradient discontinuities between clamping contact and separating contact.</p><p>Finally, we take the billiards problem, applying F on ball A and aiming the ball B to reach a target position in 500 timesteps, to evaluate the detaching philosophy -only detach actuated object. The loss is the mean MSE of B's position and target position.</p><p>We compare the differences between detaching both A, B and detaching A only. As we suggested, we should only detach the actuated object A's contact response. We shouldn't detach B's contact response, Because B is only affected by the passive contact forces. The result in Figure <ref type="figure">21</ref> shows that detaching both A and B could get zero gradient on F and no change in F and loss. However, if we only detach the actuated object A, we can still get the correct gradient direction and escape the saddle point. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Gaits Transition Smoothing</head><p>After generating locomotion gaits for all bottom triangles, we have a controller to generate longer trajectories. However, these trajectories have redundant actuation between gait transitions. We adopt a smoothing algorithm to smooth out the transition.</p><p>Let's consider a simple example of gaits transition in Figure <ref type="figure">22</ref>. Although the following gait includes 3 steps, we only keep the third step after removing the reset step and finding the shortcut with minimum actuated cables. But these shortcuts should be reevaluated because some of them may not work due to changes in center of gravity.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Comparison to Alternatives on a Small-scale Problem</head><p>This section evaluates Key Frame Loss (KFL) on a smallscale problem where the MS alternative can be applied. A learning rate of 0.1 and an Adam optimizer are used.</p><p>The problem involves identifying the velocity of a vehicular model so as to match a demonstration trajectory from a ground truth vehicle that drives between points A and B. The ground truth trajectory uses a velocity v = 1 m/s to reach point B at t = 100, return to Step one, which is to reset the robot to a neural state, is removed. Then we compute the distance from 110001 to the remaining two steps. We transit to step 3 directly since fewer cables are actuated.</p><p>A at t = 200, and reach B again at t = 300. We compare 3 methods: a) A naive approach that computes loss at each step as the difference between ground truth and estimated trajectory; b) A multiple shooting (MS) method <ref type="bibr">[42]</ref> that splits the trajectory to multiple windows and computes the loss by defects at the end of each window (different numbers of windows are tested for variants MS2, MS3, MS4); and c) the proposed KFL method. Fig. <ref type="figure">23</ref> provides the comparison. Only KFL and MS4 converge to the correct velocity (1 m/s). The other methods fail due to conflicting gradients. We also tested MS for a higher number of windows (5 to 9). The resulting loss curves are non-smooth, but the velocity eventually converges. The MS method samples discrete gradients on a continuous trajectory, so the sampling frequency must be high enough to compute correct gradients, which need to be discovered empirically. At the same time, the frequency should not be too high for noisy ground truth data, as the noise may dominate the optimization. The KFL approach splits the trajectory by "gaits" (i.e., the trajectory segment where the robot moves to a specific point), and this allows it to compute correct gradients.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Detachment Method for Restitution with Time of Impact (TOI)</head><p>For more accurate contact point computation, the Time of Impact (TOI) is introduced <ref type="bibr">[43]</ref> to compute the exact time that the contact happens. The detachment method can also integrate with TOI for restitution inference, which is shown in Algorithm 3.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E. Tensegrity Robot Locomotion and Applications</head><p>Tensegrity robots' compliance gives them the ability to adapt to unstructured terrain and survive harsh impacts, motivating them as future planetary rovers <ref type="bibr">[34]</ref>. Many tensegrity robots achieve locomotion by changing their tendon lengths to shift their center of mass outside of their polygon of stability and therefore roll <ref type="bibr">[5]</ref>. Electric motors that drive winches are commonly used to extend and contract tensegrity robots' cables <ref type="bibr">[4]</ref>. The 3-bar tensegrity robot used in this work has six such motors that drive winches to extend and contract six cables (the remaining three tendons are passive elastic elements) in order to shift the robot's center of mass and achieve locomotion. The robot can demonstrate the different locomotion policies enumerated in this paper (forward rolling, backward rolling, counterclockwise turning, and clockwise turning) by controlling its six cable lengths to match a sequence of target shapes. Sensor tendons <ref type="bibr">[35]</ref> that run parallel to each actuator sense the length of the cables and provide feedback to a PID controller so that the robot can execute the locomotion policies with high fidelity. In future work, we aim to demonstrate this lightweight, adaptable tensegrity robot navigating unstructured terrain and maintaining robust control even when subjected to harsh impacts. </p></div></body>
		</text>
</TEI>
