Skip to content
Snippets Groups Projects
Commit b3c21792 authored by mehtank's avatar mehtank
Browse files

Updated cardbot

parent 9f2d707b
Branches
No related merge requests found
......@@ -3,11 +3,15 @@ from svggen.api.Function import Function
self = Component()
self.addParameter("dphase", 1)
self.addSubcomponent("c1","CardBot1DOF", inherit=True, prefix=None)
self.addSubcomponent("c2","CardBot1DOF", inherit=True, prefix=None)
self.addConstraint(("c2", "phase"), "phase", "(x + 0.25) % 1")
self.addConnection(("c1", "l"), ("c2","t"),angle=Function(params="phase", fnstring="-45 + 45*np.cos(2*(x-0.25)*np.pi)"))
self.addConstraint(("c2", "phase"), ("phase", "dphase"), "(x[0] + 0.25 * x[1]) % 1")
self.addConnection(("c1", "l"), ("c2","t"),
angle=Function(params=("phase", "dphase"),
fnstring="-45 + 45*np.cos(2*(x[0]-0.25*x[1])*np.pi)"))
self.inheritInterface("t",("c1","t"))
self.inheritInterface("b",("c2","b"))
......
......@@ -3,8 +3,8 @@ from svggen.api.Function import Function
self = Component()
self.addSubcomponent("l1","CardBotLeg", inherit=True, prefix=None)
self.addSubcomponent("l2","CardBotLeg", inherit=True, prefix=None)
self.addSubcomponent("l1","CardBotLeg", inherit="d l phase".split(), prefix=None)
self.addSubcomponent("l2","CardBotLeg", inherit="d l phase".split(), prefix=None)
self.addSubcomponent("ra","Rectangle")
self.addSubcomponent("rb","Rectangle")
self.addSubcomponent("rc","Rectangle")
......@@ -12,6 +12,8 @@ self.addSubcomponent("rd","Rectangle")
self.addSubcomponent("re","Rectangle")
self.addSubcomponent("rf","Rectangle")
self.addConstConstraint(("l1", "dphase"), 1)
self.addConstConstraint(("l2", "dphase"), -1)
self.addConstraint(("l2", "phase"), "phase", "(x + 0.5) % 1")
self.addConstraint(("ra", "w"), "d")
......
......@@ -4,8 +4,8 @@ self = Component()
self.addParameter("l", 6.35 * 3)
self.addSubcomponent("c1","CardBot2DOF", inherit="d phase".split(), prefix=None)
self.addSubcomponent("c2","CardBot2DOF", inherit="d phase".split(), prefix=None)
self.addSubcomponent("c1","CardBot2DOF", inherit=True, prefix=None)
self.addSubcomponent("c2","CardBot2DOF", inherit=True, prefix=None)
self.addSubcomponent("r1","Rectangle", inherit="l", prefix=None)
self.addSubcomponent("rm","Rectangle", inherit="l", prefix=None)
self.addSubcomponent("r2","Rectangle", inherit="l", prefix=None)
......
python CardBot1DOFBuilder.py
python CardBot2DOFBuilder.py
python CardBotLegBuilder.py
python CardBotBuilder.py
......@@ -47,6 +47,7 @@ subcomponents:
kwargs: {}
parameters:
d: {parameter: d}
dphase: 1
l: {parameter: l}
phase: {parameter: phase}
l2:
......@@ -54,6 +55,7 @@ subcomponents:
kwargs: {}
parameters:
d: {parameter: d}
dphase: -1
l: {parameter: l}
phase: {function: (x + 0.5) % 1, parameter: phase}
ra:
......
......@@ -2,7 +2,9 @@ connections:
connection0:
- [c1, l]
- [c2, t]
- angle: {function: -45 + 45*np.cos(2*(x-0.25)*np.pi), parameter: phase}
- angle:
function: -45 + 45*np.cos(2*(x[0]-0.25*x[1])*np.pi)
parameter: [phase, dphase]
interfaces:
b: {interface: b, subcomponent: c2}
l: {interface: l, subcomponent: c2}
......@@ -10,8 +12,9 @@ interfaces:
t: {interface: t, subcomponent: c1}
metadata:
d: {default: 6.35}
dphase: {default: 1}
phase: {default: 0, max: 1, min: 0, paramtype: animation, step: 0.05}
parameters: {d: 6.35, phase: 0}
parameters: {d: 6.35, dphase: 1, phase: 0}
subcomponents:
c1:
classname: CardBot1DOF
......@@ -24,4 +27,6 @@ subcomponents:
kwargs: {}
parameters:
d: {parameter: d}
phase: {function: (x + 0.25) % 1, parameter: phase}
phase:
function: (x[0] + 0.25 * x[1]) % 1
parameter: [phase, dphase]
......@@ -28,21 +28,24 @@ interfaces:
l2: {interface: t, subcomponent: c2}
metadata:
d: {default: 6.35}
dphase: {default: 1}
l: {default: 19.049999999999997}
phase: {default: 0, max: 1, min: 0, paramtype: animation, step: 0.05}
parameters: {d: 6.35, l: 19.049999999999997, phase: 0}
parameters: {d: 6.35, dphase: 1, l: 19.049999999999997, phase: 0}
subcomponents:
c1:
classname: CardBot2DOF
kwargs: {}
parameters:
d: {parameter: d}
dphase: {parameter: dphase}
phase: {parameter: phase}
c2:
classname: CardBot2DOF
kwargs: {}
parameters:
d: {parameter: d}
dphase: {parameter: dphase}
phase: {parameter: phase}
f1:
classname: Rectangle
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment