From 30721b1de81147257bdb82c0e993b2dbe54fd27d Mon Sep 17 00:00:00 2001
From: pjil27 <jillpantigcs@gmail.com>
Date: Thu, 5 Aug 2021 11:15:17 -0700
Subject: [PATCH] ESP32StackBoatBuilder.py added
---
rocolib/builders/ESP32StackBoatBuilder.py | 28 +++
rocolib/builders/SubESP32StackBuilder.py | 80 ++++++++
rocolib/library/ESP32StackBoat.yaml | 111 +++++++++++
rocolib/library/RegularNGon.py | 1 +
rocolib/library/SubESP32Stack.yaml | 215 ++++++++++++++++++++++
5 files changed, 435 insertions(+)
create mode 100644 rocolib/builders/ESP32StackBoatBuilder.py
create mode 100644 rocolib/builders/SubESP32StackBuilder.py
create mode 100644 rocolib/library/ESP32StackBoat.yaml
create mode 100644 rocolib/library/SubESP32Stack.yaml
diff --git a/rocolib/builders/ESP32StackBoatBuilder.py b/rocolib/builders/ESP32StackBoatBuilder.py
new file mode 100644
index 0000000..4d06716
--- /dev/null
+++ b/rocolib/builders/ESP32StackBoatBuilder.py
@@ -0,0 +1,28 @@
+from rocolib.api.components.Component import Component
+
+#ESP3 STACK WITH PWM SERVO FEATHERWING
+c = Component()
+
+c.addSubcomponent("stack", "SubESP32Stack")
+
+c.addParameter("brains", "esp32stack", paramType="dimension")
+c.addParameter("boat.depth", 20, paramType="length")
+
+for i in range(4):
+ c.addSubcomponent("support%d" %i, "Rectangle")
+ c.addConstraint(("support%d" %i, "w"), "brains", "getDim(x, 'width')/2.")
+ c.addConstraint(("support%d" %i, "l"), "boat.depth")
+
+for i in range(2):
+ c.addSubcomponent("split%d" %i, "SplitEdge")
+ c.addConstraint(("split%d" %i, "toplength"), "brains", '(getDim(x, "width"),)')
+ c.addConstraint(("split%d" % i, "botlength"), "brains", '(getDim(x, "width")/2.,getDim(x, "width")/2.)')
+
+c.addConnection(("stack", "topedge2"), ("split0", "topedge0"))
+c.addConnection(("stack", "botedge2"), ("split1", "topedge0"))
+c.addConnection(("split0", "botedge0"), ("support0", "l"), angle=90)
+c.addConnection(("split0", "botedge1"), ("support1", "l"), angle=90)
+c.addConnection(("split1", "botedge0"), ("support2", "l"), angle=90)
+c.addConnection(("split1", "botedge1"), ("support3", "l"), angle=90)
+
+c.toLibrary("ESP32StackBoat")
\ No newline at end of file
diff --git a/rocolib/builders/SubESP32StackBuilder.py b/rocolib/builders/SubESP32StackBuilder.py
new file mode 100644
index 0000000..ad23ad1
--- /dev/null
+++ b/rocolib/builders/SubESP32StackBuilder.py
@@ -0,0 +1,80 @@
+from rocolib.api.components.Component import Component
+from rocolib.api.Function import Function
+
+#ESP3 STACK WITH PWM SERVO FEATHERWING
+c = Component()
+
+c.addSubcomponent("holder", "SimpleRectBeam")
+
+#Dimensions of the ESP32 Stack
+c.addParameter("length", 51, paramType="length")
+
+c.addParameter("brains", "esp32stack", paramType="dimension")
+c.addConstraint(("holder", "length"), "length")
+c.addConstraint(("holder", "depth"), "brains", "getDim(x, 'height')")
+c.addConstraint(("holder", "width"), "brains", "getDim(x, 'width')")
+
+#This parameter will change when the dimensions of the car or vehicle is changed
+#so that it would not affect the ESP32 stack holder
+c.addSubcomponent("header", "Header")
+
+def getBrainParameter(p):
+ return "brain", "getDim(x, '%s')" % p
+
+#OLED at the top
+c.addConstraint(("header", "nrows"), "brains", "getDim(x, 'nrows')")
+c.addConstraint(("header", "ncols"), "brains", "getDim(x, 'ncols')")
+c.addConstraint(("header", "rowsep"), "brains", "getDim(x, 'rowsep')")
+c.addConstraint(("header", "colsep"), "brains", "getDim(x, 'colsep')")
+
+#Holes for servo and powersupply
+c.addParameter("dy1", 18, parameterType="length")
+for i in range(2):
+ c.addSubcomponent("servohole%d" %i, "Cutout")
+ c.addConstraint(("servohole%d" %i, "dy"), "dy1", "x+2")
+ c.addConstraint(("servohole%d" %i, "dx"), "dy1", "7")
+
+for i in range(4):
+ c.addSubcomponent("pinhole%d" % i, "Cutout")
+
+c.addConstraint(("pinhole0", "dy"), "dy1", "41")
+c.addConstraint(("pinhole0", "dx"), "dy1", "1.2")
+c.addConstraint(("pinhole1", "dy"), "dy1", "30")
+c.addConstraint(("pinhole1", "dx"), "dy1", "1.2")
+
+c.addConstraint(("pinhole2", "dy"), "dy1", "41")
+c.addConstraint(("pinhole2", "dx"), "dy1", "1.2")
+c.addConstraint(("pinhole3", "dy"), "dy1", "30")
+c.addConstraint(("pinhole3", "dx"), "dy1", "1.2")
+
+c.addConnection(("holder", "face0"),
+ ("pinhole0", "decoration"),
+ mode="hole", offset=Function(params=("length"), fnstring="(-10, 0)"))
+
+c.addConnection(("holder", "face0"),
+ ("pinhole1", "decoration"),
+ mode="hole", offset=Function(params=("length"), fnstring="(10, -5)"))
+
+c.addConnection(("holder", "face2"),
+ ("pinhole2", "decoration"),
+ mode="hole", offset=Function(params=("length"), fnstring="(10, 0)"))
+
+c.addConnection(("holder", "face2"),
+ ("pinhole3", "decoration"),
+ mode="hole", offset=Function(params=("length"), fnstring="(-10, -5)"))
+
+c.addConnection(("holder", "face3"),
+ ("servohole1", "decoration"),
+ mode="hole", rotate=True, offset=Function(params=("length"), fnstring="(-5, -20)"))
+
+c.addSubcomponent("powerhole", "Cutout")
+c.addConstraint(("powerhole", "dy"), "dy1", "x+12")
+c.addConstraint(("powerhole", "dx"), "dy1", "x")
+
+c.addConnection(("holder", "face1"),
+ ("powerhole", "decoration"),
+ mode="hole", rotate=True, offset=Function(params=("length"), fnstring="(-7, 12)"))
+
+c.inheritAllInterfaces("holder", prefix=None)
+
+c.toLibrary("SubESP32Stack")
\ No newline at end of file
diff --git a/rocolib/library/ESP32StackBoat.yaml b/rocolib/library/ESP32StackBoat.yaml
new file mode 100644
index 0000000..34de9b3
--- /dev/null
+++ b/rocolib/library/ESP32StackBoat.yaml
@@ -0,0 +1,111 @@
+connections:
+ connection0:
+ - - stack
+ - topedge2
+ - - split0
+ - topedge0
+ - {}
+ connection1:
+ - - stack
+ - botedge2
+ - - split1
+ - topedge0
+ - {}
+ connection2:
+ - - split0
+ - botedge0
+ - - support0
+ - l
+ - angle: 90
+ connection3:
+ - - split0
+ - botedge1
+ - - support1
+ - l
+ - angle: 90
+ connection4:
+ - - split1
+ - botedge0
+ - - support2
+ - l
+ - angle: 90
+ connection5:
+ - - split1
+ - botedge1
+ - - support3
+ - l
+ - angle: 90
+interfaces: {}
+parameters:
+ boat.depth:
+ defaultValue: 20
+ spec:
+ minValue: 0
+ units: mm
+ valueType: (float, int)
+ brains:
+ defaultValue: esp32stack
+ spec:
+ valueType: str
+source: ..\builders\ESP32StackBoatBuilder.py
+subcomponents:
+ split0:
+ classname: SplitEdge
+ kwargs: {}
+ parameters:
+ botlength:
+ function: (getDim(x, "width")/2.,getDim(x, "width")/2.)
+ parameter: brains
+ toplength:
+ function: (getDim(x, "width"),)
+ parameter: brains
+ split1:
+ classname: SplitEdge
+ kwargs: {}
+ parameters:
+ botlength:
+ function: (getDim(x, "width")/2.,getDim(x, "width")/2.)
+ parameter: brains
+ toplength:
+ function: (getDim(x, "width"),)
+ parameter: brains
+ stack:
+ classname: SubESP32Stack
+ kwargs: {}
+ parameters: {}
+ support0:
+ classname: Rectangle
+ kwargs: {}
+ parameters:
+ l:
+ parameter: boat.depth
+ w:
+ function: getDim(x, 'width')/2.
+ parameter: brains
+ support1:
+ classname: Rectangle
+ kwargs: {}
+ parameters:
+ l:
+ parameter: boat.depth
+ w:
+ function: getDim(x, 'width')/2.
+ parameter: brains
+ support2:
+ classname: Rectangle
+ kwargs: {}
+ parameters:
+ l:
+ parameter: boat.depth
+ w:
+ function: getDim(x, 'width')/2.
+ parameter: brains
+ support3:
+ classname: Rectangle
+ kwargs: {}
+ parameters:
+ l:
+ parameter: boat.depth
+ w:
+ function: getDim(x, 'width')/2.
+ parameter: brains
diff --git a/rocolib/library/RegularNGon.py b/rocolib/library/RegularNGon.py
index 6970987..4185181 100644
--- a/rocolib/library/RegularNGon.py
+++ b/rocolib/library/RegularNGon.py
@@ -24,3 +24,4 @@ class RegularNGon(FoldedComponent):
if __name__ == "__main__":
RegularNGon.test()
+
diff --git a/rocolib/library/SubESP32Stack.yaml b/rocolib/library/SubESP32Stack.yaml
new file mode 100644
index 0000000..2c690e6
--- /dev/null
+++ b/rocolib/library/SubESP32Stack.yaml
@@ -0,0 +1,215 @@
+connections:
+ connection0:
+ - &id001
+ - holder
+ - face0
+ - - pinhole0
+ - decoration
+ - mode: hole
+ offset:
+ function: (-10, 0)
+ parameter: length
+ connection1:
+ - *id001
+ - - pinhole1
+ - decoration
+ - mode: hole
+ offset:
+ function: (10, -5)
+ parameter: length
+ connection2:
+ - &id002
+ - holder
+ - face2
+ - - pinhole2
+ - decoration
+ - mode: hole
+ offset:
+ function: (10, 0)
+ parameter: length
+ connection3:
+ - *id002
+ - - pinhole3
+ - decoration
+ - mode: hole
+ offset:
+ function: (-10, -5)
+ parameter: length
+ connection4:
+ - - holder
+ - face3
+ - - servohole1
+ - decoration
+ - mode: hole
+ offset:
+ function: (-5, -20)
+ parameter: length
+ rotate: true
+ connection5:
+ - - holder
+ - face1
+ - - powerhole
+ - decoration
+ - mode: hole
+ offset:
+ function: (-7, 12)
+ parameter: length
+ rotate: true
+interfaces:
+ botedge0:
+ interface: botedge0
+ subcomponent: holder
+ botedge1:
+ interface: botedge1
+ subcomponent: holder
+ botedge2:
+ interface: botedge2
+ subcomponent: holder
+ botedge3:
+ interface: botedge3
+ subcomponent: holder
+ face0:
+ interface: face0
+ subcomponent: holder
+ face1:
+ interface: face1
+ subcomponent: holder
+ face2:
+ interface: face2
+ subcomponent: holder
+ face3:
+ interface: face3
+ subcomponent: holder
+ slotedge:
+ interface: slotedge
+ subcomponent: holder
+ tabedge:
+ interface: tabedge
+ subcomponent: holder
+ topedge0:
+ interface: topedge0
+ subcomponent: holder
+ topedge1:
+ interface: topedge1
+ subcomponent: holder
+ topedge2:
+ interface: topedge2
+ subcomponent: holder
+ topedge3:
+ interface: topedge3
+ subcomponent: holder
+parameters:
+ brains:
+ defaultValue: esp32stack
+ spec:
+ valueType: str
+ dy1:
+ defaultValue: 18
+ spec:
+ parameterType: length
+ length:
+ defaultValue: 51
+ spec:
+ minValue: 0
+ units: mm
+ valueType: (float, int)
+source: ..\builders\SubESP32StackBuilder.py
+subcomponents:
+ header:
+ classname: Header
+ kwargs: {}
+ parameters:
+ colsep:
+ function: getDim(x, 'colsep')
+ parameter: brains
+ ncols:
+ function: getDim(x, 'ncols')
+ parameter: brains
+ nrows:
+ function: getDim(x, 'nrows')
+ parameter: brains
+ rowsep:
+ function: getDim(x, 'rowsep')
+ parameter: brains
+ holder:
+ classname: SimpleRectBeam
+ kwargs: {}
+ parameters:
+ depth:
+ function: getDim(x, 'height')
+ parameter: brains
+ length:
+ parameter: length
+ width:
+ function: getDim(x, 'width')
+ parameter: brains
+ pinhole0:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: '1.2'
+ parameter: dy1
+ dy:
+ function: '41'
+ parameter: dy1
+ pinhole1:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: '1.2'
+ parameter: dy1
+ dy:
+ function: '30'
+ parameter: dy1
+ pinhole2:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: '1.2'
+ parameter: dy1
+ dy:
+ function: '41'
+ parameter: dy1
+ pinhole3:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: '1.2'
+ parameter: dy1
+ dy:
+ function: '30'
+ parameter: dy1
+ powerhole:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: x
+ parameter: dy1
+ dy:
+ function: x+12
+ parameter: dy1
+ servohole0:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: '7'
+ parameter: dy1
+ dy:
+ function: x+2
+ parameter: dy1
+ servohole1:
+ classname: Cutout
+ kwargs: {}
+ parameters:
+ dx:
+ function: '7'
+ parameter: dy1
+ dy:
+ function: x+2
+ parameter: dy1
--
GitLab