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

Servofix

parent 5141837b
2 merge requests!25Merge v0.2 changes into v0.3,!24Servofix
......@@ -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")
......@@ -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")
......@@ -3,7 +3,7 @@ connections:
- - mount
- mount.decoration
- - servo
- horn
- mount
- {}
interfaces:
botedge0:
......
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()
connections:
connection0:
- - drive
- mount
- horn
- - tire
- face
- {}
......
......@@ -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,
......
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