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

Use new _phase var on ServoMount to not need custom Component

parent 44cfa09a
No related merge requests found
...@@ -36,12 +36,13 @@ c.addConstConstraint(("drive", "offset"), (0,0)) ...@@ -36,12 +36,13 @@ c.addConstConstraint(("drive", "offset"), (0,0))
c.addConstConstraint(("drive", "hornmount"), True) c.addConstConstraint(("drive", "hornmount"), True)
c.addConstConstraint(("drive", "centermount"), False) c.addConstConstraint(("drive", "centermount"), False)
c.addConstConstraint(("drive", "hornslots"), False) c.addConstConstraint(("drive", "hornslots"), False)
c.addConstConstraint(("drive", "_phase"), 3)
c.addConstraint(("link", "l"), "servo", f"2*x.get('shoulderlength') + x.get('hornoffset') + {gap('x')} + 5") c.addConstraint(("link", "l"), "servo", f"2*x.get('shoulderlength') + x.get('hornoffset') + {gap('x')} + 5")
c.addConstraint(("link", "w"), "servo", "x.get('motorwidth')") c.addConstraint(("link", "w"), "servo", "x.get('motorwidth')")
c.addConnection(("flipper", "mountedge"), ("panel", "t")) c.addConnection(("flipper", "mountedge"), ("panel", "t"))
c.addConnection(("panel", "l"), ("drive", "botedge3")) c.addConnection(("panel", "l"), ("drive", "botedge2"))
c.addConnection(("flipper", "handleedge"), ("link", "l"), angle=Function(("servo", "angle"), "-90-" + yaw("x[0]", "x[1]"))) c.addConnection(("flipper", "handleedge"), ("link", "l"), angle=Function(("servo", "angle"), "-90-" + yaw("x[0]", "x[1]")))
c.addConnection(("drive", "horn"), ("link", "face"), transform=False, copyDecorations=True) c.addConnection(("drive", "horn"), ("link", "face"), transform=False, copyDecorations=True)
......
from rocolib.library import getComponent
from rocolib.api.components.Component import newComponent
from rocolib.library import save
from rocolib.api.Function import Function
c = newComponent("ServoMount")
c.addParameter("servo", "fs90r", values=getComponent("ServoMotor").dims)
c.addParameter("flip", False, valueType="bool")
c.addParameter("center", True, valueType="bool")
c.addParameter("shift", 0, paramType="length")
# XXX TODO: Define type: tuple of two numbers
c.addParameter("offset", [], valueType="list")
c.addSubcomponent("beam", "SimpleRectBeam", inherit=("length", "addTabs"), prefix=None)
c.addSubcomponent("mount", "Cutout")
c.addConstraint(("mount", "dx"), "servo", 'x.get("motorwidth") * 0.99')
c.addConstraint(("mount", "dy"), "servo", 'x.get("motorlength")')
c.addConstraint(("beam", "depth"), "servo", 'x.get("motorwidth")')
c.addConstraint(("beam", "width"), "servo", 'x.get("motorheight")')
c.addConstraint(("beam", "length#minValue"), "servo", 'x.get("motorlength") + 2 * x.get("shoulderlength")')
c.inheritAllInterfaces("beam", prefix=None)
c.inheritAllInterfaces("mount")
c.addConnection(("beam", "face1"),
("mount", "decoration"),
mode="hole", offset=Function(params="offset"))
save(c, "seacreatures")
...@@ -9,7 +9,7 @@ connections: ...@@ -9,7 +9,7 @@ connections:
- - panel - - panel
- l - l
- - drive - - drive
- botedge3 - botedge2
- {} - {}
connection2: connection2:
- - flipper - - flipper
...@@ -106,12 +106,13 @@ parameters: ...@@ -106,12 +106,13 @@ parameters:
minValue: 0 minValue: 0
units: mm units: mm
valueType: float valueType: float
source: ../../../plugins/seacreatures/seacreatures/builders/PoweredFlipper.py source: ../../../seacreatures/seacreatures/builders/PoweredFlipper.py
subcomponents: subcomponents:
drive: drive:
classname: MountedServo classname: MountedServo
kwargs: {} kwargs: {}
parameters: parameters:
_phase: 3
angle: angle:
parameter: angle parameter: angle
centermount: false centermount: false
......
connections:
connection0:
- - beam
- face1
- - mount
- decoration
- mode: hole
offset:
parameter: offset
interfaces:
bot:
interface: bot
subcomponent: beam
botedge0:
interface: botedge0
subcomponent: beam
botedge1:
interface: botedge1
subcomponent: beam
botedge2:
interface: botedge2
subcomponent: beam
botedge3:
interface: botedge3
subcomponent: beam
face0:
interface: face0
subcomponent: beam
face1:
interface: face1
subcomponent: beam
face2:
interface: face2
subcomponent: beam
face3:
interface: face3
subcomponent: beam
mount.decoration:
interface: decoration
subcomponent: mount
slotedge:
interface: slotedge
subcomponent: beam
tabedge:
interface: tabedge
subcomponent: beam
top:
interface: top
subcomponent: beam
topedge0:
interface: topedge0
subcomponent: beam
topedge1:
interface: topedge1
subcomponent: beam
topedge2:
interface: topedge2
subcomponent: beam
topedge3:
interface: topedge3
subcomponent: beam
parameters:
addTabs:
defaultValue: true
spec:
valueType: bool
center:
defaultValue: true
spec:
valueType: bool
flip:
defaultValue: false
spec:
valueType: bool
length:
defaultValue: 100
spec:
minValue: 0
units: mm
valueType: float
offset:
defaultValue: []
spec:
valueType: list
servo:
defaultValue: fs90r
spec:
values:
ds2g:
horndepth: 1
hornheight: 9
hornlength: 10
hornoffset: 4
hornwidth: 3
motorheight: 11
motorlength: 17
motorwidth: 8.5
shoulderlength: 3.5
fs90r:
horndepth: 2
hornheight: 11
hornlength: 10
hornoffset: 8
hornwidth: 5
motorheight: 19
motorlength: 23
motorwidth: 13
shoulderlength: 5
s4303r:
horndepth: 2
hornheight: 14
hornlength: 38
hornoffset: 7
hornwidth: 3
motorheight: 29
motorlength: 31
motorwidth: 17
shoulderlength: 10
tgy1370a:
horndepth: 2
hornheight: 10
hornlength: 7
hornoffset: 4
hornwidth: 3
motorheight: 14
motorlength: 20
motorwidth: 9
shoulderlength: 4
shift:
defaultValue: 0
spec:
minValue: 0
units: mm
valueType: float
source: ../../../plugins/seacreatures/seacreatures/builders/ServoMountBuilder.py
subcomponents:
beam:
classname: SimpleRectBeam
kwargs: {}
parameters:
addTabs:
parameter: addTabs
depth:
function: x.get("motorwidth")
parameter: servo
length:
parameter: length
length#minValue:
function: x.get("motorlength") + 2 * x.get("shoulderlength")
parameter: servo
width:
function: x.get("motorheight")
parameter: servo
mount:
classname: Cutout
kwargs: {}
parameters:
dx:
function: x.get("motorwidth") * 0.99
parameter: servo
dy:
function: x.get("motorlength")
parameter: servo
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