Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion express.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,4 @@ app.listen(config.server.port, () => {
function setCrossOriginIsolationHeaders(res) {
res.header("Cross-Origin-Opener-Policy", "same-origin");
res.header("Cross-Origin-Embedder-Policy", "require-corp");
}
}
16 changes: 10 additions & 6 deletions src/components/World/NodeSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ const TEMPLATES = {
['Blue Drink', 'drink_blue'],
['Green Drink', 'drink_green'],
['Pink Drink', 'drink_pink'],
['Blue Pom (Ice Cube)', 'pom_blue'],
['Orange Pom (Hot Sauce)', 'pom_orange'],
['Red Pom (Ketchup)', 'pom_red'],
['Yellow Pom (Mustard)', 'pom_yellow'],
['Blue Pom', 'pom_blue'],
['Orange Pom', 'pom_orange'],
['Red Pom', 'pom_red'],
['Yellow Pom', 'pom_yellow'],
['French Fry', 'french_fry'],
['Hamburger', 'hamburger'],
['Hotdog', 'hotdog'],
Expand All @@ -85,8 +85,12 @@ const TEMPLATES = {
['Pallet', 'pallet'],
['Blue Pom', 'pomBlue2In'],
['Traffic Cone', 'trafficCone'],
['2 Inch PVC', 'pcv2In']

['2 Inch PVC', 'pcv2In'],
['Sliding Door', 'slidingDoor'],
['2 Inch Blue PVC', 'pvc2inBlue'],
['2 Inch Pink PVC', 'pvc2inPink'],
['Dropper', 'dropper26'],
['Gate', 'gate'],
],
RADIATION: [
// ['Radiation Science Pack - Low', 'noradscience'],
Expand Down
115 changes: 105 additions & 10 deletions src/simulator/definitions/nodes/2026gameTableTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ import { PhysicsMotionType } from "@babylonjs/core";

// TODO: Consider deep-freezing all of these objects

const gameTable2026Template: Node.TemplatedNode<Node.Obj> = {
const fallTable26Template: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'gameTable2026',
geometryId: 'fallTable26',
physics: {
type: 'mesh',
motionType: PhysicsMotionType.STATIC,
restitution: .2,
friction: 1,
},
};
const springTable26Template: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'springTable26',
physics: {
type: 'mesh',
motionType: PhysicsMotionType.STATIC,
Expand All @@ -24,13 +34,13 @@ const basketTemplate: Node.TemplatedNode<Node.Obj> = {
motionType: PhysicsMotionType.DYNAMIC,
mass: Mass.grams(30),
restitution: 0.2,
friction: 2
friction: .3
}
};
const CUBEPHYSICS: Node.Physics = {
type: 'box',
motionType: PhysicsMotionType.DYNAMIC,
mass: Mass.grams(5),
mass: Mass.grams(2),
restitution: 0.4,
friction: 4
};
Expand Down Expand Up @@ -68,9 +78,9 @@ const palletTemplate: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'pallet',
physics: {
type: 'mesh',
type: 'box',
motionType: PhysicsMotionType.DYNAMIC,
mass: Mass.grams(5),
mass: Mass.grams(1),
restitution: 0.2,
friction: 4
}
Expand Down Expand Up @@ -108,9 +118,65 @@ const pcv2inTemplate: Node.TemplatedNode<Node.Obj> = {
friction: 3.75
}
};
const slidingDoorTemplate: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'slidingDoor',
physics: {
type: 'mesh',
motionType: PhysicsMotionType.DYNAMIC,
mass: Mass.grams(11),
restitution: 0.2,
friction: 0.3
}
};
const pvc2inBlueTemplate: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'pvc2inBlue',
physics: {
type: 'cylinder',
motionType: PhysicsMotionType.DYNAMIC,
mass: Mass.grams(11),
restitution: 0.2,
friction: 0.3
}
};
const pvc2inPinkTemplate: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'pvc2inPink',
physics: {
type: 'cylinder',
motionType: PhysicsMotionType.DYNAMIC,
mass: Mass.grams(11),
restitution: 0.2,
friction: 0.3
}
};
const dropper26Template: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'dropper',
physics: {
type: 'mesh',
motionType: PhysicsMotionType.STATIC,
mass: Mass.grams(11),
restitution: 0.3,
friction: 0.2
}
};
const gateTemplate: Node.TemplatedNode<Node.Obj> = {
type: 'object',
geometryId: 'gate',
physics: {
type: 'mesh',
motionType: PhysicsMotionType.STATIC,
mass: Mass.grams(11),
restitution: 0,
friction: 1
}
};

