v3-ui #99

Merged
Vishnu merged 28 commits from v3-ui into main 2025-06-12 04:27:40 +00:00
2 changed files with 25 additions and 11 deletions
Showing only changes of commit 4d77aa6a99 - Show all commits

View File

@ -48,14 +48,24 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
const computePath = useCallback(
(start: any, end: any) => {
console.log('end: ', end);
try {
const navMeshQuery = new NavMeshQuery(navMesh);
const { path: segmentPath } = navMeshQuery.computePath(start, end);
return (
segmentPath?.map(({ x, y, z }) => [x, 0, z] as [number, number, number]) || []
);
if (
segmentPath.length > 0 &&
Math.round(segmentPath[segmentPath.length - 1].x) == Math.round(end.x) &&
Math.round(segmentPath[segmentPath.length - 1].z) == Math.round(end.z)
) {
console.log('if ', segmentPath);
return segmentPath?.map(({ x, y, z }) => [x, 0, z] as [number, number, number]) || [];
} else {
console.log("There is no path here...Choose valid path")
const { path: segmentPaths } = navMeshQuery.computePath(start, start);
return segmentPaths.map(({ x, y, z }) => [x, 0, z] as [number, number, number]) || [];
}
} catch {
echo.error("Failed to compute path");
console.error("Failed to compute path");
return [];
}
},
@ -96,6 +106,10 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2]),
agvDetail?.point?.action?.pickUpPoint?.position
);
// const toPickupPath = computePath(
// new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2]),
// new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2])
// );
setPath(toPickupPath);
setCurrentPhase('stationed-pickup');
setVehicleState(agvDetail.modelUuid, 'running');

View File

@ -45,6 +45,7 @@ const UserAuth: React.FC = () => {
const organization = email.split("@")[1].split(".")[0];
try {
const res = await signInApi(email, password, organization, fingerprint);
console.log('res: ', res);
if (res.message.message === "login successfull") {
setError("");
setOrganization(organization);
@ -59,14 +60,13 @@ const UserAuth: React.FC = () => {
try {
const projects = await recentlyViewed(organization, res.message.userId);
if (Object.values(projects.RecentlyViewed).length > 0) {
const firstId = (Object.values(projects?.RecentlyViewed || {})[0] as any)?._id;
setLoadingProgress(1)
navigate(`/${firstId}`)
} else {
if (res.message.isShare) {
if (res.message.isShare) {
if (Object.values(projects.RecentlyViewed).length > 0) {
const firstId = (Object.values(projects?.RecentlyViewed || {})[0] as any)?._id;
setLoadingProgress(1)
navigate(`/${firstId}`)
} else {
setLoadingProgress(1);
// navigate("/Project");
navigate("/Dashboard");
}
}