Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Draft of InMoov2 and Finite State Machine #1336

Draft
wants to merge 129 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
e07d8b0
wip webxr vertx
supertick Mar 19, 2023
29a86b3
Merge branch 'config-with-peers-and-subscriptions' of github.com:MyRo…
supertick Mar 20, 2023
2332822
cron update
supertick Jul 17, 2023
06783cb
raspi updates
supertick Jul 17, 2023
dad01bc
forgot pindefinition
supertick Jul 17, 2023
4658b20
fixed legacy write and pinmode
supertick Jul 17, 2023
4440167
in progress
supertick Jul 18, 2023
4443dc0
oscope fixes
supertick Jul 18, 2023
370e128
from grog branch
supertick Jul 18, 2023
22faefb
oscope cron and raspi improvements
supertick Jul 18, 2023
bac8ca9
ipscan image and info down to debug
supertick Jul 19, 2023
ea0ab74
adding .gitignore entries
supertick Jul 19, 2023
94534be
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Jul 19, 2023
00e9611
Merge branch 'cron-update' of github.com-myrobotlab:MyRobotLab/myrobo…
supertick Jul 19, 2023
62ad8b0
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Jul 20, 2023
f1c691c
generated pom
supertick Jul 20, 2023
bae8c3d
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Jul 20, 2023
993669c
rename
supertick Jul 22, 2023
b7ddb43
incremental
supertick Jul 22, 2023
754b978
Improved Cron and Cron history
supertick Jul 22, 2023
177c81d
Merge branch 'cron-enhanced' of github.com-myrobotlab:MyRobotLab/myro…
supertick Jul 22, 2023
a8dc963
forgot one
supertick Jul 22, 2023
c2de6bb
Merge branch 'cron-enhanced' of github.com-myrobotlab:MyRobotLab/myro…
supertick Jul 22, 2023
8791647
Teamwork fix of Hd44780
supertick Jul 23, 2023
66b42fb
Merge branch 'cron-enhanced' of github.com-myrobotlab:MyRobotLab/myro…
supertick Jul 23, 2023
f090e48
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Jul 23, 2023
ccceb78
intermediate
supertick Jul 23, 2023
24cfa91
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Jul 23, 2023
0cf9a52
initial draft
supertick Sep 3, 2023
5a55812
rich change state object
supertick Sep 3, 2023
6d60fdc
cleaned up onStateChange
supertick Sep 3, 2023
419402d
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Sep 7, 2023
5ef82fa
py4j.py a wip but other stuff worky
supertick Sep 7, 2023
832880e
gpt3 config
supertick Sep 7, 2023
3cd480c
readme update
supertick Sep 10, 2023
93ebb11
Merge branch 'vertx-webxr' of github.com-myrobotlab:MyRobotLab/myrobo…
supertick Sep 10, 2023
6355f4e
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Sep 14, 2023
13c61a6
stubbing out states
supertick Sep 20, 2023
d6e43eb
small updates
supertick Sep 20, 2023
dcae692
intermediate
supertick Sep 20, 2023
3323897
caliko
supertick Sep 20, 2023
1d3f08c
updates
supertick Sep 20, 2023
9c875a8
transfer
supertick Sep 20, 2023
36e364f
Merge branch 'inmoov-and-statemachine-1' of github.com-myrobotlab:MyR…
supertick Sep 20, 2023
cc329ac
transfer2
supertick Sep 20, 2023
a35a268
Merge branch 'transfer2' of github.com-myrobotlab:MyRobotLab/myrobotl…
supertick Sep 20, 2023
cf072b0
last of the merge problems hopefully
supertick Sep 20, 2023
d52aaa2
config specific
supertick Sep 20, 2023
4e1a487
removed cast
supertick Sep 20, 2023
5b442bd
quiet maven tests
supertick Sep 20, 2023
2e567a2
quiet gitactions tests
supertick Sep 20, 2023
167498f
updated dependency error will throw
supertick Sep 20, 2023
2acc34f
added --fail-fast to gitactions
supertick Sep 20, 2023
7e1a22d
fast-fail only
supertick Sep 20, 2023
c2b4f98
out smart goofy maven
supertick Sep 20, 2023
6b3e1af
make it quiet
supertick Sep 20, 2023
801daef
fast fail on dependencies for jenkins
supertick Sep 20, 2023
17734b1
update caliko meta
supertick Sep 20, 2023
7f6fa09
added time for thread to start
supertick Sep 21, 2023
deb94c1
removign "hack"
supertick Sep 26, 2023
b38784c
LogConfig removed copypasta
supertick Sep 26, 2023
5f00884
fixes concurrecy issues
supertick Sep 26, 2023
8d9ecdf
worky vertx
supertick Sep 29, 2023
1bd238d
Merge branch 'inmoov-and-statemachine-1' of github.com:MyRobotLab/myr…
kwatters Oct 11, 2023
ecd64cb
cleanup yolo filter, don't attach the non-serializable frame to the c…
kwatters Oct 11, 2023
7759ff5
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 12, 2023
70eae53
added deprecated onMoveX methods
supertick Oct 12, 2023
1e04982
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 12, 2023
82d4c44
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 12, 2023
a0a4002
removed old config
supertick Oct 12, 2023
23b4245
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 15, 2023
6d7c264
removed unused var, added if release cond
supertick Oct 15, 2023
0574c5c
fixed ivy
supertick Oct 15, 2023
ef2e9d0
pre release in build
supertick Oct 15, 2023
688ab9c
testing maven cache
supertick Oct 15, 2023
e8a4dbf
checking for cache improvements
supertick Oct 15, 2023
25e898b
wip
supertick Oct 16, 2023
84a0367
added correct config
supertick Oct 16, 2023
da541c4
wip
supertick Oct 16, 2023
88abadd
publishHeartbeat
hairygael Oct 17, 2023
34159fb
fixed publishHeartbeat
supertick Oct 17, 2023
e757e70
Merge branch 'inmoov-and-statemachine-1' of github.com-myrobotlab:MyR…
supertick Oct 17, 2023
7b94a64
now double ... weird
supertick Oct 17, 2023
15ca9fc
yours was better
hairygael Oct 17, 2023
5554a4e
heh ...
supertick Oct 17, 2023
5011345
readme update links
supertick Oct 17, 2023
7a5ee0a
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 17, 2023
4f47f23
Peer config utilities
supertick Oct 21, 2023
361b3e8
adding build and ignore
supertick Oct 22, 2023
2674733
start of InMoov2Test
supertick Oct 22, 2023
86eff22
Merge branch 'peer-config-utilities' of github.com-myrobotlab:MyRobot…
supertick Oct 22, 2023
2380e7b
clearing plan
supertick Oct 22, 2023
6f0372e
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 24, 2023
51efc25
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 24, 2023
7756069
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 25, 2023
8149ae6
merged master
supertick Oct 25, 2023
4b939ca
removing video handler for now
supertick Oct 25, 2023
3ebb565
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Oct 29, 2023
fc63c5a
readme update
supertick Oct 29, 2023
ec5ef4a
updated mux config apply
supertick Nov 3, 2023
29df9ee
bumping
supertick Nov 3, 2023
8b468a0
removed changes from opencv
supertick Nov 5, 2023
17462b3
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Nov 5, 2023
42c27db
Update README.html
supertick Nov 5, 2023
ac39840
Merge branch 'inmoov-and-statemachine-1' of github.com-myrobotlab:MyR…
supertick Nov 5, 2023
d050ff3
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Nov 5, 2023
3125251
merged develop
supertick Nov 5, 2023
c6a518d
merged in develop
supertick Nov 5, 2023
efe51db
synching with dev
supertick Nov 5, 2023
52381d3
more merging of develop
supertick Nov 5, 2023
b521675
random service update
supertick Nov 11, 2023
37624b4
Merge branch 'random-service-update' of github.com-myrobotlab:MyRobot…
supertick Nov 11, 2023
3d4c7e1
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Nov 14, 2023
6a8d930
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Nov 15, 2023
9431841
gpt3 prefix and websockethandler fix
supertick Nov 16, 2023
4a891ac
updates
supertick Nov 16, 2023
5eef100
Merge branch 'develop' of https://github.com/MyRobotLab/myrobotlab in…
supertick Nov 16, 2023
3966bdf
removed invoker
supertick Nov 16, 2023
40c36ba
reverting to develop branch webgui.main
supertick Nov 16, 2023
70e5a4d
reverting webgui.main
supertick Nov 16, 2023
5c3b276
a little yolo filter cleaning
supertick Nov 16, 2023
2953d72
synching with develop
supertick Nov 16, 2023
31a2c1b
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Nov 17, 2023
be14db5
Neopixel with single thread controller queu
supertick Nov 23, 2023
9ad0145
forgot this one
supertick Nov 23, 2023
01cedf0
min updates to inmoov for new neopixel
supertick Nov 23, 2023
3119798
updated log statement
supertick Nov 23, 2023
fd86c46
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
supertick Nov 23, 2023
bc93427
Merge branch 'neopixel-fixes' of github.com-myrobotlab:MyRobotLab/myr…
supertick Nov 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,627 changes: 1,617 additions & 10 deletions .vscode/launch.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions depthai
Submodule depthai added at 65fc1c
45 changes: 45 additions & 0 deletions src/main/java/VectorAngleCalculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import java.util.Vector;