export const BB2026Templates = Object.freeze<Dict<Node.TemplatedNode<Node>>>({
'gameTable2026': gameTable2026Template,
'fallTable26': fallTable26Template,
'springTable26': springTable26Template,
'basket': basketTemplate,
'cubeBrown4In': cubeBrown4inTemplate,
'cubeGreen2In': cubeGreen2inTemplate,
Expand All @@ -121,15 +187,24 @@ export const BB2026Templates = Object.freeze<Dict<Node.TemplatedNode<Node>>>({
'pallet': palletTemplate,
'pomBlue2In': pomBlue2inTemplate,
'trafficCone': trafficConeTemplate,
'pcv2In': pcv2inTemplate
'pcv2In': pcv2inTemplate,
'slidingDoor': slidingDoorTemplate,
'pvc2inBlue': pvc2inBlueTemplate,
'pvc2inPink': pvc2inPinkTemplate,
'dropper26': dropper26Template,
'gate': gateTemplate
});


export const BB2026Geometries = Object.freeze<Dict<Geometry>>({
'gameTable2026': {
'fallTable26': {
type: 'file',
uri: '/static/object_binaries/2026_Fall_Table.glb',
},
'springTable26': {
type: 'file',
uri: '/static/object_binaries/2026_Table.glb',
},
'basket': {
type: 'file',
uri: '/static/object_binaries/Basket.glb'
Expand Down Expand Up @@ -173,5 +248,25 @@ export const BB2026Geometries = Object.freeze<Dict<Geometry>>({
'pvc2In': {
type: 'file',
uri: '/static/object_binaries/PVC2in.glb'
}
},
'slidingDoor': {
type: 'file',
uri: '/static/object_binaries/Sliding_Door.glb'
},
'pvc2inBlue': {
type: 'file',
uri: '/static/object_binaries/PVC2in_Blue.glb'
},
'pvc2inPink': {
type: 'file',
uri: '/static/object_binaries/PVC2in_Pink.glb'
},
'dropper': {
type: 'file',
uri: '/static/object_binaries/2026_Dropper.glb'
},
'gate': {
type: 'file',
uri: '/static/object_binaries/gate.glb'
},
});
16 changes: 16 additions & 0 deletions src/simulator/definitions/robots/demobot_no_reflectance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Robot from "../../../state/State/Robot";
import Geometry from "../../../state/State/Robot/Geometry";
import { DEMOBOT } from "./demobot";

/**
* Special demobot with no collision box over the reflectance sensor.
* When it has the collider, it can't drive straight up the ramp because the
* wheels always leave the ground.
*/
export const DEMOBOT_NO_REFLECTANCE: Robot = {
...DEMOBOT,
geometry: {
...DEMOBOT.geometry,
chassis_link: Geometry.remoteMesh({ uri: '/static/object_binaries/chassis_no_reflectance.glb' }),
},
};
3 changes: 2 additions & 1 deletion src/simulator/definitions/robots/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './demobot';
export * from './createbot';
export * from './createbot';
export * from './demobot_no_reflectance';
4 changes: 2 additions & 2 deletions src/simulator/definitions/scenes/26fallTableBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const ROBOT: Node.Robot = {

const GAME_TABLE_2026: Node.FromBBTemplate = {
type: 'from-bb-template',
name: tr('2026 Fall Game Table'),
templateId: 'gameTable2026',
name: tr('2026 Botball Fall Game Table'),
templateId: 'fallTable26',
visible: true,
editable: false,
startingOrigin: GAME_TABLE_ORIGIN,
Expand Down
89 changes: 89 additions & 0 deletions src/simulator/definitions/scenes/26springTableBase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { ReferenceFramewUnits, RotationwUnits, Vector3wUnits } from '../../../util/math/unitMath';
import { Distance } from '../../../util';
import Node from '../../../state/State/Scene/Node';
import Camera from '../../../state/State/Scene/Camera';
import Scene from '../../../state/State/Scene';
import AbstractRobot from '../../../programming/AbstractRobot';
import Author from '../../../db/Author';

import tr from '@i18n';

const ROBOT_ORIGIN: ReferenceFramewUnits = {
position: Vector3wUnits.centimeters(3, 0, 0),
// position: Vector3wUnits.centimeters(80, 0, 62.5),
orientation: RotationwUnits.eulerDegrees(0, 0, 0),
};

const GAME_TABLE_ORIGIN: ReferenceFramewUnits = {
position: Vector3wUnits.centimeters(45, -6, 100),
orientation: RotationwUnits.eulerDegrees(0, 180, 0),
// scale: { x: 100, y: 100, z: 100 },
};

const LIGHT_ORIGIN: ReferenceFramewUnits = {
position: Vector3wUnits.centimeters(50, 90, 50)
};

/**
* Special demobot with no collision box over the reflectance sensor.
* When it has the collider, it can't drive straight up the ramp because the
* wheels always leave the ground.
*/
const ROBOT: Node.Robot = {
type: 'robot',
name: tr('Robot'),
robotId: 'demobot_no_reflectance',
state: AbstractRobot.Stateless.NIL,
visible: true,
startingOrigin: ROBOT_ORIGIN,
origin: ROBOT_ORIGIN
};

const GAME_TABLE_2026: Node.FromBBTemplate = {
type: 'from-bb-template',
name: tr('2026 Botball Spring Game Table'),
templateId: 'springTable26',
visible: true,
editable: false,
startingOrigin: GAME_TABLE_ORIGIN,
origin: GAME_TABLE_ORIGIN
};

export function createBaseSceneSurface(): Scene {
return {
name: tr('Base Scene - 2026 Botball Game Table'),
description: tr('A base scene. Intended to be augmented to create the full game table'),
author: Author.organization('kipr'),
geometry: {},
nodes: {
'robot': ROBOT,
'game_table_2026': GAME_TABLE_2026,
'light0': {
type: 'point-light',
intensity: 0.8,
name: tr('Light'),
startingOrigin: LIGHT_ORIGIN,
origin: LIGHT_ORIGIN,
visible: true
},
},
camera: Camera.arcRotate({
radius: Distance.meters(5),
target: {
x: Distance.meters(0),
y: Distance.meters(0.05),
z: Distance.meters(0),
},
position: {
x: Distance.meters(-0.75),
y: Distance.meters(0.75),
z: Distance.meters(-1.25),
}
}),
gravity: {
x: Distance.meters(0),
y: Distance.meters(-9.8 * 0.4),
z: Distance.meters(0),
}
};
}
Loading