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

Merge branch 'components' into 'v0.4'

Components

See merge request mehtank/rocolib!7
parents 043ceb3c 94cd173f
2 merge requests!34V0.4,!33Many bugfixes and enhancements
......@@ -29,6 +29,7 @@ def depthfn(params = None, fnmod = None):
# Set microcontroller
c.addConstraint(("brain", "depth"), *depthfn())
c.addConstraint(("brain", "length"), "width")
c.addConstraint(("brain", "width"), "brain", "x.get('width')")
for servo in ("right", "left"):
c.addConstraint((servo, "length"),
......@@ -41,10 +42,10 @@ for servo in ("right", "left"):
c.addConstConstraint(("right","flip"), True)
# connections
c.addConnection(("brain", "topedge0"),
c.addConnection(("brain", "botedge0"),
("right", "topedge0"),
angle=-90)
c.addConnection(("brain", "botedge0"),
c.addConnection(("brain", "topedge0"),
("left", "botedge0"),
angle=-90)
......
connections:
connection0:
- - brain
- topedge0
- botedge0
- - right
- topedge0
- angle: -90
connection1:
- - brain
- botedge0
- topedge0
- - left
- botedge0
- angle: -90
......@@ -145,7 +145,7 @@ parameters:
shoulderlength: 3.5
fs90r:
horndepth: 2
hornheight: 16
hornheight: 11
hornlength: 10
hornoffset: 8
motorheight: 19
......@@ -235,6 +235,9 @@ subcomponents:
- driveservo
length:
parameter: width
width:
function: x.get('width')
parameter: brain
left:
classname: Wheel
kwargs:
......
......@@ -150,7 +150,7 @@ parameters:
shoulderlength: 3.5
fs90r:
horndepth: 2
hornheight: 16
hornheight: 11
hornlength: 10
hornoffset: 8
motorheight: 19
......
......@@ -88,7 +88,7 @@ class ServoMotor(FoldedComponent):
motorheight = 19,
shoulderlength= 5,
hornlength = 10,
hornheight = 16,
hornheight = 11,
hornoffset = 8,
horndepth = 2,
),
......
......@@ -90,7 +90,7 @@ parameters:
shoulderlength: 3.5
fs90r:
horndepth: 2
hornheight: 16
hornheight: 11
hornlength: 10
hornoffset: 8
motorheight: 19
......
from rocolib.api.components import FoldedComponent
from rocolib.api.composables.graph.Face import Rectangle, Face
class TwoDOF(FoldedComponent):
def define(self):
self.addParameter("mountlength", 40, paramType="length")
self.addParameter("handlelength", 15, paramType="length")
self.addParameter("thickness", 10, paramType="length")
self.addParameter("pitch", 135, paramType="angle")
self.addParameter("yaw", 60, paramType="angle")
self.addEdgeInterface("mountedge", "mount.e0", "width")
self.addEdgeInterface("oaredge", "r2.e2", "h")
def assemble(self):
t = self.p.thickness
w = self.p.mountlength
h = self.p.handlelength
p = self.p.pitch
y = self.p.yaw
b = Face("", ((w, 0), (w, t), (w/2,t), (0,t), (0,0)))
b0 = Rectangle("", w, 0)
r1 = Rectangle("", w/2, t)
r2 = Rectangle("", h, t)
self.addFace(b, "base")
self.attachEdge("base.e2", r1, "e0", prefix="r1", angle=-180)
self.attachEdge("r1.e3", r2, "e1", prefix="r2", angle=y)
self.attachEdge("base.e0", b0, "e2", prefix="mount", angle=p)
if __name__ == "__main__":
TwoDOF.test()
from rocolib.api.components import FoldedComponent
from rocolib.api.composables.graph.Face import Rectangle, Face
class TwoDOF(FoldedComponent):
def define(self):
self.addParameter("mountlength", 40, paramType="length")
self.addParameter("handlelength", 15, paramType="length")
self.addParameter("hingelength", 10, paramType="length")
self.addParameter("thickness", 10, paramType="length")
self.addParameter("pitch", 135, paramType="angle")
self.addParameter("yaw", 60, paramType="angle")
self.addEdgeInterface("mountedge", "mount.e0", "mountlength")
self.addEdgeInterface("outedge", "r2.e2", "handlelength")
self.addEdgeInterface("handleedge", "r2.e3", "thickness")
def assemble(self):
t = self.p.thickness
w = self.p.mountlength
x = self.p.hingelength
h = self.p.handlelength
p = self.p.pitch
y = self.p.yaw
b = Face("", ((w, 0), (w, t), (w-x,t), (0,t), (0,0)))
b0 = Rectangle("", w, 0)
r1 = Rectangle("", x, t)
r2 = Rectangle("", h, t)
self.addFace(b, "base")
self.attachEdge("base.e2", r1, "e0", prefix="r1", angle=-180)
self.attachEdge("r1.e3", r2, "e1", prefix="r2", angle=y)
self.attachEdge("base.e0", b0, "e2", prefix="mount", angle=p)
if __name__ == "__main__":
TwoDOF.test()
......@@ -156,7 +156,7 @@ parameters:
shoulderlength: 3.5
fs90r:
horndepth: 2
hornheight: 16
hornheight: 11
hornlength: 10
hornoffset: 8
motorheight: 19
......
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