-
Notifications
You must be signed in to change notification settings - Fork 12
/
MiraLink.groovy
48 lines (42 loc) · 1.75 KB
/
MiraLink.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import com.neuronrobotics.bowlerstudio.creature.ICadGenerator;
import com.neuronrobotics.bowlerstudio.creature.CreatureLab;
import org.apache.commons.io.IOUtils;
import com.neuronrobotics.bowlerstudio.vitamins.*;
import eu.mihosoft.vrl.v3d.parametrics.*;
import com.neuronrobotics.bowlerstudio.vitamins.Vitamins;
import javafx.scene.paint.Color;
import eu.mihosoft.vrl.v3d.Transform;
import com.neuronrobotics.bowlerstudio.physics.TransformFactory;
import eu.mihosoft.vrl.v3d.Transform;
import javafx.scene.transform.Affine;
if(args == null){
def base =DeviceManager.getSpecificDevice( "HephaestusWorkCell",{
//If the device does not exist, prompt for the connection
MobileBase m = BowlerStudio.loadMobileBaseFromGit(
"https://github.com/osh1996/SeriesElasticActuator.git",
"seaArm.xml"
)
if(m==null)
throw new RuntimeException("Arm failed to assemble itself")
println "Connecting new device robot arm "+m
return m
})
DHParameterKinematics arm = base.getAllDHChains().get(0)
ArrayList<DHLink> dhLinks=arm.getChain().getLinks();
DHLink dh = dhLinks.get(0);
args=[dh,(int)2] // args = [dh_parameters, joint #] !!!Pass extra parameters into here if I need them from external script
}
CSG reverseDHValues(CSG incoming,DHLink dh ){
println "Reversing "+dh
TransformNR step = new TransformNR(dh.DhStep(0))
Transform move = TransformFactory.nrToCSG(step)
return incoming.transformed(move)
}
CSG moveDHValues(CSG incoming,DHLink dh ){
TransformNR step = new TransformNR(dh.DhStep(0)).inverse()
Transform move = TransformFactory.nrToCSG(step)
return incoming.transformed(move)
}
CSG DummyStandInForLink = new Cube(20).toCSG()
//here i need to define the shape(s) that will result in a new link for the arm
return [moveDHValues(DummyStandInForLink,args[0])]