From 25723d973190bb0ac9cbb3ee23c2353e76ad822c Mon Sep 17 00:00:00 2001
From: Grace Kwak <gracekwak25@gmail.com>
Date: Sat, 21 Aug 2021 14:00:57 -0700
Subject: [PATCH] parameterized bottomservomount component

---
 ...ntWithArmsBuilder.py => BottomServoMountBuilder.py} | 10 +++++-----
 rocolib/library/ServoMountWithArms.yaml                |  5 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)
 rename rocolib/builders/boat/mounts/{ServoMountWithArmsBuilder.py => BottomServoMountBuilder.py} (82%)

diff --git a/rocolib/builders/boat/mounts/ServoMountWithArmsBuilder.py b/rocolib/builders/boat/mounts/BottomServoMountBuilder.py
similarity index 82%
rename from rocolib/builders/boat/mounts/ServoMountWithArmsBuilder.py
rename to rocolib/builders/boat/mounts/BottomServoMountBuilder.py
index 5243528..1ffa889 100644
--- a/rocolib/builders/boat/mounts/ServoMountWithArmsBuilder.py
+++ b/rocolib/builders/boat/mounts/BottomServoMountBuilder.py
@@ -9,21 +9,21 @@ c.addParameter("width", 90, parameterType="length") # = boat depth
 c.addSubcomponent("servoMount", "SideServoMount", inherit="depth")
 
 c.addSubcomponent("leftArmDown", "Rectangle")
-c.addConstConstraint(("leftArmDown", "w"), 24)
+c.addConstraint(("leftArmDown", "w"), "servoMount.depth")
 c.addConstraint(("leftArmDown", "l"), "depth", "x-3") #DEPTH OF BOAT - 3 for the tab
 
 c.addSubcomponent("leftArmAcross", "Rectangle")
-c.addConstConstraint(("leftArmAcross", "w"), 24)
+c.addConstConstraint(("leftArmAcross", "w"), "servoMount.depth")
 c.addConstraint(("leftArmAcross", "l"), ("width", "servoMount.depth"), "x[0]/2 - x[1]/2") #DEPTH OF BOAT - 3 for the tab
 
 c.addConnection(("leftArmDown", "r"), ("leftArmAcross", "r"), angle=-90)
 
 c.addSubcomponent("rightArmDown", "Rectangle")
-c.addConstConstraint(("rightArmDown", "w"), 24)
+c.addConstConstraint(("rightArmDown", "w"), "servoMount.depth")
 c.addConstraint(("rightArmDown", "l"), "depth", "x-3") #DEPTH OF BOAT
 
 c.addSubcomponent("rightArmAcross", "Rectangle")
-c.addConstConstraint(("rightArmAcross", "w"), 24)
+c.addConstConstraint(("rightArmAcross", "w"), "servoMount.depth")
 c.addConstraint(("rightArmAcross", "l"), ("width", "servoMount.depth"), "x[0]/2 - x[1]/2") #DEPTH OF BOAT - 3 for the tab
 
 c.addConnection(("rightArmDown", "r"), ("rightArmAcross", "r"), angle=-90)
@@ -34,4 +34,4 @@ c.addConnection(("servoMount", "rightInterface"), ("rightArmAcross", "l"))
 c.inheritInterface("leftArmInterface", ("leftArmDown", "l"))
 c.inheritInterface("rightArmInterface", ("rightArmDown", "l"))
 
-c.toLibrary("ServoMountWithArms")
+c.toLibrary("BottomServoMount")
diff --git a/rocolib/library/ServoMountWithArms.yaml b/rocolib/library/ServoMountWithArms.yaml
index 002b20e..865c3d1 100644
--- a/rocolib/library/ServoMountWithArms.yaml
+++ b/rocolib/library/ServoMountWithArms.yaml
@@ -45,7 +45,7 @@ parameters:
     defaultValue: 90
     spec:
       parameterType: length
-source: ../builders/boat/ServoMountWithArmsBuilder.py
+source: ../builders/boat/mounts/ServoMountWithArmsBuilder.py
 subcomponents:
   leftArmAcross:
     classname: Rectangle
@@ -64,7 +64,8 @@ subcomponents:
       l:
         function: x-3
         parameter: depth
-      w: 24
+      w:
+        parameter: servoMount.depth
   rightArmAcross:
     classname: Rectangle
     kwargs: {}
-- 
GitLab