From a7500c1aaad49edc759fd75ed847f42fad4ed007 Mon Sep 17 00:00:00 2001 From: Matthias Bodenbenner <matthias.bodenbenner@wzl-iqs.rwth-aachen.de> Date: Fri, 7 Feb 2025 08:14:19 +0100 Subject: [PATCH] added OptiTrack model to demo models --- public/Camera.soil | 31 ++++++ public/Frame.soil | 59 +++++++++++ public/Marker.soil | 70 +++++++++++++ public/OptiTrack.soil | 46 +++++++++ public/RigidBody.soil | 62 +++++++++++ src/features/demoProjects/DemoProjects.tsx | 113 +++++++++++++-------- 6 files changed, 341 insertions(+), 40 deletions(-) create mode 100644 public/Camera.soil create mode 100644 public/Frame.soil create mode 100644 public/Marker.soil create mode 100644 public/OptiTrack.soil create mode 100644 public/RigidBody.soil diff --git a/public/Camera.soil b/public/Camera.soil new file mode 100644 index 0000000..83dd57b --- /dev/null +++ b/public/Camera.soil @@ -0,0 +1,31 @@ +@prefix schema: <http://schema.org/> ; +@prefix dbo: <http://dbpedia.org/ontology/> ; + +import utils; + +variable CameraName defines <schema:name> { + name: "Name" + description: "Name of the camera" + datatype: string + dimension: [] +} + +component Camera defines <dbo:Camera> { + name: "Camera" + description: "Connected Camera" + + parameters: + CameraName name + + measurements: + internal utils.Position position + internal utils.Quaternion orientation +} + +component Cameras { + name: "Cameras" + description: "List of connected Cameras" + + components: + dynamic Camera camera +} \ No newline at end of file diff --git a/public/Frame.soil b/public/Frame.soil new file mode 100644 index 0000000..4edf36b --- /dev/null +++ b/public/Frame.soil @@ -0,0 +1,59 @@ +@prefix quantitykind: <https://qudt.org/vocab/quantitykind/> ; +@prefix unit: <http://qudt.org/vocab/unit/> ; +@prefix qudt: <http://qudt.org/schema/qudt/>; +@prefix schema: <http://schema.org/> ; +@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> ; + +variable Latency defines <quantitykind:Time> { + name: "Latency" + description: "Measured latency" + datatype: float + range: (0.0,) + dimension: [] + unit: <unit:MilliSEC> +} + +variable Timestamp defines <qudt:DATETIME> { + name: "Timestamp" + description: "Timestamp of the current frame" + datatype: float + range: (0.0,) + dimension: [] + unit: <unit:MilliSEC> +} + + +variable FrameID defines <schema:identifier> { + name: "Frame ID" + description: "ID of the current frame" + datatype: int + range: (0,) + dimension: [] + unit: <unit:UNITLESS> +} + +component Frame defines <ebucore:Keyframe>{ + name: "Frame" + description: "Information about the current frame" + + measurements: + internal FrameID frameID + internal Timestamp timestamp + internal Latency softwareLatency + internal Latency systemLatency + internal Latency transitLatency + internal Latency clientLatency + + streams: + frameID: update + timestamp: update + softwareLatency: update + systemLatency: update + transitLatency: update + clientLatency: update + + softwareLatency.name = "Software Latency" + systemLatency.name = "System Latency" + transitLatency.name = "Transit Latency" + clientLatency.name = "Client Latency" +} \ No newline at end of file diff --git a/public/Marker.soil b/public/Marker.soil new file mode 100644 index 0000000..eb896b0 --- /dev/null +++ b/public/Marker.soil @@ -0,0 +1,70 @@ +@prefix quantitykind: <https://qudt.org/vocab/quantitykind/> ; +@prefix unit: <http://qudt.org/vocab/unit/> ; +@prefix schema: <http://schema.org/> ; +@prefix dbo: <http://dbpedia.org/ontology/> ; + +import utils; + +enum MarkerTypes { + ACTIVE + UNLABELED + LABELED +} + +variable Type defines <schema:type> { + name: "Type" + description: "Type of the marker" + datatype: enum + range: MarkerTypes + dimension: [] +} + +variable ID defines <schema:identifier> { + name: "Marker ID" + description: "ID of the marker" + datatype: string + dimension: [] +} + +variable Name defines <schema:name> { + name: "Marker Name" + description: "Name of the marker" + datatype: string + dimension: [] +} + +variable Size defines <quantitykind:Diameter> { + name: "Marker Size" + description: "Size of the marker" + datatype: float + range: (0.0,) + dimension: [] + unit: <unit:M> +} + + +component Marker { + name: "Marker" + description: "Detected Marker" + + parameters: + Name name + ID id #readonly + + measurements: + utils.Position position + Size size + + streams: + position: update + size: update + +} + +component Markers { + name: "Markers" + description: "List of detected Markers" + + components: + dynamic Marker marker +} diff --git a/public/OptiTrack.soil b/public/OptiTrack.soil new file mode 100644 index 0000000..3c00918 --- /dev/null +++ b/public/OptiTrack.soil @@ -0,0 +1,46 @@ +@prefix schema: <http://schema.org/>; + +import utils; +import Camera; +import Marker; +import Frame; +import RigidBody; + +variable Time defines <schema:DateTime> { + name: "Time" + description: "Current UTC system time." + datatype: time + dimension: [] +} + +variable APIVersion defines <schema:version> { + name: "API Version" + description: "NatNet SDK Version" + datatype: string + dimension: [] +} + +variable Manufacturer defines <schema:manufacturer> { + name: "Manufacturer" + description: "Name of the manufacturer of the device." + datatype: string + dimension: [] +} + +component OptiTrackSystem { + name: "OptiTrack" + description: "OptiTrack motion capture system" + components: + Frame.Frame frame + Camera.Cameras cameras + Marker.Markers markers + RigidBody.RigidBodys rigidBodys + + parameters: + utils.State state = OK + constant Manufacturer manufacturer = "NaturalPoint Inc." + APIVersion version + Time time +} + +interface OptiTrackSystem OptiTrack {} \ No newline at end of file diff --git a/public/RigidBody.soil b/public/RigidBody.soil new file mode 100644 index 0000000..aee3e1d --- /dev/null +++ b/public/RigidBody.soil @@ -0,0 +1,62 @@ +@prefix quantitykind: <https://qudt.org/vocab/quantitykind/> ; +@prefix unit: <http://qudt.org/vocab/unit/> ; +@prefix schema: <http://schema.org/> ; +@prefix dbo: <http://dbpedia.org/ontology/> ; + +import utils; + +variable Name defines <schema:name> { + name: "Name" + description: "Name of the rigid body" + datatype: string + dimension: [] +} + +enum TrackingStates { + VALID + NOTVALID +} + +variable TrackingState defines <dbo:status> { + name: "State" + description: "State of the rigid body" + datatype: enum + range: TrackingStates + dimension: [] +} + +variable MeanError defines <quantitykind:Distance> { + name: "Mean Error" + description: "Mean Error of the ridid body" + datatype: float + range: (0.0,) + dimension: [] + unit: <unit:M> +} + + +component RigidBody { + name: "Rigid Body" + description: "Tracked Rigid Body" + + parameters: + Name name + TrackingState state + measurements: + utils.Position position + utils.Quaternion orientation + MeanError meanError + streams: + position: update + orientation: update + meanError: update + +} + +component RigidBodys { + name: "RigidBodys" + description: "List of detected RigidBodys" + + components: + dynamic RigidBody rigidBody +} \ No newline at end of file diff --git a/src/features/demoProjects/DemoProjects.tsx b/src/features/demoProjects/DemoProjects.tsx index aedbe0b..82fd86a 100644 --- a/src/features/demoProjects/DemoProjects.tsx +++ b/src/features/demoProjects/DemoProjects.tsx @@ -4,7 +4,7 @@ import IconButton from '@mui/material/IconButton'; import CloudDownloadIcon from '@mui/icons-material/CloudDownload'; import { useAppDispatch } from '../../store/hooks'; import { addTextModel, importPrivateProject, Project, selectPrivateProjects } from '../soil-editor/soileditorSlice'; -import { Tooltip, Divider, Avatar, ListItemAvatar, ListItem, ListItemText, List} from '@mui/material'; +import { Tooltip, Divider, Avatar, ListItemAvatar, ListItem, ListItemText, List } from '@mui/material'; export function DemoProjects() { const dispatch = useAppDispatch() @@ -20,17 +20,32 @@ export function DemoProjects() { const addLaserTrackerModel = () => { fetch("/../../soil/lasertracker.soil").then(file => file.text()).then(lasertracker => { fetch("/../../soil/base_stations.soil").then(file2 => file2.text()).then(base_stations => { - fetch("/../../soil/mobile_entities.soil").then(file3 => file3.text()).then(mobile_entities => { - fetch("/../../soil/utils.soil").then(file4 => file4.text()).then(utils => { - dispatch(addTextModel(["Lasertracker", "lasertracker", lasertracker, "mobile_entities", mobile_entities, "base_stations", base_stations, "utils", utils])) + fetch("/../../soil/mobile_entities.soil").then(file3 => file3.text()).then(mobile_entities => { + fetch("/../../soil/utils.soil").then(file4 => file4.text()).then(utils => { + dispatch(addTextModel(["Lasertracker", "lasertracker", lasertracker, "mobile_entities", mobile_entities, "base_stations", base_stations, "utils", utils])) + }) }) - }) }) }); } - return ( - <List sx={{overflowY: "auto", width: '100%', bgcolor: 'background.paper' }}> - <div key={"DemoProjectRobot"}><ListItem secondaryAction={ + const addOptiTrackModel = () => { + fetch("/../../soil/OptiTrack.soil").then(file => file.text()).then(optitrack => { + fetch("/../../soil/Camera.soil").then(file2 => file2.text()).then(camera => { + fetch("/../../soil/Frame.soil").then(file3 => file3.text()).then(frame => { + fetch("/../../soil/Marker.soil").then(file3 => file3.text()).then(marker => { + fetch("/../../soil/RigidBody.soil").then(file3 => file3.text()).then(rigidbody => { + fetch("/../../soil/utils.soil").then(file4 => file4.text()).then(utils => { + dispatch(addTextModel(["OptiTrack", "OptiTrack", optitrack, "Camera", camera, "Frame", frame, "Marker", marker, "RigidBody", rigidbody, "utils", utils])) + }) + }) + }) + }) + }) + }); + } + return ( + <List sx={{ overflowY: "auto", width: '100%', bgcolor: 'background.paper' }}> + <div key={"DemoProjectRobot"}><ListItem secondaryAction={ <IconButton onClick={addRobotModel} edge="end" aria-label="comments"> <Tooltip title="Import this Project"> <div> @@ -38,17 +53,17 @@ export function DemoProjects() { </div> </Tooltip> </IconButton> - }> - <ListItemAvatar> - <Avatar> - <ImageIcon /> - </Avatar> - </ListItemAvatar> - <ListItemText primary={<div>{"Robot"}<small> {"1.0"}</small></div>}/> + }> + <ListItemAvatar> + <Avatar> + <ImageIcon /> + </Avatar> + </ListItemAvatar> + <ListItemText primary={<div>{"Robot"}<small> {"1.0"}</small></div>} /> </ListItem> - <Divider variant="inset" component="li" /> - </div> - <div key={"DemoProjectMonitoring"}><ListItem secondaryAction={ + <Divider variant="inset" component="li" /> + </div> + <div key={"DemoProjectMonitoring"}><ListItem secondaryAction={ <IconButton onClick={addMonitoringModel} edge="end" aria-label="comments"> <Tooltip title="Import this Project"> <div> @@ -56,17 +71,17 @@ export function DemoProjects() { </div> </Tooltip> </IconButton> - }> - <ListItemAvatar> - <Avatar> - <ImageIcon /> - </Avatar> - </ListItemAvatar> - <ListItemText primary={<div>{"Monitoring"}<small> {"1.0"}</small></div>}/> + }> + <ListItemAvatar> + <Avatar> + <ImageIcon /> + </Avatar> + </ListItemAvatar> + <ListItemText primary={<div>{"Monitoring"}<small> {"1.0"}</small></div>} /> </ListItem> - <Divider variant="inset" component="li" /> - </div> - <div key={"DemoProjectLasertracker"}><ListItem secondaryAction={ + <Divider variant="inset" component="li" /> + </div> + <div key={"DemoProjectLasertracker"}><ListItem secondaryAction={ <IconButton onClick={addLaserTrackerModel} edge="end" aria-label="comments"> <Tooltip title="Import this Project"> <div> @@ -74,16 +89,34 @@ export function DemoProjects() { </div> </Tooltip> </IconButton> - }> - <ListItemAvatar> - <Avatar> - <ImageIcon /> - </Avatar> - </ListItemAvatar> - <ListItemText primary={<div>{"Lasertracker"}<small> {"1.0"}</small></div>}/> + }> + <ListItemAvatar> + <Avatar> + <ImageIcon /> + </Avatar> + </ListItemAvatar> + <ListItemText primary={<div>{"Lasertracker"}<small> {"1.0"}</small></div>} /> + </ListItem> + <Divider variant="inset" component="li" /> + </div> + <div key={"DemoProjectOptiTrack"}><ListItem secondaryAction={ + <IconButton onClick={addOptiTrackModel} edge="end" aria-label="comments"> + <Tooltip title="Import this Project"> + <div> + <CloudDownloadIcon /> + </div> + </Tooltip> + </IconButton> + }> + <ListItemAvatar> + <Avatar> + <ImageIcon /> + </Avatar> + </ListItemAvatar> + <ListItemText primary={<div>{"OptiTrack"}<small> {"1.0"}</small></div>} /> </ListItem> - <Divider variant="inset" component="li" /> - </div> - </List> - ); -} \ No newline at end of file + <Divider variant="inset" component="li" /> + </div> + </List> + ); + } \ No newline at end of file -- GitLab