From 3aba712c5a6cc671eb6c5fba38fe83d772775327 Mon Sep 17 00:00:00 2001 From: pjil27 <jillpantigcs@gmail.com> Date: Sun, 22 Aug 2021 22:26:06 -0700 Subject: [PATCH] changing FourWheelCar.yaml and CarForSteering.yaml --- SubESP32StackBuilder.py | 62 +++++++++++ rocolib/builders/BrainsTwoWheelsBuilder.py | 39 ++++--- rocolib/builders/CarForSteeringBuilder.py | 14 ++- rocolib/builders/FourWheelCarBuilder.py | 25 +++-- rocolib/builders/TwoWheelsBuilder.py | 9 +- rocolib/library/CarForSteering.yaml | 44 ++------ rocolib/library/FourWheelCar.yaml | 75 +++---------- rocolib/library/MountedServo.yaml | 60 ++--------- rocolib/library/NewBrainsTwoWheels.yaml | 120 +++++++++++++++++---- rocolib/library/ServoMotor.py | 3 +- rocolib/library/SubESP32Stack.yaml | 77 +++---------- rocolib/library/TwoWheels.yaml | 6 +- rocolib/library/Wheel.yaml | 42 -------- rocolib/utils/dimensions.py | 4 +- 14 files changed, 279 insertions(+), 301 deletions(-) create mode 100644 SubESP32StackBuilder.py diff --git a/SubESP32StackBuilder.py b/SubESP32StackBuilder.py new file mode 100644 index 0000000..c8a58e4 --- /dev/null +++ b/SubESP32StackBuilder.py @@ -0,0 +1,62 @@ +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", 60, 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 "brains", "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 power supply +c.addParameter("dy1", 18, parameterType="length") +c.addSubcomponent("servohole0", "Cutout") +c.addConstraint(("servohole0", "dy"), "brains", "getDim(x, 'height')/1.75") +c.addConstraint(("servohole0", "dx"), "dy1", "x-5") + +c.addConnection(("holder", "face0"), + ("header", "decoration"), + mode="hole", offset=Function(params=("length", "brains"), fnstring="(0, 0)")) + +c.addConnection(("holder", "face2"), + ("header", "decoration"), + mode="hole", offset=Function(params=("length", "brains"), fnstring="(0, 0)")) + +c.addConnection(("holder", "face3"), + ("servohole0", "decoration"), + mode="hole", rotate=True, + offset=Function(params=("brains", "length"), fnstring="(getDim(x[0], 'height') * -0.06, x[1] * 0.32)")) + +c.addSubcomponent("powerhole", "Cutout") +c.addConstraint(("powerhole", "dy"), "brains", "getDim(x, 'height')/1.75") +c.addConstraint(("powerhole", "dx"), "dy1") + +c.addConnection(("holder", "face1"), + ("powerhole", "decoration"), + mode="hole", rotate=True, + offset=Function(params=("brains", "length"), fnstring="(getDim(x[0], 'height') * 0.15, x[1] * 0.25)")) + +c.inheritAllInterfaces("holder", prefix=None) + +c.toLibrary("SubESP32Stack") diff --git a/rocolib/builders/BrainsTwoWheelsBuilder.py b/rocolib/builders/BrainsTwoWheelsBuilder.py index 8b7ddc7..6d3c1a0 100644 --- a/rocolib/builders/BrainsTwoWheelsBuilder.py +++ b/rocolib/builders/BrainsTwoWheelsBuilder.py @@ -5,9 +5,9 @@ c = Component() #Parameters for the sheath that would cover the wheels and the ESP32 Stack #Parameters that will change the dimension of the car -c.addParameter("length", 65, paramType="length", minValue=60) #tested minValue -c.addParameter("height", 48, paramType="length", minValue=36) #tested minValue -c.addParameter("width", 60, paramType="length", minValue=51) #tested minValue +c.addParameter("length", 65, paramType="length", minValue=65) #tested minValue +c.addParameter("height", 36, paramType="length", minValue=36) #tested minValue +c.addParameter("width", 60, paramType="length", minValue=60) #tested minValue #Holder for the ESP32 FeatherBoard and its Featherwings #If you have another "brain" or microcontroller or board change it here and adjust the parameters above to fit that "brain" @@ -46,9 +46,6 @@ c.addConstraint(("between0", "width"), "driveservo", "getDim(x, 'motorwidth')") c.addConnection(("fright", "topedge2"), ("between0", "topedge1"), angle=90) c.addConnection(("between0", "botedge1"), ("bleft", "botedge2"), angle=90, tabWidth=10) -#The side of the holder will adjust when the width of the car gets bigger -#so that the size of the holder for the ESP32 stack woul not change - #Flipping he front right wheels to match the orientation of the #bottom left c.addConstConstraint(("fright", "flip"), True) @@ -78,21 +75,39 @@ c.addConstraint(("sheathsplit0", "botlength"), ("driveservo", "width"), "(x[1] - c.addConnection(("bleft", "botedge1"), ("sheathsplit0", "botedge1"),angle=180) c.addConnection(("sheathsplit0", "topedge0"), ("sheath0", "topedge2")) -#Creating the holes for the servo +#Creating the holes for the servo wires for i in range(2): c.addSubcomponent("sidehole%d" %i, "Cutout") - c.addConstraint(("sidehole%d" %i, "dx"), "height", "14") + c.addConstraint(("sidehole%d" %i, "dx"), "height", "x * 0.39") -c.addConstraint(("sidehole0", "dy"), "height", "30") -c.addConstraint(("sidehole1", "dy"), "height", "23") +c.addConstraint(("sidehole0", "dy"), "height", "x * 0.7") +c.addConstraint(("sidehole1", "dy"), "height", "x * 0.5") c.addConnection(("sheath0", "face1"), ("sidehole0", "decoration"), - mode="hole", rotate=True, offset=Function(params=("length"), fnstring="(7, 21)")) + mode="hole", rotate=True, offset=Function(params=("height", "brains"), fnstring="(x[0] * -0.10, getDim(x[1], 'width') - 3)")) c.addConnection(("sheath0", "face3"), ("sidehole1", "decoration"), - mode="hole", rotate=True, offset=Function(params=("length"), fnstring="(-10, 21)")) + mode="hole", rotate=True, offset=Function(params=("height", "brains"), fnstring="(x[0] * -0.04, getDim(x[1], 'width') - 3)")) + +for i in range(4): + c.addSubcomponent("accessoryHole%d" % i, "Cutout") + c.addConstraint(("accessoryHole%d" % i, "dx"), "height", "x * 0.03") + c.addConstraint(("accessoryHole%d" % i, "dy"), "height", "x * 0.5") +c.addConnection(("sheath0", "face1"), + ("accessoryHole0", "decoration"), + mode="hole", rotate=True, offset=Function(params=("height", "length"), fnstring="(x[0] * -0.10, -x[1] * 0.45)")) +c.addConnection(("sheath0", "face3"), + ("accessoryHole1", "decoration"), + mode="hole", rotate=True, offset=Function(params=("height", "length"), fnstring="(x[0] * -0.04, -x[1] * 0.45)")) + +c.addConnection(("sheath0", "face1"), + ("accessoryHole2", "decoration"), + mode="hole", rotate=True, offset=Function(params=("height", "length"), fnstring="(x[0] * -0.10, x[1] * 0.05)")) +c.addConnection(("sheath0", "face3"), + ("accessoryHole3", "decoration"), + mode="hole", rotate=True, offset=Function(params=("height", "length"), fnstring="(x[0] * -0.04, x[1] * 0.05)")) c.inheritAllInterfaces("sheathsplit0") c.inheritAllInterfaces("sheath0") diff --git a/rocolib/builders/CarForSteeringBuilder.py b/rocolib/builders/CarForSteeringBuilder.py index 0826001..f01e3ff 100644 --- a/rocolib/builders/CarForSteeringBuilder.py +++ b/rocolib/builders/CarForSteeringBuilder.py @@ -3,7 +3,19 @@ from rocolib.api.components.Component import Component c = Component() c.addSubcomponent("front", "NewBrainsTwoWheels") -c.addSubcomponent("back", "TwoWheels", inherit=True, prefix=None) +c.addSubcomponent("back", "TwoWheels") + +c.addParameter("length", 65, paramType="length", minValue=65) #tested minValue +c.addParameter("height", 36, paramType="length", minValue=36) #tested minValue +c.addParameter("width", 60, paramType="length", minValue=60) #tested minValue + +c.addConstraint(("front", "length"), "length") +c.addConstraint(("front", "height"), "height") +c.addConstraint(("front", "width"), "width") + +c.addConstraint(("back", "length"), "length") +c.addConstraint(("back", "height"), "height") +c.addConstraint(("back", "width"), "width") #Main component of steering wheel car which makes them moveable: trapezoid that connects the two half of the car for i in range(4): diff --git a/rocolib/builders/FourWheelCarBuilder.py b/rocolib/builders/FourWheelCarBuilder.py index 3d00515..9da73b6 100644 --- a/rocolib/builders/FourWheelCarBuilder.py +++ b/rocolib/builders/FourWheelCarBuilder.py @@ -3,22 +3,25 @@ from rocolib.api.components.Component import Component c = Component() c.addSubcomponent("front", "NewBrainsTwoWheels") -c.addSubcomponent("middle", "TwoWheels") -c.addSubcomponent("back", "TwoWheels", inherit=True, prefix=None) +c.addSubcomponent("back", "TwoWheels") -# c.addConnection(("front", "sheath0.botedge2"), ("back", "sheath1.botedge2")) -# c.addConnection(("front", "sheath0.botedge0"), ("back", "sheath1.botedge0"), tabWidth=10) +c.addParameter("length", 65, paramType="length", minValue=65) #tested minValue +c.addParameter("height", 36, paramType="length", minValue=36) #tested minValue +c.addParameter("width", 60, paramType="length", minValue=60) #tested minValue -c.addConstraint(("back", "length"), "length", "x+15") +c.addConstraint(("front", "length"), "length") +c.addConstraint(("front", "height"), "height") +c.addConstraint(("front", "width"), "width") -#I'm trying to create a car with 6 wheels with the code below, but when I just use tabWidth. It wouldn't connect it in the 3D file -c.addConnection(("front", "sheath0.botedge2"), ("middle", "sheath1.botedge2")) -c.addConnection(("back", "sheath1.botedge2"), ("middle", "sheath1.topedge2"), tabWidth=20) -c.addConnection(("front", "sheath0.botedge0"), ("middle", "sheath1.botedge0"), tabWidth=20) -c.addConnection(("back", "sheath1.botedge0"), ("middle", "sheath1.topedge0"), tabWidth=20) +c.addConstraint(("back", "length"), "length") +c.addConstraint(("back", "height"), "height") +c.addConstraint(("back", "width"), "width") + +c.addConnection(("front", "sheath0.botedge2"), ("back", "sheath1.botedge2")) +c.addConnection(("front", "sheath0.botedge0"), ("back", "sheath1.botedge0"), tabWidth=13) c.addSubcomponent("shield", "Rectangle") -c.addConstraint(("shield", "l"), ("driveservo", "height"), "x[1] - getDim(x[0],'motorwidth')") +c.addConstraint(("shield", "l"), "height", "x - 13") c.addConstraint(("shield", "w"), "width") c.addConnection(("shield", "b"), ("back", "splitedge0"), angle=90, tabWidth=10) diff --git a/rocolib/builders/TwoWheelsBuilder.py b/rocolib/builders/TwoWheelsBuilder.py index 8ebc0bb..dc1089d 100644 --- a/rocolib/builders/TwoWheelsBuilder.py +++ b/rocolib/builders/TwoWheelsBuilder.py @@ -1,12 +1,13 @@ from rocolib.api.components.Component import Component +from rocolib.api.Function import Function c = Component() #Parameters for the sheath that would cover the wheels and the ESP32 Stack #Parameters that will change the dimension of the car -c.addParameter("length", 65, paramType="length", minValue=60) #tested minValue -c.addParameter("height", 48, paramType="length", minValue=36) #tested minValue -c.addParameter("width", 60, paramType="length", minValue=51) #tested minValue +c.addParameter("length", 65, paramType="length", minValue=65) #tested minValue +c.addParameter("height", 36, paramType="length", minValue=36) #tested minValue +c.addParameter("width", 60, paramType="length", minValue=60) #tested minValue #This car will use the customized ESP32 stack in dimensions.py and the FS90R servo #Change here if you have another board @@ -66,4 +67,4 @@ c.inheritAllInterfaces("sheath1") c.inheritInterface("splitedge0", ("sheathsplit0", "botedge1")) c.inheritInterface("splitedge1", ("sheathsplit1", "botedge0")) -c.toLibrary("TwoWheels") +c.toLibrary("TwoWheels") \ No newline at end of file diff --git a/rocolib/library/CarForSteering.yaml b/rocolib/library/CarForSteering.yaml index 23ee3c4..6256123 100644 --- a/rocolib/library/CarForSteering.yaml +++ b/rocolib/library/CarForSteering.yaml @@ -31,30 +31,8 @@ connections: - {} interfaces: {} parameters: - brains: - defaultValue: esp32stack - spec: - valueType: str - bright.angle: - defaultValue: 0 - spec: - maxValue: null - minValue: null - units: degrees - valueType: (float, int) - driveservo: - defaultValue: fs90r - spec: - valueType: str - fleft.angle: - defaultValue: 0 - spec: - maxValue: null - minValue: null - units: degrees - valueType: (float, int) height: - defaultValue: 48 + defaultValue: 36 spec: minValue: 36 units: mm @@ -62,13 +40,13 @@ parameters: length: defaultValue: 65 spec: - minValue: 60 + minValue: 65 units: mm valueType: (float, int) width: defaultValue: 60 spec: - minValue: 51 + minValue: 60 units: mm valueType: (float, int) source: ..\builders\CarForSteeringBuilder.py @@ -77,14 +55,6 @@ subcomponents: classname: TwoWheels kwargs: {} parameters: - brains: - parameter: brains - bright.angle: - parameter: bright.angle - driveservo: - parameter: driveservo - fleft.angle: - parameter: fleft.angle height: parameter: height length: @@ -94,7 +64,13 @@ subcomponents: front: classname: NewBrainsTwoWheels kwargs: {} - parameters: {} + parameters: + height: + parameter: height + length: + parameter: length + width: + parameter: width midsupport0: classname: Trapezoid kwargs: {} diff --git a/rocolib/library/FourWheelCar.yaml b/rocolib/library/FourWheelCar.yaml index a05f295..dd0feb2 100644 --- a/rocolib/library/FourWheelCar.yaml +++ b/rocolib/library/FourWheelCar.yaml @@ -2,35 +2,23 @@ connections: connection0: - - front - sheath0.botedge2 - - - middle + - - back - sheath1.botedge2 - {} connection1: - - - back - - sheath1.botedge2 - - - middle - - sheath1.topedge2 - - tabWidth: 20 - connection2: - - front - sheath0.botedge0 - - - middle - - sheath1.botedge0 - - tabWidth: 20 - connection3: - - back - sheath1.botedge0 - - - middle - - sheath1.topedge0 - - tabWidth: 20 - connection4: + - tabWidth: 13 + connection2: - - shield - b - - back - splitedge0 - angle: 90 tabWidth: 10 - connection5: + connection3: - - shield - t - - back @@ -38,30 +26,8 @@ connections: - angle: 90 interfaces: {} parameters: - brains: - defaultValue: esp32stack - spec: - valueType: str - bright.angle: - defaultValue: 0 - spec: - maxValue: null - minValue: null - units: degrees - valueType: (float, int) - driveservo: - defaultValue: fs90r - spec: - valueType: str - fleft.angle: - defaultValue: 0 - spec: - maxValue: null - minValue: null - units: degrees - valueType: (float, int) height: - defaultValue: 48 + defaultValue: 36 spec: minValue: 36 units: mm @@ -69,13 +35,13 @@ parameters: length: defaultValue: 65 spec: - minValue: 60 + minValue: 65 units: mm valueType: (float, int) width: defaultValue: 60 spec: - minValue: 51 + minValue: 60 units: mm valueType: (float, int) source: ..\builders\FourWheelCarBuilder.py @@ -84,37 +50,28 @@ subcomponents: classname: TwoWheels kwargs: {} parameters: - brains: - parameter: brains - bright.angle: - parameter: bright.angle - driveservo: - parameter: driveservo - fleft.angle: - parameter: fleft.angle height: parameter: height length: - function: x+15 parameter: length width: parameter: width front: classname: NewBrainsTwoWheels kwargs: {} - parameters: {} - middle: - classname: TwoWheels - kwargs: {} - parameters: {} + parameters: + height: + parameter: height + length: + parameter: length + width: + parameter: width shield: classname: Rectangle kwargs: {} parameters: l: - function: x[1] - getDim(x[0],'motorwidth') - parameter: - - driveservo - - height + function: x - 13 + parameter: height w: parameter: width diff --git a/rocolib/library/MountedServo.yaml b/rocolib/library/MountedServo.yaml index aa1b7c9..26efb16 100644 --- a/rocolib/library/MountedServo.yaml +++ b/rocolib/library/MountedServo.yaml @@ -6,48 +6,6 @@ connections: - horn - {} interfaces: - beam.botedge0: - interface: beam.botedge0 - subcomponent: mount - beam.botedge1: - interface: beam.botedge1 - subcomponent: mount - beam.botedge2: - interface: beam.botedge2 - subcomponent: mount - beam.botedge3: - interface: beam.botedge3 - subcomponent: mount - beam.face0: - interface: beam.face0 - subcomponent: mount - beam.face1: - interface: beam.face1 - subcomponent: mount - beam.face2: - interface: beam.face2 - subcomponent: mount - beam.face3: - interface: beam.face3 - subcomponent: mount - beam.slotedge: - interface: beam.slotedge - subcomponent: mount - beam.tabedge: - interface: beam.tabedge - subcomponent: mount - beam.topedge0: - interface: beam.topedge0 - subcomponent: mount - beam.topedge1: - interface: beam.topedge1 - subcomponent: mount - beam.topedge2: - interface: beam.topedge2 - subcomponent: mount - beam.topedge3: - interface: beam.topedge3 - subcomponent: mount botedge0: interface: botedge0 subcomponent: mount @@ -161,6 +119,12 @@ parameters: defaultValue: false spec: valueType: bool + length: + defaultValue: 100 + spec: + minValue: 0 + units: mm + valueType: (float, int) offset: defaultValue: null spec: @@ -179,13 +143,7 @@ parameters: minValue: 0 units: mm valueType: (float, int) - width: - defaultValue: 20 - spec: - minValue: 0 - units: mm - valueType: (float, int) -source: ../builders/MountedServoBuilder.py +source: ..\builders\MountedServoBuilder.py subcomponents: mount: classname: ServoMount @@ -197,14 +155,14 @@ subcomponents: parameter: center flip: parameter: flip + length: + parameter: length offset: parameter: offset servo: parameter: servo shift: parameter: shift - width: - parameter: width servo: classname: ServoMotor kwargs: {} diff --git a/rocolib/library/NewBrainsTwoWheels.yaml b/rocolib/library/NewBrainsTwoWheels.yaml index 97046cf..aafae1f 100644 --- a/rocolib/library/NewBrainsTwoWheels.yaml +++ b/rocolib/library/NewBrainsTwoWheels.yaml @@ -12,6 +12,48 @@ connections: - botedge2 - angle: 90 tabWidth: 10 + connection10: + - &id002 + - sheath0 + - face1 + - - accessoryHole0 + - decoration + - mode: hole + offset: + function: (x[0] * -0.10, -x[1] * 0.45) + parameter: &id001 + - height + - length + rotate: true + connection11: + - &id003 + - sheath0 + - face3 + - - accessoryHole1 + - decoration + - mode: hole + offset: + function: (x[0] * -0.04, -x[1] * 0.45) + parameter: *id001 + rotate: true + connection12: + - *id002 + - - accessoryHole2 + - decoration + - mode: hole + offset: + function: (x[0] * -0.10, x[1] * 0.05) + parameter: *id001 + rotate: true + connection13: + - *id003 + - - accessoryHole3 + - decoration + - mode: hole + offset: + function: (x[0] * -0.04, x[1] * 0.05) + parameter: *id001 + rotate: true connection2: - - holder - botedge1 @@ -49,24 +91,24 @@ connections: - topedge2 - {} connection8: - - - sheath0 - - face1 + - *id002 - - sidehole0 - decoration - mode: hole offset: - function: (7, 21) - parameter: length + function: (x[0] * -0.10, getDim(x[1], 'width') - 3) + parameter: &id004 + - height + - brains rotate: true connection9: - - - sheath0 - - face3 + - *id003 - - sidehole1 - decoration - mode: hole offset: - function: (-10, 21) - parameter: length + function: (x[0] * -0.04, getDim(x[1], 'width') - 3) + parameter: *id004 rotate: true interfaces: sheath0.botedge0: @@ -735,7 +777,7 @@ parameters: units: degrees valueType: (float, int) height: - defaultValue: 48 + defaultValue: 36 spec: minValue: 36 units: mm @@ -743,17 +785,57 @@ parameters: length: defaultValue: 65 spec: - minValue: 60 + minValue: 65 units: mm valueType: (float, int) width: defaultValue: 60 spec: - minValue: 51 + minValue: 60 units: mm valueType: (float, int) source: ..\builders\BrainsTwoWheelsBuilder.py subcomponents: + accessoryHole0: + classname: Cutout + kwargs: {} + parameters: + dx: + function: x * 0.03 + parameter: height + dy: + function: x * 0.5 + parameter: height + accessoryHole1: + classname: Cutout + kwargs: {} + parameters: + dx: + function: x * 0.03 + parameter: height + dy: + function: x * 0.5 + parameter: height + accessoryHole2: + classname: Cutout + kwargs: {} + parameters: + dx: + function: x * 0.03 + parameter: height + dy: + function: x * 0.5 + parameter: height + accessoryHole3: + classname: Cutout + kwargs: {} + parameters: + dx: + function: x * 0.03 + parameter: height + dy: + function: x * 0.5 + parameter: height between0: classname: SimpleRectBeam kwargs: {} @@ -779,7 +861,7 @@ subcomponents: center: false length: function: ((x[0] - getDim(x[1], "width"))) - parameter: &id001 + parameter: &id005 - length - brains radius: @@ -798,7 +880,7 @@ subcomponents: flip: true length: function: ((x[0] - getDim(x[1], "width"))) - parameter: *id001 + parameter: *id005 radius: function: (getDim(x, "height") / 1.35) parameter: brains @@ -837,20 +919,20 @@ subcomponents: kwargs: {} parameters: dx: - function: '14' + function: x * 0.39 parameter: height dy: - function: '30' + function: x * 0.7 parameter: height sidehole1: classname: Cutout kwargs: {} parameters: dx: - function: '14' + function: x * 0.39 parameter: height dy: - function: '23' + function: x * 0.5 parameter: height split0: classname: SplitEdge @@ -859,7 +941,7 @@ subcomponents: botlength: function: (getDim(x[1], "motorwidth"), getDim(x[0], "height") - getDim(x[1], "motorwidth")) - parameter: &id002 + parameter: &id006 - brains - driveservo toplength: @@ -872,7 +954,7 @@ subcomponents: botlength: function: (getDim(x[0], "height") - getDim(x[1], "motorwidth"), getDim(x[1], "motorwidth")) - parameter: *id002 + parameter: *id006 toplength: function: (getDim(x, "height"),) parameter: brains diff --git a/rocolib/library/ServoMotor.py b/rocolib/library/ServoMotor.py index 3f8c1e5..5881e47 100644 --- a/rocolib/library/ServoMotor.py +++ b/rocolib/library/ServoMotor.py @@ -3,6 +3,7 @@ from rocolib.api.composables.graph.Face import Rectangle as Shape from rocolib.api.ports import AnchorPort from rocolib.utils.dimensions import getDim from rocolib.utils.transforms import Translate, RotateZ +from rocolib.utils.numsym import dot class ServoMotor(FoldedComponent): @@ -18,7 +19,7 @@ class ServoMotor(FoldedComponent): dz = getDim(s, "hornheight") self.addFace(Shape("h", 0, 0)) - self.setInterface("horn", AnchorPort(self, self.getGraph(), "h", RotateZ(a) * Translate([0,0,dz]))) + self.setInterface("horn", AnchorPort(self, self.getGraph(), "h", dot(RotateZ(a), Translate([0,0,dz])))) if __name__ == "__main__": ServoMotor.test() diff --git a/rocolib/library/SubESP32Stack.yaml b/rocolib/library/SubESP32Stack.yaml index 660661a..2d2aa95 100644 --- a/rocolib/library/SubESP32Stack.yaml +++ b/rocolib/library/SubESP32Stack.yaml @@ -22,12 +22,14 @@ connections: connection2: - - holder - face3 - - - servohole1 + - - servohole0 - decoration - mode: hole offset: - function: (0, 14) - parameter: length + function: (getDim(x[0], 'height') * -0.06, x[1] * 0.32) + parameter: &id003 + - brains + - length rotate: true connection3: - - holder @@ -36,8 +38,8 @@ connections: - decoration - mode: hole offset: - function: (-5, 12) - parameter: length + function: (getDim(x[0], 'height') * 0.15, x[1] * 0.25) + parameter: *id003 rotate: true interfaces: botedge0: @@ -92,12 +94,12 @@ parameters: spec: parameterType: length length: - defaultValue: 61 + defaultValue: 60 spec: minValue: 0 units: mm valueType: (float, int) -source: ../builders/SubESP32StackBuilder.py +source: ..\..\SubESP32StackBuilder.py subcomponents: header: classname: Header @@ -120,63 +122,22 @@ subcomponents: kwargs: {} parameters: depth: - function: '60' + 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+17 - parameter: dy1 + function: getDim(x, 'height')/1.75 + parameter: brains servohole0: classname: Cutout kwargs: {} @@ -185,15 +146,5 @@ subcomponents: function: x-5 parameter: dy1 dy: - function: x+12 - parameter: dy1 - servohole1: - classname: Cutout - kwargs: {} - parameters: - dx: - function: x-5 - parameter: dy1 - dy: - function: x+12 - parameter: dy1 + function: getDim(x, 'height')/1.75 + parameter: brains diff --git a/rocolib/library/TwoWheels.yaml b/rocolib/library/TwoWheels.yaml index f5b31d6..ddbaf98 100644 --- a/rocolib/library/TwoWheels.yaml +++ b/rocolib/library/TwoWheels.yaml @@ -115,7 +115,7 @@ parameters: units: degrees valueType: (float, int) height: - defaultValue: 48 + defaultValue: 36 spec: minValue: 36 units: mm @@ -123,13 +123,13 @@ parameters: length: defaultValue: 65 spec: - minValue: 60 + minValue: 65 units: mm valueType: (float, int) width: defaultValue: 60 spec: - minValue: 51 + minValue: 60 units: mm valueType: (float, int) source: ..\builders\TwoWheelsBuilder.py diff --git a/rocolib/library/Wheel.yaml b/rocolib/library/Wheel.yaml index 972d385..a63097a 100644 --- a/rocolib/library/Wheel.yaml +++ b/rocolib/library/Wheel.yaml @@ -6,48 +6,6 @@ connections: - face - {} interfaces: - beam.botedge0: - interface: beam.botedge0 - subcomponent: drive - beam.botedge1: - interface: beam.botedge1 - subcomponent: drive - beam.botedge2: - interface: beam.botedge2 - subcomponent: drive - beam.botedge3: - interface: beam.botedge3 - subcomponent: drive - beam.face0: - interface: beam.face0 - subcomponent: drive - beam.face1: - interface: beam.face1 - subcomponent: drive - beam.face2: - interface: beam.face2 - subcomponent: drive - beam.face3: - interface: beam.face3 - subcomponent: drive - beam.slotedge: - interface: beam.slotedge - subcomponent: drive - beam.tabedge: - interface: beam.tabedge - subcomponent: drive - beam.topedge0: - interface: beam.topedge0 - subcomponent: drive - beam.topedge1: - interface: beam.topedge1 - subcomponent: drive - beam.topedge2: - interface: beam.topedge2 - subcomponent: drive - beam.topedge3: - interface: beam.topedge3 - subcomponent: drive botedge0: interface: botedge0 subcomponent: drive diff --git a/rocolib/utils/dimensions.py b/rocolib/utils/dimensions.py index cc791e9..1a39265 100644 --- a/rocolib/utils/dimensions.py +++ b/rocolib/utils/dimensions.py @@ -39,16 +39,18 @@ dims["nodeMCU"] = { "type" : "brains", "colsep" : 0.9 * 25.4, } +#48 before dims["esp32stack"] = { "type" : "brains", "length" : 51, "width" : 24, - "height" : 48, + "height" : 36, "nrows" : 16, "ncols" : 2, "rowsep" : 2.5, "colsep" : 20, } + ''' Servo dimension parameters: -- GitLab