Merge remote-tracking branch 'origin/simulation-agv' into simulation

This commit is contained in:
Jerald-Golden-B 2025-04-04 17:48:35 +05:30
commit 395fdb14a6
4 changed files with 49 additions and 38 deletions

View File

@ -22,6 +22,7 @@ const Agv = ({
modelSpeed: number;
bufferTime: number;
points: { x: number; y: number; z: number }[];
hitCount: number;
}[]
>([]);
const { simulationPaths } = useSimulationPaths();
@ -33,6 +34,7 @@ const Agv = ({
(val: any) => val.modelName === "agv"
);
let findMesh = agvModels.filter(
(val: any) =>
val.modeluuid === selectedActionSphere?.path?.modeluuid &&
@ -53,6 +55,7 @@ const Agv = ({
modelUuid: findMesh[0].modeluuid, // Ensure it's a number
modelSpeed: findMesh[0].points.speed,
bufferTime: findMesh[0].points.actions.buffer,
hitCount: findMesh[0].points.actions.hitCount,
points: [
{
x: findMesh[0].position[0],
@ -119,6 +122,7 @@ const Agv = ({
key={i}
speed={pair.modelSpeed}
bufferTime={pair.bufferTime}
hitCount={pair.hitCount}
/>
{/* {pair.points.length > 2 && (
<>

View File

@ -35,7 +35,6 @@ export default function NavMeshDetails({
const cellSize = 0.35;
const cellHeight = 0.7;
const walkableRadius = 0.5;
const { success, navMesh } = generateSoloNavMesh(positions, indices, {
cs: cellSize,
ch: cellHeight,

View File

@ -12,6 +12,7 @@ interface PathNavigatorProps {
id: string;
speed: number;
bufferTime: number;
hitCount: number;
}
export default function PathNavigator({
@ -20,6 +21,7 @@ export default function PathNavigator({
id,
speed,
bufferTime,
hitCount,
}: PathNavigatorProps) {
const [path, setPath] = useState<[number, number, number][]>([]);
const progressRef = useRef(0);
@ -52,6 +54,7 @@ export default function PathNavigator({
progressRef.current = 0;
}, [path]);
// Compute the path using NavMeshQuery
useEffect(() => {
if (!navMesh || selectedPoints.length === 0) return;
@ -119,17 +122,22 @@ export default function PathNavigator({
if (!isWaiting.current) {
isWaiting.current = true; // Set waiting flag
if (movingForward.current) {
// Moving forward: reached the end, wait for `delay`
// console.log(
// "Reached end position. Waiting for delay:",
// delayTime,
// "seconds"
// );
setTimeout(() => {
// After delay, reverse direction
movingForward.current = false;
progressRef.current = 0; // Reset progress
movingForward.current = !movingForward.current; // Toggle direction
// Reverse the path and distances arrays
path.reverse();
path.reverse(); // Reverse the path
distancesRef.current.reverse();
// Reset the waiting flag
isWaiting.current = false;
}, delayTime * 1000); // Convert seconds to milliseconds
isWaiting.current = false; // Reset waiting flag
}, delayTime * 1000); // Wait for `delay` seconds
}
}
return;
}

View File

@ -1,4 +1,4 @@
let BackEnd_url = `http://${process.env.REACT_APP_SERVER_ASSET_LIBRARY_URL}`;
let BackEnd_url = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`;
export const getCategoryAsset = async (categoryName: any) => {
try {
const response = await fetch(