diff --git a/rocolib/builders/MountedServoBuilder.py b/rocolib/builders/MountedServoBuilder.py index e1e8fda87d574025130b1e8cf0248460efd56b32..305bfa7bc6639694d6f7d4607c59696368a68d4e 100644 --- a/rocolib/builders/MountedServoBuilder.py +++ b/rocolib/builders/MountedServoBuilder.py @@ -9,6 +9,6 @@ c.addSubcomponent("servo", "ServoMotor", inherit=True, prefix=None) c.inheritAllInterfaces("mount", prefix=None) c.inheritAllInterfaces("servo", prefix=None) c.addConnection(("mount", "mount.decoration"), - ("servo", "horn")) + ("servo", "mount")) c.toLibrary("MountedServo") diff --git a/rocolib/builders/WheelBuilder.py b/rocolib/builders/WheelBuilder.py index 3dd5384055404ddd00d536b01b5f5224ccdd1fde..9ee698fcdf63e5993b80114928af382abf303a67 100644 --- a/rocolib/builders/WheelBuilder.py +++ b/rocolib/builders/WheelBuilder.py @@ -8,7 +8,7 @@ c.addSubcomponent("tire", "Tire", inherit="radius tire_thickness".split(), prefi c.inheritAllInterfaces("drive", prefix=None) -c.addConnection(("drive", "mount"), +c.addConnection(("drive", "horn"), ("tire", "face")) c.toLibrary("Wheel") diff --git a/rocolib/library/MountedServo.yaml b/rocolib/library/MountedServo.yaml index 3a41255ee69f0452b4ae6e4a4b7f373f2b239608..aaaa270f888997a30548a631d78a58d8ed5baa9a 100644 --- a/rocolib/library/MountedServo.yaml +++ b/rocolib/library/MountedServo.yaml @@ -3,7 +3,7 @@ connections: - - mount - mount.decoration - - servo - - horn + - mount - {} interfaces: botedge0: diff --git a/rocolib/library/ServoMotor.py b/rocolib/library/ServoMotor.py index 5881e47e4152317542664da196de296caf222703..954d2a97de209b5d2389449824e6c18022b3f4ab 100644 --- a/rocolib/library/ServoMotor.py +++ b/rocolib/library/ServoMotor.py @@ -1,6 +1,7 @@ from rocolib.api.components import FoldedComponent from rocolib.api.composables.graph.Face import Rectangle as Shape from rocolib.api.ports import AnchorPort +from rocolib.utils.utils import decorateGraph from rocolib.utils.dimensions import getDim from rocolib.utils.transforms import Translate, RotateZ from rocolib.utils.numsym import dot @@ -10,16 +11,19 @@ class ServoMotor(FoldedComponent): def define(self): self.addParameter("angle", 0, paramType="angle", minValue=None, maxValue=None) self.addParameter("servo", "fs90r", paramType="dimension") - self.addInterface("horn", AnchorPort(self, self.getGraph(), "h", Translate([0,0,0]))) - self.addFaceInterface("mount", "h") + self.addInterface("mount", AnchorPort(self, self.getGraph(), "horn", Translate([0,0,0]))) + self.addFaceInterface("horn", "horn") def assemble(self): s = self.getParameter("servo") a = self.getParameter("angle") dz = getDim(s, "hornheight") + dy = getDim(s, "motorlength") / 2 - getDim(s, "hornoffset") - self.addFace(Shape("h", 0, 0)) - self.setInterface("horn", AnchorPort(self, self.getGraph(), "h", dot(RotateZ(a), Translate([0,0,dz])))) + f = Shape("horn", 0, 0) + decorateGraph(f, Shape("hole", 1, 1)) + self.addFace(f) + self.setInterface("mount", AnchorPort(self, self.getGraph(), "horn", dot(RotateZ(a), Translate([0,-dy,dz])))) if __name__ == "__main__": ServoMotor.test() diff --git a/rocolib/library/Wheel.yaml b/rocolib/library/Wheel.yaml index ed257d986c91906f882668734584376ecbb92dec..7f2f80227f316a0a8603bf71d8e0b2d849e6bc8f 100644 --- a/rocolib/library/Wheel.yaml +++ b/rocolib/library/Wheel.yaml @@ -1,7 +1,7 @@ connections: connection0: - - drive - - mount + - horn - - tire - face - {} diff --git a/rocolib/utils/dimensions.py b/rocolib/utils/dimensions.py index f54306ff40c4381180b794abfdea383c02a07366..4d87f57f6335a69363889b7f6f15bd43d22ed6e9 100644 --- a/rocolib/utils/dimensions.py +++ b/rocolib/utils/dimensions.py @@ -86,6 +86,17 @@ Should horn be a different object? ''' +dims["ds2g"] = { "type" : "servo", + "motorlength" : 17, + "motorwidth" : 8.5, + "motorheight" : 11, + "shoulderlength": 3.5, + "hornlength" : 11, + "hornheight" : 9, + "hornoffset" : 4, + "horndepth" : 1, +} + dims["s4303r"] = { "type" : "servo", "motorlength" : 31, "motorwidth" : 17,