Spaces:
Running
Running
File size: 1,554 Bytes
6ce4ca6 3cdf7b9 6ce4ca6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
<!-- From https://github.com/brean/urdf-viewer -->
<script lang="ts">
// Three.js visualization of an URDF.
import { T } from "@threlte/core";
import { getRootLinks } from "../utils/UrdfParser";
import UrdfLink from "./UrdfLink.svelte";
import type IUrdfRobot from "../interfaces/IUrdfRobot";
interface Props {
robot: IUrdfRobot;
position?: [x: number, y: number, z: number];
quaternion?: [x: number, y: number, z: number, w: number];
showName?: boolean;
showVisual?: boolean;
showCollision?: boolean;
visualOpacity?: number;
collisionOpacity?: number;
collisionColor?: string;
jointNames?: boolean;
joints?: boolean;
jointColor?: string;
jointIndicatorColor?: string;
nameHeight?: number;
textScale?: number;
}
let {
robot,
position = [0, 0, 0],
quaternion = [0, 0, 0, 1],
showName = true,
showVisual = true,
showCollision = true,
visualOpacity = 1,
collisionOpacity = 1,
collisionColor = "#000000",
jointNames = true,
joints = true,
jointColor = "#000000",
jointIndicatorColor = "#000000",
nameHeight = 0.1,
textScale = 1
}: Props = $props();
</script>
<T.Group {position} {quaternion} scale={[10, 10, 10]} rotation={[-Math.PI / 2, 0, 0]}>
{#each getRootLinks(robot) as link}
<UrdfLink
{robot}
{link}
{textScale}
{showName}
{showVisual}
{showCollision}
{visualOpacity}
{collisionOpacity}
{collisionColor}
{jointNames}
{joints}
{jointColor}
{jointIndicatorColor}
{nameHeight}
showLine={false}
opacity={1}
/>
{/each}
</T.Group>
|