public class VectorAngleCalculator {
public static double calculateAngle(Vector<Double> vector1, Vector<Double> vector2) {
// Check if the vectors have the same dimension
if (vector1.size() != vector2.size()) {
throw new IllegalArgumentException("Vectors must have the same dimension");
}

// Calculate the dot product of the vectors
double dotProduct = 0.0;
double magnitude1 = 0.0;
double magnitude2 = 0.0;

for (int i = 0; i < vector1.size(); i++) {
dotProduct += vector1.get(i) * vector2.get(i);
magnitude1 += Math.pow(vector1.get(i), 2);
magnitude2 += Math.pow(vector2.get(i), 2);
}

magnitude1 = Math.sqrt(magnitude1);
magnitude2 = Math.sqrt(magnitude2);

// Calculate the angle in radians
double radians = Math.acos(dotProduct / (magnitude1 * magnitude2));

// Convert radians to degrees
double degrees = Math.toDegrees(radians);

return degrees;
}

public static void main(String[] args) {
Vector<Double> vector1 = new Vector<>();
vector1.add(1.0);
vector1.add(0.0);

Vector<Double> vector2 = new Vector<>();
vector2.add(1.0);
vector2.add(1.0);

double angleDegrees = calculateAngle(vector1, vector2);
System.out.println("Angle between vectors: " + angleDegrees + " degrees");
}
}
82 changes: 82 additions & 0 deletions src/main/java/org/myrobotlab/caliko/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package org.myrobotlab.caliko;

