Spaces:
Running
Running
Update
Browse files
external/RobotHub-InferenceServer
CHANGED
@@ -1 +1 @@
|
|
1 |
-
Subproject commit
|
|
|
1 |
+
Subproject commit f9fa7dd994ca68d54b19d97d4774534c50721276
|
src/lib/elements/robot/drivers/RemoteConsumer.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import type { Consumer, ConnectionStatus, RobotCommand, RemoteDriverConfig } from '../models.js';
|
2 |
import { robotics } from "@robothub/transport-server-client";
|
|
|
3 |
|
4 |
export class RemoteConsumer implements Consumer {
|
5 |
readonly id: string;
|
@@ -44,19 +45,19 @@ export class RemoteConsumer implements Consumer {
|
|
44 |
console.log(`[RemoteConsumer] Disconnected from room ${this.config.robotId}`);
|
45 |
});
|
46 |
|
47 |
-
this.consumer.onError((error) => {
|
48 |
console.error(`[RemoteConsumer] Error:`, error);
|
49 |
this._status = { isConnected: false, error: `Consumer error: ${error}` };
|
50 |
this.notifyStatusChange();
|
51 |
});
|
52 |
|
53 |
// RECEIVE joint updates and forward as normalized commands
|
54 |
-
this.consumer.onJointUpdate((joints) => {
|
55 |
console.debug(`[RemoteConsumer] Received joint update:`, joints);
|
56 |
|
57 |
const command: RobotCommand = {
|
58 |
timestamp: Date.now(),
|
59 |
-
joints: joints.map(joint => ({
|
60 |
name: joint.name,
|
61 |
value: joint.value, // Already normalized from server
|
62 |
}))
|
@@ -65,7 +66,7 @@ export class RemoteConsumer implements Consumer {
|
|
65 |
});
|
66 |
|
67 |
// RECEIVE state sync
|
68 |
-
this.consumer.onStateSync((state) => {
|
69 |
console.debug(`[RemoteConsumer] Received state sync:`, state);
|
70 |
|
71 |
const joints = Object.entries(state).map(([name, value]) => ({
|
|
|
1 |
import type { Consumer, ConnectionStatus, RobotCommand, RemoteDriverConfig } from '../models.js';
|
2 |
import { robotics } from "@robothub/transport-server-client";
|
3 |
+
import type { JointData } from "@robothub/transport-server-client/robotics";
|
4 |
|
5 |
export class RemoteConsumer implements Consumer {
|
6 |
readonly id: string;
|
|
|
45 |
console.log(`[RemoteConsumer] Disconnected from room ${this.config.robotId}`);
|
46 |
});
|
47 |
|
48 |
+
this.consumer.onError((error: string) => {
|
49 |
console.error(`[RemoteConsumer] Error:`, error);
|
50 |
this._status = { isConnected: false, error: `Consumer error: ${error}` };
|
51 |
this.notifyStatusChange();
|
52 |
});
|
53 |
|
54 |
// RECEIVE joint updates and forward as normalized commands
|
55 |
+
this.consumer.onJointUpdate((joints: JointData[]) => {
|
56 |
console.debug(`[RemoteConsumer] Received joint update:`, joints);
|
57 |
|
58 |
const command: RobotCommand = {
|
59 |
timestamp: Date.now(),
|
60 |
+
joints: joints.map((joint: JointData) => ({
|
61 |
name: joint.name,
|
62 |
value: joint.value, // Already normalized from server
|
63 |
}))
|
|
|
66 |
});
|
67 |
|
68 |
// RECEIVE state sync
|
69 |
+
this.consumer.onStateSync((state: Record<string, number>) => {
|
70 |
console.debug(`[RemoteConsumer] Received state sync:`, state);
|
71 |
|
72 |
const joints = Object.entries(state).map(([name, value]) => ({
|
src/lib/elements/robot/drivers/RemoteProducer.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import type { Producer, ConnectionStatus, RobotCommand, RemoteDriverConfig } from '../models.js';
|
2 |
import { robotics } from "@robothub/transport-server-client";
|
|
|
3 |
|
4 |
export class RemoteProducer implements Producer {
|
5 |
readonly id: string;
|
@@ -49,7 +50,7 @@ export class RemoteProducer implements Producer {
|
|
49 |
this.stopStateUpdates();
|
50 |
});
|
51 |
|
52 |
-
this.producer.onError((error) => {
|
53 |
console.error(`[RemoteProducer] Error:`, error);
|
54 |
this._status = { isConnected: false, error: `Producer error: ${error}` };
|
55 |
this.notifyStatusChange();
|
|
|
1 |
import type { Producer, ConnectionStatus, RobotCommand, RemoteDriverConfig } from '../models.js';
|
2 |
import { robotics } from "@robothub/transport-server-client";
|
3 |
+
import type { JointData } from "@robothub/transport-server-client/robotics";
|
4 |
|
5 |
export class RemoteProducer implements Producer {
|
6 |
readonly id: string;
|
|
|
50 |
this.stopStateUpdates();
|
51 |
});
|
52 |
|
53 |
+
this.producer.onError((error: string) => {
|
54 |
console.error(`[RemoteProducer] Error:`, error);
|
55 |
this._status = { isConnected: false, error: `Producer error: ${error}` };
|
56 |
this.notifyStatusChange();
|