Difference between revisions of "PI-Q-Robot"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
* http://pi-q-robot.bitplan.com/ | * http://pi-q-robot.bitplan.com/ | ||
* https://discourse.threejs.org/t/robot-simulation-rotation-issues/9065 | * https://discourse.threejs.org/t/robot-simulation-rotation-issues/9065 | ||
| + | = Robot loading = | ||
| + | <graphviz> | ||
| + | digraph RobotState { | ||
| + | RfromJsonObj [ label="Robot.fromJsonObj"] | ||
| + | PfromJsonObj [ label="Part.fromJsonObj"] | ||
| + | loadParts [ label="Robot.loadParts(whenIntegrated=robot.addGUI(gui,options)" ] | ||
| + | pLoad [ label="Part.load" ] | ||
| + | cLoad [ label="ChildPart.load" ] | ||
| + | addSTL [ label="ChildPart.addSTL(whenDone=ChildPart.onLoaded(part)" ] | ||
| + | RNew [ label="Robot.new" ] | ||
| + | pintegrate [ label="Part.integrate" ] | ||
| + | rintegratePart [ label="Robot.integratePart" ] | ||
| + | rFullyLoaded [ label="Robot.fullyLoaded" ] | ||
| + | pFullyLoaded [ label="Part.fullyLoaded" ] | ||
| + | cFullyLoaded [ label="ChildPart.fullyLoaded" ] | ||
| + | RNew -> loadParts -> addGUI | ||
| + | loadParts->pLoad | ||
| + | pLoad->cLoad | ||
| + | cLoad -> addSTL | ||
| + | RfromJsonObj -> PfromJsonObj | ||
| + | PfromJsonObj -> PfromJsonObj [ label="subParts" ] | ||
| + | RfromJsonObj -> RNew | ||
| + | addSTL -> onCreate [ label="stl==null" ] | ||
| + | pintegrate -> rintegratePart | ||
| + | pintegrate -> integrateChild | ||
| + | rintegratePart -> rFullyLoaded | ||
| + | rFullyLoaded -> pFullyLoaded | ||
| + | rFullyLoaded -> addGUI [ label="callback via whenIntegrated" ] | ||
| + | pFullyLoaded -> cFullyLoaded | ||
| + | cFullyLoaded -> calcSize | ||
| + | addSTL -> onLoad | ||
| + | onLoad -> onCreate [ label="stl!=null" ] | ||
| + | onCreate -> onLoaded [ label="callback via whenDone" ] | ||
| + | onLoaded -> pintegrate | ||
| + | } | ||
| + | </graphviz> | ||
= rearrange example = | = rearrange example = | ||
<source lang='python'> | <source lang='python'> | ||
Revision as of 06:36, 17 August 2019
- http://pi-q-robot.bitplan.com/
- https://discourse.threejs.org/t/robot-simulation-rotation-issues/9065
Robot loading
The file "mwstore://local-backend/local-public/diagrams/archive/20251123130051!Diagrams_20a005c01063b90715739c3b382c7e02.png" already exists.
rearrange example
// rearrange
rearrange() {
console.log("rearranging ...");
for (var partIndex in this.allParts) {
var part = this.allParts[partIndex];
// add pivots to the coxas
if (part.name.match('(coxa|femur|tibia)[0-9]')) {
console.log("rearranging " + part.name);
part.pivot = new Pivot(part.name + "-pivot", part.x, part.y, part.z, part.rx, part.ry, part.rz);
}
// reparent tibias and femurs
var limbMatches=part.name.match('(tibia|femur)([0-9])');
if (limbMatches) {
var limbName=limbMatches[1];
var limbIndex=limbMatches[2];
var newParent='femur';
if (limbName==='femur')
newParent='coxa';
// make this limb a child of the newParent
part.reparent(newParent+limbIndex);
}
}
this.save();
}