@viamrobotics/motion-tools 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,7 +10,9 @@ import { observe } from '@threlte/core';
|
|
|
10
10
|
import { untrack } from 'svelte';
|
|
11
11
|
import { useFrames } from './useFrames.svelte';
|
|
12
12
|
import { RefetchRates } from '../components/RefreshRate.svelte';
|
|
13
|
+
import { useLogs } from './useLogs.svelte';
|
|
13
14
|
export const usePose = (name, parent) => {
|
|
15
|
+
const logs = useLogs();
|
|
14
16
|
const { refreshRates } = useMachineSettings();
|
|
15
17
|
const partID = usePartID();
|
|
16
18
|
const motionClient = useMotionClient();
|
|
@@ -31,6 +33,7 @@ export const usePose = (name, parent) => {
|
|
|
31
33
|
if (!client.current) {
|
|
32
34
|
throw new Error('No client');
|
|
33
35
|
}
|
|
36
|
+
logs.add(`Fetching pose for ${name()}...`);
|
|
34
37
|
const resolvedParent = parentResource?.subtype === 'arm' ? `${parent()}_origin` : parent();
|
|
35
38
|
const pose = await client.current.getPose(name(), resolvedParent ?? 'world', []);
|
|
36
39
|
return pose;
|
|
@@ -42,6 +45,11 @@ export const usePose = (name, parent) => {
|
|
|
42
45
|
untrack(() => query.current).refetch();
|
|
43
46
|
}
|
|
44
47
|
});
|
|
48
|
+
$effect(() => {
|
|
49
|
+
if (query.current.error) {
|
|
50
|
+
logs.add(query.current.error.message, 'error');
|
|
51
|
+
}
|
|
52
|
+
});
|
|
45
53
|
return {
|
|
46
54
|
get current() {
|
|
47
55
|
/**
|