added buffer in agv
This commit is contained in:
@@ -23,6 +23,7 @@ const Agv = ({
|
|||||||
modelSpeed: number;
|
modelSpeed: number;
|
||||||
bufferTime: number;
|
bufferTime: number;
|
||||||
points: { x: number; y: number; z: number }[];
|
points: { x: number; y: number; z: number }[];
|
||||||
|
hitCount: number;
|
||||||
}[]
|
}[]
|
||||||
>([]);
|
>([]);
|
||||||
const { simulationPaths } = useSimulationPaths();
|
const { simulationPaths } = useSimulationPaths();
|
||||||
@@ -34,7 +35,7 @@ const Agv = ({
|
|||||||
(val: any) => val.modelName === "agv"
|
(val: any) => val.modelName === "agv"
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("agvModels: ", agvModels);
|
|
||||||
let findMesh = agvModels.filter(
|
let findMesh = agvModels.filter(
|
||||||
(val: any) =>
|
(val: any) =>
|
||||||
val.modeluuid === selectedActionSphere?.path?.modeluuid &&
|
val.modeluuid === selectedActionSphere?.path?.modeluuid &&
|
||||||
@@ -55,6 +56,7 @@ const Agv = ({
|
|||||||
modelUuid: findMesh[0].modeluuid, // Ensure it's a number
|
modelUuid: findMesh[0].modeluuid, // Ensure it's a number
|
||||||
modelSpeed: findMesh[0].point.speed,
|
modelSpeed: findMesh[0].point.speed,
|
||||||
bufferTime: findMesh[0].point.actions.buffer,
|
bufferTime: findMesh[0].point.actions.buffer,
|
||||||
|
hitCount: findMesh[0].point.actions.hitCount,
|
||||||
points: [
|
points: [
|
||||||
{
|
{
|
||||||
x: findMesh[0].position[0],
|
x: findMesh[0].position[0],
|
||||||
@@ -122,6 +124,7 @@ const Agv = ({
|
|||||||
key={i}
|
key={i}
|
||||||
speed={pair.modelSpeed}
|
speed={pair.modelSpeed}
|
||||||
bufferTime={pair.bufferTime}
|
bufferTime={pair.bufferTime}
|
||||||
|
hitCount={pair.hitCount}
|
||||||
/>
|
/>
|
||||||
{/* {pair.points.length > 2 && (
|
{/* {pair.points.length > 2 && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -33,11 +33,9 @@ export default function NavMeshDetails({
|
|||||||
const meshes = groupRef?.current?.children as THREE.Mesh[];
|
const meshes = groupRef?.current?.children as THREE.Mesh[];
|
||||||
|
|
||||||
const [positions, indices] = getPositionsAndIndices(meshes);
|
const [positions, indices] = getPositionsAndIndices(meshes);
|
||||||
|
const cs = 0.35;
|
||||||
const cs = 0.25;
|
const ch = 0.7;
|
||||||
const ch = 0.69;
|
|
||||||
const walkableRadius = 0.5;
|
const walkableRadius = 0.5;
|
||||||
|
|
||||||
const { success, navMesh } = generateSoloNavMesh(positions, indices, {
|
const { success, navMesh } = generateSoloNavMesh(positions, indices, {
|
||||||
cs,
|
cs,
|
||||||
ch,
|
ch,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ interface PathNavigatorProps {
|
|||||||
id: string;
|
id: string;
|
||||||
speed: number;
|
speed: number;
|
||||||
bufferTime: number;
|
bufferTime: number;
|
||||||
|
hitCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PathNavigator({
|
export default function PathNavigator({
|
||||||
@@ -20,6 +21,7 @@ export default function PathNavigator({
|
|||||||
id,
|
id,
|
||||||
speed,
|
speed,
|
||||||
bufferTime,
|
bufferTime,
|
||||||
|
hitCount,
|
||||||
}: PathNavigatorProps) {
|
}: PathNavigatorProps) {
|
||||||
const [path, setPath] = useState<[number, number, number][]>([]);
|
const [path, setPath] = useState<[number, number, number][]>([]);
|
||||||
const progressRef = useRef(0);
|
const progressRef = useRef(0);
|
||||||
@@ -52,6 +54,7 @@ export default function PathNavigator({
|
|||||||
progressRef.current = 0;
|
progressRef.current = 0;
|
||||||
}, [path]);
|
}, [path]);
|
||||||
|
|
||||||
|
// Compute the path using NavMeshQuery
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!navMesh || selectedPoints.length === 0) return;
|
if (!navMesh || selectedPoints.length === 0) return;
|
||||||
|
|
||||||
@@ -119,17 +122,22 @@ export default function PathNavigator({
|
|||||||
if (!isWaiting.current) {
|
if (!isWaiting.current) {
|
||||||
isWaiting.current = true; // Set waiting flag
|
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(() => {
|
setTimeout(() => {
|
||||||
|
// After delay, reverse direction
|
||||||
|
movingForward.current = false;
|
||||||
progressRef.current = 0; // Reset progress
|
progressRef.current = 0; // Reset progress
|
||||||
movingForward.current = !movingForward.current; // Toggle direction
|
path.reverse(); // Reverse the path
|
||||||
|
|
||||||
// Reverse the path and distances arrays
|
|
||||||
path.reverse();
|
|
||||||
distancesRef.current.reverse();
|
distancesRef.current.reverse();
|
||||||
|
isWaiting.current = false; // Reset waiting flag
|
||||||
// Reset the waiting flag
|
}, delayTime * 1000); // Wait for `delay` seconds
|
||||||
isWaiting.current = false;
|
}
|
||||||
}, delayTime * 1000); // Convert seconds to milliseconds
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
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) => {
|
export const getCategoryAsset = async (categoryName: any) => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${BackEnd_url}/api/v2/getCatagoryAssets/${categoryName}`,
|
`${BackEnd_url}/api/v2/getCategoryAssets/${categoryName}`,
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user