BowlerKernel
CartesianManipulator.java
Go to the documentation of this file.
1 package com.neuronrobotics.bowlerkernel.Bezier3d;
2 
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.List;
6 
7 import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
8 
9 import eu.mihosoft.vrl.v3d.CSG;
10 import eu.mihosoft.vrl.v3d.Cylinder;
11 import eu.mihosoft.vrl.v3d.Vector3d;
12 import javafx.scene.paint.Color;
13 import javafx.scene.transform.Affine;
14 
15 public class CartesianManipulator {
16  public Affine manipulationMatrix = new Affine();
17  CSG manip1 = new Cylinder(0, 5, 40, 10).toCSG().setColor(Color.BLUE);
18  CSG manip2 = new Cylinder(0, 5, 40, 10).toCSG().roty(-90).setColor(Color.RED);
19  CSG manip3 = new Cylinder(0, 5, 40, 10).toCSG().rotx(90).setColor(Color.GREEN);
21  TransformNR globalPose;
22 
23  public CartesianManipulator(TransformNR globalPose) {
24  this.globalPose = globalPose;
25  manip1.setMfg(incoming -> null);
26  manip2.setMfg(incoming -> null);
27  manip3.setMfg(incoming -> null);
28  manipulationList[0] = new manipulation(manipulationMatrix, new Vector3d(0, 0, 1), manip1, globalPose);
29  manipulationList[1] = new manipulation(manipulationMatrix, new Vector3d(0, 1, 0), manip3, globalPose);
30  manipulationList[2] = new manipulation(manipulationMatrix, new Vector3d(1, 0, 0), manip2, globalPose);
31  }
32 
33  public void addEventListener(Runnable r) {
34  for (int i = 0; i < 3; i++)
36  }
37 
38  public void addSaveListener(Runnable r) {
39  for (int i = 0; i < 3; i++)
41  }
42 
43  public List<CSG> get() {
44  return Arrays.asList(manip1, manip2, manip3);
45  }
46 
47  public double getX() {
48  return manipulationList[2].currentPose.getX();
49  }
50 
51  public double getY() {
52  return manipulationList[1].currentPose.getY();
53  }
54 
55  public double getZ() {
56  return manipulationList[0].currentPose.getZ();
57  }
58 
60  for (int i = 0; i < 3; i++)
62  }
63  public boolean isMoving() {
64  for (int i = 0; i < 3; i++)
65  if(manipulationList[i].isMoving())
66  return true;
67  return false;
68  }
69 
70  public void clearListeners() {
71  // TODO Auto-generated method stub
72  for (int i = 0; i < 3; i++)
74  }
75 
76  public void set(double newX, double newY, double newZ) {
77  for (int i = 0; i < 3; i++)
78  manipulationList[i].set(newX,newY,newZ);
79  }
80 }
CSG setColor(Color color)
Definition: CSG.java:207
CSG rotx(Number degreesToRotate)
Definition: CSG.java:570
CSG setMfg(PrepForManufacturing manufactuing)
Definition: CSG.java:2221
CSG roty(Number degreesToRotate)
Definition: CSG.java:560