import static org.lwjgl.glfw.GLFW.glfwPollEvents;
import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose;
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.glClear;

import org.myrobotlab.service.Caliko;

import au.edu.federation.caliko.demo.CalikoDemo;
import au.edu.federation.utils.Vec3f;

/**
* An example application to demonstrate the Caliko library in both 2D and 3D
* modes.
*
* Use up/down cursors to change between 2D/3D mode and left/right cursors to
* change demos. In 2D mode clicking using the left mouse button (LMB) changes
* the target location, and you can click and drag. In 3D mode, use W/S/A/D to
* move the camera and the mouse with LMB held down to look.
*
* See the README.txt for further documentation and controls.
*
* @author Al Lansley
* @version 1.0 - 31/01/2016
*/
public class Application {
// Define cardinal axes
final Vec3f X_AXIS = new Vec3f(1.0f, 0.0f, 0.0f);
final Vec3f Y_AXIS = new Vec3f(0.0f, 1.0f, 0.0f);
final Vec3f Z_AXIS = new Vec3f(0.0f, 0.0f, 1.0f);

// State tracking variables
boolean use3dDemo = true;
int demoNumber = 7;
boolean fixedBaseMode = true;
boolean rotateBasesMode = false;
boolean drawLines = true;
boolean drawAxes = false;
boolean drawModels = true;
boolean drawConstraints = true;
boolean leftMouseButtonDown = false;
boolean paused = true;

// Create our window and OpenGL context
int windowWidth = 800;
int windowHeight = 600;
public OpenGLWindow window = null;

// Declare a CalikoDemo object which can run our 3D and 2D demonstration
// scenarios
transient private CalikoDemo demo;
transient private Caliko service;
public boolean running = true;

public Application(Caliko service) {
this.service = service;
window = new OpenGLWindow(this, service, windowWidth, windowHeight);
demo = new CalikoDemo3D(this);
mainLoop();
window.cleanup();
}

public Caliko getService() {
return service;
}

private void mainLoop() {
// Run the rendering loop until the user closes the window or presses Escape
while (!glfwWindowShouldClose(window.mWindowId) && running) {
// Clear the screen and depth buffer then draw the demo
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
demo.draw();

// Swap the front and back colour buffers and poll for events
window.swapBuffers();
glfwPollEvents();
}
}

} // End of Application class
148 changes: 148 additions & 0 deletions src/main/java/org/myrobotlab/caliko/CalikoDemo3D.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
package org.myrobotlab.caliko;

