feat: Implement ArmBot simulation with IK animation and event handling

- Added ArmBot component to manage ArmBot instances in the simulation.
- Created ArmBotInstances component to render individual ArmBot models.
- Developed IKAnimationController for handling inverse kinematics during animations.
- Introduced IkInstances component to load and manage IK-enabled arm models.
- Defined simulation types for ArmBot events and connections in TypeScript.
- Enhanced type definitions for better clarity and maintainability.
This commit is contained in:
2025-04-14 18:16:53 +05:30
parent ba215dd0d3
commit 37df5e8801
32 changed files with 923 additions and 949 deletions

View File

@@ -17,7 +17,7 @@ import {
useSocketStore,
} from "../../../../store/store";
import * as THREE from "three";
import * as Types from "../../../../types/world/worldTypes";
import * as SimulationTypes from "../../../../types/simulation";
import InputToggle from "../../../ui/inputs/InputToggle";
import { setFloorItemApi } from "../../../../services/factoryBuilder/assest/floorAsset/setFloorItemApi";
import { setEventApi } from "../../../../services/factoryBuilder/assest/floorAsset/setEventsApt";
@@ -36,13 +36,13 @@ const ConveyorMechanics: React.FC = () => {
if (!selectedActionSphere) return null;
return simulationStates
.filter(
(path): path is Types.ConveyorEventsSchema => path.type === "Conveyor"
(path): path is SimulationTypes.ConveyorEventsSchema => path.type === "Conveyor"
)
.flatMap((path) => path.points)
.find((point) => point.uuid === selectedActionSphere.points.uuid);
}, [selectedActionSphere, simulationStates]);
const updateBackend = async (updatedPath: Types.ConveyorEventsSchema | undefined) => {
const updateBackend = async (updatedPath: SimulationTypes.ConveyorEventsSchema | undefined) => {
if (!updatedPath) return;
const email = localStorage.getItem("email");
const organization = email ? email.split("@")[1].split(".")[0] : "";
@@ -93,7 +93,7 @@ const ConveyorMechanics: React.FC = () => {
});
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -126,7 +126,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -174,7 +174,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -188,7 +188,7 @@ const ConveyorMechanics: React.FC = () => {
if (selectedItem?.type === "action" && selectedItem.item.uuid === uuid) {
const updatedAction = updatedPaths
.filter(
(path): path is Types.ConveyorEventsSchema => path.type === "Conveyor"
(path): path is SimulationTypes.ConveyorEventsSchema => path.type === "Conveyor"
)
.flatMap((path) => path.points)
.find((p) => p.uuid === selectedActionSphere.points.uuid)
@@ -229,7 +229,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -273,7 +273,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -311,7 +311,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -330,7 +330,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.modeluuid === selectedPath.path.modeluuid
);
@@ -367,7 +367,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -400,7 +400,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -435,7 +435,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -479,7 +479,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -525,7 +525,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid
@@ -571,7 +571,7 @@ const ConveyorMechanics: React.FC = () => {
);
const updatedPath = updatedPaths.find(
(path): path is Types.ConveyorEventsSchema =>
(path): path is SimulationTypes.ConveyorEventsSchema =>
path.type === "Conveyor" &&
path.points.some(
(point) => point.uuid === selectedActionSphere.points.uuid