Compare commits
9 Commits
cleanup_al
...
d686ad7799
| Author | SHA1 | Date | |
|---|---|---|---|
| d686ad7799 | |||
| 11d8e9a865 | |||
| 69d5ef09bf | |||
| 2b9316f9d2 | |||
| 2c20254c23 | |||
| 90c3023618 | |||
| 60ad2c5da5 | |||
| bedb7d93e9 | |||
| 7f0d52c3a0 |
@@ -1,8 +0,0 @@
|
||||
# Format Style Options - Created with Clang Power Tools
|
||||
---
|
||||
BasedOnStyle: WebKit
|
||||
BreakBeforeBraces: Attach
|
||||
ColumnLimit: 110
|
||||
SortIncludes: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
...
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,3 +13,4 @@ x64**
|
||||
.cache**
|
||||
tags
|
||||
bin/*
|
||||
compile_commands.json
|
||||
|
||||
32
README.md
Normal file
32
README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Overview
|
||||
|
||||
LivePlotter is an opengl-based, 3d point plotting DLL. It is designed to be integrated into any project that needs to see 3d points plotted and updated in real time. It supposts simple camera control: rotate, pan, and zoom. Points can be given a "lifetime" during which their opacity will fade. The opacity of these points can be restored by updating their position. This allows an intuite representation of sensor readings (where the opacity of the point represents the age of the reading).
|
||||
|
||||
This DLL is designed to integrate easily into a C# application. A class that acomplishes this included. See [LivePlotter.cs](./LivePlotter.cs). Unfortunately the DLL also expects the presence of several other files currently, so you'll need to ensure **EVERYTHING** from the bin/ folder (that contains `LivePlotter.dll`) is in your project's build output directory.
|
||||
|
||||

|
||||
|
||||
*Please note that this project is still considered a work in progress. I will avoid making api-breaking changes. Functionality may be added and code refactoring may occur in the future since I plan to use this for several projects*
|
||||
|
||||
# Acquiring the DLL
|
||||
|
||||
There are two main ways to get the DLL...
|
||||
|
||||
## Download from releases (recommended)
|
||||
|
||||
Download the DLL from the latest release on the [releases page](https://git.the-embedded-lab.com/shamilton/LivePlotter/releases).
|
||||
|
||||
## Build from source (not recommended)
|
||||
|
||||
Building is a tad messy atm. I despise Visual Studio and like to manage my own build process. I prefer something simple like a script to build and that's currently what I have, but it's not nearly as clean as I'd like. I hope to fix this mess in the future.
|
||||
|
||||
1. You'll need git bash and an installation of MSVC (likely via downloading/installing Visual Studio and then installing the C++ build tools).
|
||||
2. Get the source code. `git clone --recurse-submodules https://git.the-embedded-lab.com/shamilton/LivePlotter.git`
|
||||
3. Build the glfw library. `cd ext/glfw`. `mkdir build && cd build && cmake ..`. Open GLFW.sln and build the solution.
|
||||
4. Find `vcvars64.bat` in your installation and modify the path in [run_before_build.bat](./run_before_build.bat) to point to it.
|
||||
5. Open git bash to the root directory of the project.
|
||||
6. Run `./run_before_build.bat` then `build.sh`
|
||||
7. A folder bin/ should exist with `LivePlotter.dll` inside.
|
||||
8. Copy the entire contents of the bin folder (preferably minus the intermediate build files... sorry) to your project's build output directory
|
||||
|
||||
If issues arise, please feel free to create an issue on this repository.
|
||||
@@ -1,8 +0,0 @@
|
||||
[
|
||||
{ "directory": "C:/Users/seth/Documents/repos/LivePlotter", "command": "cl src/body.cpp -I inc -I ext/glm -I ext/glfw/include -Od -std:c++20 -Fo", "file": "src/body.cpp" },
|
||||
{ "directory": "C:/Users/seth/Documents/repos/LivePlotter", "command": "cl src/camera.cpp -I inc -I ext/glm -I ext/glfw/include -Od -std:c++20 -Fo", "file": "src/camera.cpp" },
|
||||
{ "directory": "C:/Users/seth/Documents/repos/LivePlotter", "command": "cl src/demo/demo.cpp -I inc -I ext/glm -I ext/glfw/include -Od -std:c++20 -Fo", "file": "src/demo/demo.cpp" },
|
||||
{ "directory": "C:/Users/seth/Documents/repos/LivePlotter", "command": "cl src/live_plotter.cpp -I inc -I ext/glm -I ext/glfw/include -Od -std:c++20 -Fo", "file": "src/live_plotter.cpp" },
|
||||
{ "directory": "C:/Users/seth/Documents/repos/LivePlotter", "command": "cl src/shaders.cpp -I inc -I ext/glm -I ext/glfw/include -Od -std:c++20 -Fo", "file": "src/shaders.cpp" },
|
||||
{ "directory": "C:/Users/seth/Documents/repos/LivePlotter", "command": "cl src/util.cpp -I inc -I ext/glm -I ext/glfw/include -Od -std:c++20 -Fo", "file": "src/util.cpp" },
|
||||
]
|
||||
28
debug.cap
28
debug.cap
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"rdocCaptureSettings": 1,
|
||||
"settings": {
|
||||
"autoStart": false,
|
||||
"commandLine": "",
|
||||
"environment": [
|
||||
],
|
||||
"executable": "C:\\Users\\sethh\\Documents\\repos\\LivePlotter\\bin\\demo.exe",
|
||||
"inject": false,
|
||||
"numQueuedFrames": 0,
|
||||
"options": {
|
||||
"allowFullscreen": true,
|
||||
"allowVSync": true,
|
||||
"apiValidation": false,
|
||||
"captureAllCmdLists": false,
|
||||
"captureCallstacks": false,
|
||||
"captureCallstacksOnlyDraws": false,
|
||||
"debugOutputMute": true,
|
||||
"delayForDebugger": 0,
|
||||
"hookIntoChildren": false,
|
||||
"refAllResources": false,
|
||||
"softMemoryLimit": 0,
|
||||
"verifyBufferAccess": false
|
||||
},
|
||||
"queuedFrameCap": 0,
|
||||
"workingDir": ""
|
||||
}
|
||||
}
|
||||
15
debug.rad
15
debug.rad
@@ -1,15 +0,0 @@
|
||||
// raddbg 0.9.21 project file
|
||||
|
||||
recent_file: path: "src/live_plotter.cpp"
|
||||
recent_file: path: "src/camera.cpp"
|
||||
recent_file: path: "src/body.cpp"
|
||||
recent_file: path: "src/shaders.cpp"
|
||||
recent_file: path: "../../../../../Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/include/variant"
|
||||
recent_file: path: "../../../../../Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/include/type_traits"
|
||||
recent_file: path: "src/demo/demo.cpp"
|
||||
target:
|
||||
{
|
||||
executable: "bin/demo.exe"
|
||||
working_directory: bin
|
||||
enabled: 1
|
||||
}
|
||||
68
examples/LivePlotter.cs
Normal file
68
examples/LivePlotter.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Common.Data;
|
||||
using pointid = System.UInt64;
|
||||
|
||||
namespace TysonPalletScanner
|
||||
{
|
||||
public class LivePlotter
|
||||
{
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern bool start(int win_w, int win_h);
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern bool stop();
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern pointid create_point(float x, float y, float z);
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern void set_color(pointid id, float r, float g, float b);
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern void set_scale(pointid id, float scale);
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern void update_point(pointid id, float x, float y, float z);
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern void set_lifetime(pointid id, float new_lifetime_s);
|
||||
|
||||
[DllImport("LivePlotter.dll")]
|
||||
public static extern void clear_point(pointid id);
|
||||
|
||||
public static void PlotCameraPoses()
|
||||
{
|
||||
string[] lines = File.ReadAllLines("poses.csv");
|
||||
for (int camera_i = 1; camera_i < lines.Length; camera_i++)
|
||||
{
|
||||
string[] words = lines[camera_i].Split(',');
|
||||
float x = float.Parse(words[0]);
|
||||
float y = float.Parse(words[1]);
|
||||
float z = float.Parse(words[2]);
|
||||
float w = float.Parse(words[3]);
|
||||
float i = float.Parse(words[4]);
|
||||
float j = float.Parse(words[5]);
|
||||
float k = float.Parse(words[6]);
|
||||
|
||||
Pose pose = new(new Quaternion(i, j, k, w), new Vector3(x, y, z));
|
||||
for (int m = 0; m < 3; m++)
|
||||
{
|
||||
for (int n = 0; n < 25; n++)
|
||||
{
|
||||
Vector3 local = new(0);
|
||||
local[m] = n * 10.0f;
|
||||
Vector3 global = pose * local;
|
||||
pointid id = create_point(global.X, global.Y, global.Z);
|
||||
|
||||
Vector3 color = new(0);
|
||||
color[m] = 1.0f;
|
||||
set_color(id, color.X, color.Y, color.Z);
|
||||
set_scale(id, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
ext/glfw
2
ext/glfw
Submodule ext/glfw updated: 63a7e8b7f8...8e15281d34
22
tester.py
22
tester.py
@@ -1,22 +0,0 @@
|
||||
import numpy as np
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import time
|
||||
|
||||
p = subprocess.Popen(Path("bin", "demo.exe"), cwd="bin", stdin=subprocess.PIPE)
|
||||
|
||||
lines = None
|
||||
with open("assets/gpoints_rotate.obj", "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
period = 0.01
|
||||
|
||||
for i in range(len(lines)):
|
||||
time.sleep(period)
|
||||
words = lines[i].split()
|
||||
x = words[1]
|
||||
y = words[2]
|
||||
z = words[3]
|
||||
name = "".join(words[4:])
|
||||
p.stdin.write(f"{name} {x} {y} {z}\n".encode("utf8"))
|
||||
p.stdin.flush()
|
||||
Reference in New Issue
Block a user