import au.edu.federation.caliko.FabrikBone3D;
import au.edu.federation.caliko.FabrikChain3D;
import au.edu.federation.caliko.FabrikStructure3D;
import au.edu.federation.caliko.demo.CalikoDemo;
import au.edu.federation.caliko.demo3d.CalikoDemoStructure3D;
import au.edu.federation.caliko.visualisation.Axis;
import au.edu.federation.caliko.visualisation.Camera;
import au.edu.federation.caliko.visualisation.FabrikConstraint3D;
import au.edu.federation.caliko.visualisation.FabrikLine3D;
// import au.edu.federation.caliko.visualisation.FabrikModel3D;
import au.edu.federation.caliko.visualisation.Grid;
import au.edu.federation.caliko.visualisation.MovingTarget3D;
import au.edu.federation.utils.Mat4f;
import au.edu.federation.utils.Utils;
import au.edu.federation.utils.Vec3f;

/**
* Class to demonstrate some of the features of the Caliko library in 3D.
*
* @author Al Lansley
* @version 0.7.1 - 20/07/2016
*/
public class CalikoDemo3D implements CalikoDemo
{
static float defaultBoneLength = 10.0f;
static float boneLineWidth = 5.0f;
static float constraintLineWidth = 2.0f;
static float baseRotationAmountDegs = 0.3f;

// Set yo a camera which we'll use to navigate. Params: location, orientation, width and height of window.
static Camera camera = new Camera(new Vec3f(0.0f, 00.0f, 150.0f), new Vec3f(), 800, 600);

// Setup some grids to aid orientation
static float extent = 1000.0f;
static float gridLevel = 100.0f;
static int subdivisions = 20;
static Grid lowerGrid = new Grid(extent, extent, -gridLevel, subdivisions);
static Grid upperGrid = new Grid(extent, extent, gridLevel, subdivisions);

// An axis to show the X/Y/Z orientation of each bone. Params: Axis length, axis line width
static Axis axis = new Axis(3.0f, 1.0f);

// A constraint we can use to draw any joint angle restrictions of ball and hinge joints
static FabrikConstraint3D constraint = new FabrikConstraint3D();

// A simple Wavefront .OBJ format model of a pyramid to display around each bone (set to draw with a 1.0f line width)
static FabrikModel3D model = new FabrikModel3D("/pyramid.obj", 1.0f);

// Setup moving target. Params: location, extents, interpolation frames, grid height for vertical bar
static MovingTarget3D target = new MovingTarget3D(new Vec3f(0, -30, 0), new Vec3f(60.0f), 200, gridLevel);

private FabrikStructure3D mStructure;

private CalikoDemoStructure3D demoStructure3d;

private transient Application application;

/**
* Constructor.
*
* @param demoNumber The number of the demo to set up.
*/
public CalikoDemo3D(Application application)
{
this.application = application;
setup(0);
}

/**
* Set up a demo consisting of an arrangement of 3D IK chains with a given configuration.
*
* @param demoNumber The number of the demo to set up.
*/
public void setup(int demoNumber)
{
this.mStructure = application.getService().getStructure();

this.demoStructure3d = new GuiDemoStructure(application.getService(), null);

// Set the appropriate window title and make an initial solve pass of the structure
application.window.setWindowTitle(this.mStructure.getName());
//structure.updateTarget( target.getCurrentLocation() );
}

/** Set all chains in the structure to be in fixed-base mode whereby the base locations cannot move. */
public void setFixedBaseMode(boolean value) { mStructure.setFixedBaseMode(value); }

/** Handle the movement of the camera using the W/S/A/D keys. */
public void handleCameraMovement(int key, int action) { camera.handleKeypress(key, action); }

public void draw()
{
// Move the camera based on keypresses and mouse movement
camera.move(1.0f / 60.0f);

// Get the ModelViewProjection matrix as we use it multiple times
Mat4f mvpMatrix = application.window.getMvpMatrix();

// Draw our grids
lowerGrid.draw(mvpMatrix);
upperGrid.draw(mvpMatrix);

// If we're not paused then step the target and solve the structure for the new target location
if (!application.paused)
{
target.step();
this.demoStructure3d.drawTarget(mvpMatrix);

// Solve the structure (chains with embedded targets will use those, otherwise the provided target is used)
mStructure.solveForTarget( target.getCurrentLocation() );

FabrikChain3D chain = application.getService().getChain("default");

for (FabrikBone3D bone : chain.getChain()) {
bone.getStartLocation().getGlobalPitchDegs();
bone.getStartLocation().getGlobalYawDegs();

System.out.println("Bone X: " + bone.getStartLocation().toString());
}

}

// If we're in rotate base mode then rotate the base location(s) of all chains in the structure
if (application.rotateBasesMode)
{
int numChains = mStructure.getNumChains();
for (int loop = 0; loop < numChains; ++loop)
{
Vec3f base = mStructure.getChain(loop).getBaseLocation();
base = Vec3f.rotateAboutAxisDegs(base, baseRotationAmountDegs, CalikoDemoStructure3D.Y_AXIS);
mStructure.getChain(loop).setBaseLocation(base);
}
}

// Draw the target
target.draw(Utils.YELLOW, 8.0f, mvpMatrix);

// Draw the structure as required
// Note: bone lines are drawn in the bone colour, models are drawn in white by default but you can specify a colour to the draw method,
// axes are drawn X/Y/Z as Red/Green/Blue and constraints are drawn the colours specified in the FabrikConstraint3D class.
if (application.drawLines) { FabrikLine3D.draw(mStructure, boneLineWidth, mvpMatrix); }
if (application.drawModels) { model.drawStructure(mStructure, camera.getViewMatrix(), application.window.mProjectionMatrix); }
if (application.drawAxes) { axis.draw(mStructure, camera.getViewMatrix(), application.window.mProjectionMatrix); }
if (application.drawConstraints) { constraint.draw(mStructure, constraintLineWidth, mvpMatrix); }
}
}
Loading
Loading