MCPcopy Create free account
hub / github.com/Simple-Robotics/aligator / TwistModelExplicit

Class TwistModelExplicit

tests/python/test_custom_python_classes.py:24–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24class TwistModelExplicit(aligator.dynamics.ExplicitDynamicsModel):
25 def __init__(self, space, nu, dt: float):
26 B = np.eye(nu)
27 self.B = B
28 self.dt = dt
29 super().__init__(space, nu)
30
31 def __getinitargs__(self):
32 return (self.space, self.nu, self.dt)
33
34 def forward(self, x, u, data: aligator.dynamics.ExplicitDynamicsData):
35 self.space.integrate(x, self.dt * self.B @ u, data.xnext)
36
37 def dForward(self, x, u, data: aligator.dynamics.ExplicitDynamicsData):
38 Jx = data.Jx
39 Ju = data.Ju
40 v_ = self.dt * self.B @ u
41 dv_du = self.dt * self.B
42
43 self.space.Jintegrate(x, v_, Jx, 0)
44 Jxnext_dv = self.space.Jintegrate(x, v_, 1)
45 Ju[:, :] = Jxnext_dv @ dv_du
46
47
48@pytest.mark.skipif(

Callers 1

test_custom_controlboxFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_custom_controlboxFunction · 0.56