Observer embryo, Maestro done
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { publishActionReply, parseAt } from '../../actionsHelper.js'
|
||||
import { publishActionReply, parseSimTime } from '../../actionsHelper.js'
|
||||
|
||||
export const methods = {
|
||||
|
||||
@@ -8,7 +8,7 @@ export const methods = {
|
||||
"reqid": "6az5e4r6a",
|
||||
"payload": {
|
||||
"agentId": "agent42",
|
||||
"at": "2026-06-07T12:00:00.000Z"
|
||||
"t": 12.5
|
||||
}
|
||||
}
|
||||
Event-Tx:
|
||||
@@ -21,9 +21,9 @@ export const methods = {
|
||||
"id": "agent42",
|
||||
"position": { "x": 1, "y": 2, "z": 3 },
|
||||
"vector": { "x": 0, "y": 0, "z": 0 },
|
||||
"since": 1717750800,
|
||||
"since": 0,
|
||||
"generation": 2,
|
||||
"at": "2026-06-07T12:00:00.000Z"
|
||||
"t": 12.5
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,14 @@ export const methods = {
|
||||
return
|
||||
}
|
||||
|
||||
if(!this.gpsSrv.isLive()) {
|
||||
publishActionReply(this, { ...replyOpts, reply: {
|
||||
success: false,
|
||||
err: 'Simulation not live',
|
||||
} })
|
||||
return
|
||||
}
|
||||
|
||||
const agentId = payload?.agentId
|
||||
if(!agentId || typeof(agentId) !== 'string') {
|
||||
publishActionReply(this, { ...replyOpts, reply: {
|
||||
@@ -52,11 +60,11 @@ export const methods = {
|
||||
return
|
||||
}
|
||||
|
||||
const at = parseAt(payload, () => this.gpsSrv.now())
|
||||
const at = parseSimTime(payload, () => this.gpsSrv.now())
|
||||
if(at === null) {
|
||||
publishActionReply(this, { ...replyOpts, reply: {
|
||||
success: false,
|
||||
err: 'Invalid at timestamp',
|
||||
err: 'Invalid simulation time',
|
||||
} })
|
||||
return
|
||||
}
|
||||
@@ -86,17 +94,7 @@ export const methods = {
|
||||
"yMin": -10, "yMax": 10,
|
||||
"zMin": 0, "zMax": 5
|
||||
},
|
||||
"at": "2026-06-07T12:00:00.000Z"
|
||||
}
|
||||
}
|
||||
Event-Tx:
|
||||
{
|
||||
"action": "GETAGENTSINPRISM",
|
||||
"success": true,
|
||||
"reqid": "6az5e4r6a",
|
||||
"payload": {
|
||||
"agents": [ ... ],
|
||||
"at": "2026-06-07T12:00:00.000Z"
|
||||
"t": 0
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -115,6 +113,14 @@ export const methods = {
|
||||
return
|
||||
}
|
||||
|
||||
if(!this.gpsSrv.isLive()) {
|
||||
publishActionReply(this, { ...replyOpts, reply: {
|
||||
success: false,
|
||||
err: 'Simulation not live',
|
||||
} })
|
||||
return
|
||||
}
|
||||
|
||||
const prism = payload?.prism
|
||||
if(!this.gpsSrv.isValidPrism(prism)) {
|
||||
publishActionReply(this, { ...replyOpts, reply: {
|
||||
@@ -124,11 +130,11 @@ export const methods = {
|
||||
return
|
||||
}
|
||||
|
||||
const at = parseAt(payload, () => this.gpsSrv.now())
|
||||
const at = parseSimTime(payload, () => this.gpsSrv.now())
|
||||
if(at === null) {
|
||||
publishActionReply(this, { ...replyOpts, reply: {
|
||||
success: false,
|
||||
err: 'Invalid at timestamp',
|
||||
err: 'Invalid simulation time',
|
||||
} })
|
||||
return
|
||||
}
|
||||
@@ -138,7 +144,7 @@ export const methods = {
|
||||
success: true,
|
||||
payload: {
|
||||
agents,
|
||||
at: new Date(at * 1000).toISOString(),
|
||||
t: at,
|
||||
},
|
||||
} })
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user