Skip to content

Commit

Permalink
Merge branch 'master' into javadoc-to-github-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Jan 5, 2024
2 parents ae10142 + 4781563 commit 0045704
Show file tree
Hide file tree
Showing 30 changed files with 620,440 additions and 275 deletions.
Binary file removed README.PNG
Binary file not shown.
30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
# Robot Overlord
![workflow](https://github.com/MarginallyClever/Robot-Overlord-App/actions/workflows/main.yml/badge.svg)
[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://marginallyclever.github.io/robot-overlord-app/javadoc/)
# Robot Overlord #
![Preview image](Screenshot_2023-12-23_120520.png)


Robot Overlord is 3D control software for robots. It is intended to be easier than ROS. It was started by [Marginally Clever Robots, Ltd.](http://www.marginallyclever.com/)

We would love to see your robot run in the app. Please joint our [Discord channel](https://discord.gg/Q5TZFmB) and talk live with a human!

Some of the robots it controls are:

- Sixi 2+3, 6DOF arms
- Arm3, a 3DOF arm
- Thor, a 5DOF arm
- Rotary Stewart Platforms, like flight simulators
- Delta Robot 3, aka a Kossel
- Spidee, a 6 legged crab-style walker.
- Dog Robot, a generic 4 legged walker.
- Sixi 3, AR4, Mecademic Meca500, and other 6DOF arms
- Rotary Stewart Platforms, like flight simulators
- Dog robots.
- Spidee, a 6 legged crab-style walker.

# Why
## Why

The short answer? ROS is too hard for most people. We want to make it easier.
The short answer? ROS is too hard. We want to make it easier.

[Our philosophy about Robot Overlord](https://github.com/MarginallyClever/Robot-Overlord-App/wiki/Why-Robot-Overlord%3F).

## Get Started!

Steps to get started:

1. Install The latest Java
2. Install Robot Overlord App from [the "Releases" section of the Github repository](https://github.com/MarginallyClever/Robot-Overlord-App/releases)

Then you should be able to run the application.

## More
## Get Started today!

If you're reading this, make an issue ticket, and we will respond to it promptly.
[Read our friendly manual](https://mcr.dozuki.com/c/Robot_Overlord_3). It has pictures with arrows and everything!

## Icons

Expand Down
Binary file added Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Screenshot_2023-12-23_120520.png
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.marginallyclever</groupId>
<artifactId>RobotOverlord</artifactId>
<version>2.98.0</version>
<version>2.99.0</version>
<name>Robot Overlord</name>
<description>A friendly 3D user interface for controlling robots.</description>
<url>https://www.marginallyclever.com/</url>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.marginallyclever.ro3.apps.actions;

import com.marginallyclever.ro3.RO3;
import com.marginallyclever.ro3.apps.RO3Frame;
import com.marginallyclever.robotoverlord.RobotOverlord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ public void commitLoad(File selectedFile) {

// if the json is bad, this will throw an exception before removing the previous scene.
JSONObject json = new JSONObject(content);
Registry.reset();

// reset everything
NewScene newScene = new NewScene();
newScene.commitNewScene();

// do it!
String newCWD = selectedFile.getParent() + File.separator;
String oldCWD = System.getProperty("user.dir");
System.setProperty("user.dir",newCWD);
Expand All @@ -106,7 +110,7 @@ public void commitLoad(File selectedFile) {

System.setProperty("user.dir",oldCWD);

menu.addPath(selectedFile.getAbsolutePath());
if(menu!=null) menu.addPath(selectedFile.getAbsolutePath());
} catch (IOException e) {
logger.error("Error loading file.", e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.marginallyclever.ro3.apps.actions;

import com.marginallyclever.robotoverlord.swing.translator.Translator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.*;
import javax.swing.undo.UndoManager;
import java.awt.event.ActionEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,8 @@ private void renderViewportTools() {
private void renderAllPasses() {
// renderPasses that are always on
for(RenderPass pass : renderPasses.getList()) {
if(pass.getActiveStatus()==RenderPass.ALWAYS) {
pass.draw(this);
}
if(pass.getActiveStatus()==RenderPass.NEVER) continue;
pass.draw(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void draw(Viewport viewport) {
shader.setVector3d(gl3,"cameraPos",cameraWorldPos); // Camera position in world space
shader.setVector3d(gl3,"lightPos",cameraWorldPos); // Light position in world space
shader.setColor(gl3,"lightColor", Color.WHITE);
shader.setColor(gl3,"objectColor",new Color(255,255,255,64));
shader.setColor(gl3,"specularColor",Color.GRAY);
shader.setColor(gl3,"ambientColor",new Color(255/5,255/5,255/5,255));
shader.set1i(gl3,"useVertexColor",0);
Expand All @@ -105,41 +104,46 @@ public void draw(Viewport viewport) {
gl3.glDisable(GL3.GL_TEXTURE_2D);
gl3.glDisable(GL3.GL_DEPTH_TEST);

// find all MeshInstance nodes in Registry
List<Node> toScan = new ArrayList<>(Registry.getScene().getChildren());
Color unselected = new Color(255,255,255,64);
Color selected = new Color(226, 115, 42,128);

var list = Registry.selection.getList();
var toScan = new ArrayList<>(Registry.getScene().getChildren());
while(!toScan.isEmpty()) {
Node node = toScan.remove(0);

if(node instanceof MeshInstance meshInstance) {
// if they have a mesh, draw it.
Mesh mesh2 = meshInstance.getMesh();
if(mesh2==null) continue;

AABB boundingBox = mesh2.getBoundingBox();
Point3d max = boundingBox.getBoundsTop();
Point3d min = boundingBox.getBoundsBottom();
mesh.setVertex(0, min.x, max.y, max.z);
mesh.setVertex(1, max.x, max.y, max.z);
mesh.setVertex(2, max.x, min.y, max.z);
mesh.setVertex(3, min.x, min.y, max.z);
mesh.setVertex(4, min.x, max.y, min.z);
mesh.setVertex(5, max.x, max.y, min.z);
mesh.setVertex(6, max.x, min.y, min.z);
mesh.setVertex(7, min.x, min.y, min.z);
mesh.updateVertexBuffers(gl3);

// set the model matrix
Matrix4d w = meshInstance.getWorld();
w.transpose();
shader.setMatrix4d(gl3,"modelMatrix",w);
// draw it
mesh.render(gl3);

OpenGLHelper.checkGLError(gl3,logger);
}

toScan.addAll(node.getChildren());

if(!(node instanceof MeshInstance meshInstance)) continue;
if(getActiveStatus()==SOMETIMES && !list.contains(meshInstance)) continue;

// if they have a mesh, draw it.
Mesh mesh2 = meshInstance.getMesh();
if(mesh2==null) continue;

AABB boundingBox = mesh2.getBoundingBox();
Point3d max = boundingBox.getBoundsTop();
Point3d min = boundingBox.getBoundsBottom();
mesh.setVertex(0, min.x, max.y, max.z);
mesh.setVertex(1, max.x, max.y, max.z);
mesh.setVertex(2, max.x, min.y, max.z);
mesh.setVertex(3, min.x, min.y, max.z);
mesh.setVertex(4, min.x, max.y, min.z);
mesh.setVertex(5, max.x, max.y, min.z);
mesh.setVertex(6, max.x, min.y, min.z);
mesh.setVertex(7, min.x, min.y, min.z);
mesh.updateVertexBuffers(gl3);

// set the model matrix
Matrix4d w = meshInstance.getWorld();
w.transpose();
shader.setMatrix4d(gl3,"modelMatrix",w);

// highlight selected items
shader.setColor(gl3,"objectColor", list.contains(meshInstance) ? selected : unselected );
// draw it
mesh.render(gl3);
}

gl3.glEnable(GL3.GL_DEPTH_TEST);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class DrawCameras extends AbstractRenderPass {
private final Mesh rayMesh = new Mesh();
private ShaderProgram shader;
private final double cameraConeRatio = 50;
private final double coneScale = cameraConeRatio * 0.0001;


public DrawCameras() {
super("Cameras");
Expand All @@ -37,8 +39,8 @@ public DrawCameras() {

private void setupMeshRay() {
rayMesh.setRenderStyle(GL3.GL_LINES);
rayMesh.addColor(1,1,1,1); rayMesh.addVertex(0,0,0);
rayMesh.addColor(1,1,1,1); rayMesh.addVertex(0,0,0);
rayMesh.addVertex(0,0,0);
rayMesh.addVertex(0,0,0);
}

private void setupMeshCone() {
Expand All @@ -48,11 +50,11 @@ private void setupMeshCone() {
Vector3d b = new Vector3d( 1,-1,-1);
Vector3d c = new Vector3d( 1, 1,-1);
Vector3d d = new Vector3d(-1, 1,-1);
pyramidMesh.addColor(0,0,0,1); pyramidMesh.addVertex(0,0,0);
pyramidMesh.addColor(0,0,0,1); pyramidMesh.addVertex((float)a.x, (float)a.y, (float)a.z);
pyramidMesh.addColor(0,0,0,1); pyramidMesh.addVertex((float)b.x, (float)b.y, (float)b.z);
pyramidMesh.addColor(0,0,0,1); pyramidMesh.addVertex((float)c.x, (float)c.y, (float)c.z);
pyramidMesh.addColor(0,0,0,1); pyramidMesh.addVertex((float)d.x, (float)d.y, (float)d.z);
pyramidMesh.addVertex(0,0,0);
pyramidMesh.addVertex((float)a.x, (float)a.y, (float)a.z);
pyramidMesh.addVertex((float)b.x, (float)b.y, (float)b.z);
pyramidMesh.addVertex((float)c.x, (float)c.y, (float)c.z);
pyramidMesh.addVertex((float)d.x, (float)d.y, (float)d.z);

pyramidMesh.addIndex(0);
pyramidMesh.addIndex(1);
Expand Down Expand Up @@ -105,29 +107,31 @@ public void draw(Viewport viewport) {
shader.setVector3d(gl3,"cameraPos",cameraWorldPos); // Camera position in world space
shader.setVector3d(gl3,"lightPos",cameraWorldPos); // Light position in world space
shader.setColor(gl3,"lightColor", Color.WHITE);
shader.setColor(gl3,"objectColor",Color.GREEN);
shader.setColor(gl3,"specularColor",Color.DARK_GRAY);
shader.setColor(gl3,"ambientColor",Color.BLACK);
shader.set1i(gl3,"useVertexColor",1);
shader.set1i(gl3,"useVertexColor",0);
shader.set1i(gl3,"useLighting",0);
shader.set1i(gl3,"diffuseTexture",0);
gl3.glDisable(GL3.GL_DEPTH_TEST);
gl3.glDisable(GL3.GL_TEXTURE_2D);

double coneScale = cameraConeRatio *0.0001;
var list = Registry.selection.getList();
var normalizedCoordinates = viewport.getCursorAsNormalized();

// position and draw the ray from the camera.
Matrix4d w = MatrixHelper.createIdentityMatrix4();
shader.setMatrix4d(gl3, "modelMatrix", w);
for(Camera cam : Registry.cameras.getList() ) {
boolean selected = list.contains(cam);
if(getActiveStatus()==SOMETIMES && !selected) continue;

// position and draw the ray from the camera.
Matrix4d w = MatrixHelper.createIdentityMatrix4();
shader.setMatrix4d(gl3, "modelMatrix", w);
shader.setColor(gl3,"objectColor",selected ? Color.GREEN : Color.DARK_GRAY);
Ray ray = viewport.getRayThroughPoint(cam,normalizedCoordinates.x,normalizedCoordinates.y);
changeRayMesh(gl3, ray);
rayMesh.render(gl3);
}

// scale and draw the view cones
for(Camera cam : Registry.cameras.getList() ) {
// scale and draw the view cones
shader.setColor(gl3,"objectColor",selected ? Color.WHITE : Color.BLACK);
w = cam.getWorld();
Matrix4d scale = MatrixHelper.createIdentityMatrix4();
scale.m00 *= canvasWidth * coneScale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,34 @@ public void draw(Viewport viewport) {
gl3.glDisable(GL3.GL_TEXTURE_2D);
gl3.glDisable(GL3.GL_DEPTH_TEST);

var list = Registry.selection.getList();

List<Node> toScan = new ArrayList<>();
toScan.add(Registry.getScene());
while(!toScan.isEmpty()) {
Node node = toScan.remove(0);
toScan.addAll(node.getChildren());

if(node instanceof DHParameter parameter) {
double d = parameter.getD();
mesh.setVertex(1,0,0,d);
mesh.setVertex(2,0,0,d);
double s = Math.sin(Math.toRadians(parameter.getTheta()));
double c = Math.cos(Math.toRadians(parameter.getTheta()));
double r = parameter.getR();
mesh.setVertex(3,c*r,s*r,d);
mesh.updateVertexBuffers(gl3);

// set modelView to world
Pose parentPose = parameter.findParent(Pose.class);
Matrix4d w = (parentPose==null) ? MatrixHelper.createIdentityMatrix4() : parentPose.getWorld();
w.transpose();
shader.setMatrix4d(gl3,"modelMatrix",w);
mesh.render(gl3);
}
if(!(node instanceof DHParameter parameter)) continue;
if(getActiveStatus()==SOMETIMES && !list.contains(parameter)) continue;

shader.setColor(gl3,"objectColor",list.contains(parameter) ? Color.WHITE : Color.GRAY);

double d = parameter.getD();
mesh.setVertex(1,0,0,d);
mesh.setVertex(2,0,0,d);
double s = Math.sin(Math.toRadians(parameter.getTheta()));
double c = Math.cos(Math.toRadians(parameter.getTheta()));
double r = parameter.getR();
mesh.setVertex(3,c*r,s*r,d);
mesh.updateVertexBuffers(gl3);

// set modelView to world
Pose parentPose = parameter.findParent(Pose.class);
Matrix4d w = (parentPose==null) ? MatrixHelper.createIdentityMatrix4() : parentPose.getWorld();
w.transpose();
shader.setMatrix4d(gl3,"modelMatrix",w);
mesh.render(gl3);
}

gl3.glEnable(GL3.GL_DEPTH_TEST);
Expand Down
Loading

0 comments on commit 0045704

Please sign in to comment.