Last active
January 29, 2016 17:56
-
-
Save madhephaestus/687a47427c00a812e3ed to your computer and use it in GitHub Desktop.
NegativeFeedbackRobot copy of TrobotArmGroup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.neuronrobotics.bowlerstudio.creature.ICadGenerator; | |
import com.neuronrobotics.bowlerstudio.creature.CreatureLab; | |
import org.apache.commons.io.IOUtils; | |
import com.neuronrobotics.bowlerstudio.vitamins.*; | |
// Load the .CSG from the disk and cache it in memory | |
double spindalRadius = 16; | |
double housingDiameter=3.7 | |
double ballJointPinSize=8; | |
double ballJointBaseThickness = 5; | |
CSG ballJointHat = new Cylinder( spindalRadius+ housingDiameter, // Radius at the top | |
spindalRadius+ housingDiameter, // Radius at the bottom | |
ballJointPinSize/2, // Height | |
(int)30 //resolution | |
).toCSG() | |
.roty(-90) | |
CSG ballJointBase = new Cylinder( spindalRadius+ housingDiameter*2/3, // Radius at the top | |
spindalRadius+ housingDiameter*2/3, // Radius at the bottom | |
ballJointBaseThickness, // Height | |
(int)30 //resolution | |
).toCSG().roty(-90) | |
CSG ballSocket = new Sphere(ballJointPinSize).toCSG() | |
return new ICadGenerator(){ | |
@Override | |
public ArrayList<CSG> generateCad(DHParameterKinematics d, boolean toManufacture ) { | |
ArrayList<DHLink> dhLinks = d.getChain().getLinks(); | |
ArrayList<CSG> allCad=new ArrayList<>(); | |
CSG base = ballSocket.clone() | |
if(toManufacture){ | |
}else{ | |
base.setManipulator(d.getRootListener()); | |
} | |
allCad.add(base) | |
for(int i=1;i<dhLinks.size();i+=2){ | |
DHLink dh = dhLinks.get(i); | |
CSG tmpSrv = ballJointHat.clone() | |
.movex(-dh.getR()) | |
CSG tmpBallSocket =ballSocket | |
.clone() | |
.union( | |
new Cube( | |
ballJointPinSize*2, | |
1, | |
1) | |
.noCenter() | |
.toCSG() | |
.toXMax()); | |
CSG tmpNext= ballJointBase | |
.clone() | |
.toXMax() | |
.movex(tmpBallSocket.getMinX()) | |
CSG joinSection = tmpSrv | |
.union(tmpNext) | |
.hull() | |
.difference(tmpSrv.hull().scale(1.015),tmpNext.hull().scale(1.015))//cuts out the end section so the proper end stays on | |
if(toManufacture){ | |
}else{ | |
joinSection.setManipulator(dh.getListener()); | |
tmpBallSocket.setManipulator(dh.getListener()); | |
tmpNext.setManipulator(dh.getListener()); | |
tmpSrv.setManipulator(dh.getListener()); | |
} | |
allCad.add(tmpSrv) | |
allCad.add(tmpNext) | |
allCad.add(tmpBallSocket) | |
allCad.add(joinSection) | |
println "Generating link: "+(i) | |
} | |
return allCad; | |
} | |
@Override | |
public ArrayList<CSG> generateBody(MobileBase b, boolean toManufacture ) { | |
ArrayList<CSG> allCad=new ArrayList<>(); | |
double size =10; | |
//Grab all of the DH chains on the base | |
for(DHParameterKinematics chain:b.getAllDHChains()){ | |
println "Loading limb: "+chain.getScriptingName() | |
// For each limb, generate its cad | |
for(CSG csg: generateCad(chain,toManufacture)){ | |
allCad.add(csg);// add the cad objects to be passed back | |
} | |
} | |
return allCad; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<root> | |
<mobilebase> | |
<driveType>none</driveType> | |
<cadEngine> | |
<gist>687a47427c00a812e3ed</gist> | |
<file>BallSocketChainKinematics.groovy</file> | |
</cadEngine> | |
<driveEngine> | |
<gist>bcb4760a449190206170</gist> | |
<file>WalkingDriveEngine.groovy</file> | |
</driveEngine> | |
<name>NegativeFeedbackRobot</name> | |
<appendage> | |
<name>TrobotArm</name> | |
<cadEngine> | |
<gist>687a47427c00a812e3ed</gist> | |
<file>BallSocketChainKinematics.groovy</file> | |
</cadEngine> | |
<kinematics> | |
<gist>ff50f45a6327eccb5bf3</gist> | |
<file>cleanedDHSolver.groovy</file> | |
</kinematics> | |
<link> | |
<name>basex</name> | |
<deviceName>dyio</deviceName> | |
<type>servo-rotory</type> | |
<index>0</index> | |
<scale>1.0</scale> | |
<upperLimit>255.0</upperLimit> | |
<lowerLimit>0.0</lowerLimit> | |
<upperVelocity>1.0E8</upperVelocity> | |
<lowerVelocity>-1.0E8</lowerVelocity> | |
<staticOffset>127.0</staticOffset> | |
<isLatch>false</isLatch> | |
<indexLatch>0</indexLatch> | |
<isStopOnLatch>false</isStopOnLatch> | |
<homingTPS>10000000</homingTPS> | |
<DHParameters> | |
<Delta>0.0</Delta> | |
<Theta>0.0</Theta> | |
<Radius>0.0</Radius> | |
<Alpha>90.0</Alpha> | |
</DHParameters> | |
</link> | |
<link> | |
<name>basey</name> | |
<deviceName>dyio</deviceName> | |
<type>servo-rotory</type> | |
<index>1</index> | |
<scale>1.0</scale> | |
<upperLimit>255.0</upperLimit> | |
<lowerLimit>0.0</lowerLimit> | |
<upperVelocity>1.0E8</upperVelocity> | |
<lowerVelocity>-1.0E8</lowerVelocity> | |
<staticOffset>127.0</staticOffset> | |
<isLatch>false</isLatch> | |
<indexLatch>0</indexLatch> | |
<isStopOnLatch>false</isStopOnLatch> | |
<homingTPS>10000000</homingTPS> | |
<DHParameters> | |
<Delta>0.0</Delta> | |
<Theta>0.0</Theta> | |
<Radius>60.0</Radius> | |
<Alpha>-90.0</Alpha> | |
</DHParameters> | |
</link> | |
<link> | |
<name>secondx</name> | |
<deviceName>dyio</deviceName> | |
<type>servo-rotory</type> | |
<index>2</index> | |
<scale>1.0</scale> | |
<upperLimit>255.0</upperLimit> | |
<lowerLimit>0.0</lowerLimit> | |
<upperVelocity>1.0E8</upperVelocity> | |
<lowerVelocity>-1.0E8</lowerVelocity> | |
<staticOffset>127.0</staticOffset> | |
<isLatch>false</isLatch> | |
<indexLatch>0</indexLatch> | |
<isStopOnLatch>false</isStopOnLatch> | |
<homingTPS>10000000</homingTPS> | |
<DHParameters> | |
<Delta>0.0</Delta> | |
<Theta>0.0</Theta> | |
<Radius>0.0</Radius> | |
<Alpha>90.0</Alpha> | |
</DHParameters> | |
</link> | |
<link> | |
<name>secondy</name> | |
<deviceName>dyio</deviceName> | |
<type>servo-rotory</type> | |
<index>3</index> | |
<scale>1.0</scale> | |
<upperLimit>255.0</upperLimit> | |
<lowerLimit>0.0</lowerLimit> | |
<upperVelocity>1.0E8</upperVelocity> | |
<lowerVelocity>-1.0E8</lowerVelocity> | |
<staticOffset>127.0</staticOffset> | |
<isLatch>false</isLatch> | |
<indexLatch>0</indexLatch> | |
<isStopOnLatch>false</isStopOnLatch> | |
<homingTPS>10000000</homingTPS> | |
<DHParameters> | |
<Delta>0.0</Delta> | |
<Theta>0.0</Theta> | |
<Radius>60.0</Radius> | |
<Alpha>-90.0</Alpha> | |
</DHParameters> | |
</link> | |
<ZframeToRAS | |
> <x>0.0</x> | |
<y>0.0</y> | |
<z>0.0</z> | |
<rotw>1.0</rotw> | |
<rotx>0.0</rotx> | |
<roty>0.0</roty> | |
<rotz>0.0</rotz> | |
</ZframeToRAS> | |
<baseToZframe> | |
<x>0.0</x> | |
<y>0.0</y> | |
<z>0.0</z> | |
<rotw>0.7071376338671591</rotw> | |
<rotx>4.400393755887471E-17</rotx> | |
<roty>-0.7070759271597045</roty> | |
<rotz>2.010131832777906E-16</rotz> | |
</baseToZframe> | |
</appendage> | |
<ZframeToRAS> | |
<x>0.0</x> | |
<y>0.0</y> | |
<z>0.0</z> | |
<rotw>1.0</rotw> | |
<rotx>0.0</rotx> | |
<roty>0.0</roty> | |
<rotz>0.0</rotz> | |
</ZframeToRAS> | |
<baseToZframe> | |
<x>0.0</x> | |
<y>0.0</y> | |
<z>0.0</z> | |
<rotw>1.0</rotw> | |
<rotx>0.0</rotx> | |
<roty>0.0</roty> | |
<rotz>0.0</rotz> | |
</baseToZframe> | |
</mobilebase> | |
</root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.io.IOUtils; | |
//BowlerKernel.speak("No smiling!") | |
//Create the kinematics model from the xml file describing the D-H compliant parameters. | |
MobileBase base=null; | |
String robotName = "NegativeFeedbackRobot" | |
if(DeviceManager.getSpecificDevice(null, robotName)==null){ | |
//BowlerStudio.speak("I did not fine a device called "+robotName+". "+robotName+"."); | |
println "Loading new robot" | |
String xmlContent = ScriptingEngine.codeFromGistID("687a47427c00a812e3ed","NegativeFeedbackRobot.xml")[0]; | |
base = new MobileBase(IOUtils.toInputStream(xmlContent, "UTF-8")); | |
DeviceManager.addConnection(base,robotName); | |
}else{ | |
println "Found robot" | |
base = (MobileBase)DeviceManager.getSpecificDevice(null, robotName); | |
} | |
DHParameterKinematics DHArm = base.getAppendages().get(0); | |
return null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment