diff --git a/public/configs/deploy/config.json b/public/configs/deploy/config.json index bb4b8510d5006156ee4e0fd61736927dd84295fc..3778b2805947b7b292343c3d3b8550994000795c 100644 --- a/public/configs/deploy/config.json +++ b/public/configs/deploy/config.json @@ -6,8 +6,16 @@ "rosbridge": { "uri": "wss://bugwright.vr.rwth-aachen.de/rosbridge" }, - "topics": { - "mesh": "/mesh_publisher/shape" + "static_mesh": { + "uri": "meshes/Porto_230616_122018.gltf", + "tf_frame": "mesh_ref", + "transform": { + "rotation": [ + -90, + 0, + 180 + ] + } } }, "transformTree": { diff --git a/public/configs/deploy/robots/uib_drone.json b/public/configs/deploy/robots/uib_drone.json index c6a26669d032e9c72839ba1cc957b7d5e9cc6b16..3f8b8955cd9a1208fe27de7bc656c5133943abae 100644 --- a/public/configs/deploy/robots/uib_drone.json +++ b/public/configs/deploy/robots/uib_drone.json @@ -5,7 +5,6 @@ "type": "UAV", "name": "UIB Drone", "topics": { - "pose": "/mesh_pf1/pose", "images": [ { "topic": "/mussol/camera/image_raw/compressed", diff --git a/public/configs/ntnu/config.json b/public/configs/ntnu/config.json index b5456b1db121953766210761e03a76f9cb377bbe..1e23a209502d75c66baa7cf4992bcb12237deaac 100644 --- a/public/configs/ntnu/config.json +++ b/public/configs/ntnu/config.json @@ -6,8 +6,16 @@ "rosbridge": { "uri": "ws://172.23.7.1:9090" }, - "topics": { - "mesh": "/mesh_publisher/shape" + "static_mesh": { + "uri": "meshes/Porto_230616_122018.gltf", + "tf_frame": "mesh_ref", + "transform": { + "rotation": [ + -90, + 0, + 180 + ] + } } }, "transformTree": { diff --git a/public/configs/simulator/robots/uib_drone.json b/public/configs/simulator/robots/uib_drone.json index 43e9027babe12eed3ae5d3b5ae66d90063165a87..e3d34b654b78d0d6cf7bb323b65c24a854fcdbba 100644 --- a/public/configs/simulator/robots/uib_drone.json +++ b/public/configs/simulator/robots/uib_drone.json @@ -5,7 +5,6 @@ "type": "UAV", "name": "UIB Drone", "topics": { - "pose": "/mesh_pf1/pose", "images": [ { "topic": "/mussol/camera/image_raw/compressed", diff --git a/src/features/viewport/Robot.tsx b/src/features/viewport/Robot.tsx index 138b59ff600c67f26feb9d619bf0045aa24dfc4a..2023088ef72e6203b2679cffe85d10f9253d9fb6 100644 --- a/src/features/viewport/Robot.tsx +++ b/src/features/viewport/Robot.tsx @@ -17,11 +17,6 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) { const gltf = useLoader(GLTFLoader, props.config.mesh?.uri || ""); const modelClone = useMemo<Object3D>(() => { return gltf.scene.clone(true); }, [gltf]); - // If we haven't received a pose yet: do not render the robot. - if (!poseStamped) { - return null; - } - const static_quaternion = new Quaternion(); if (props.config.mesh?.transform?.rotation) { static_quaternion.setFromEuler(new Euler(props.config.mesh.transform.rotation[0], props.config.mesh.transform.rotation[1], props.config.mesh.transform.rotation[2]), true); @@ -29,28 +24,37 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) { return ( <> - <group - position={[-poseStamped.pose.position.x, poseStamped.pose.position.z, poseStamped.pose.position.y]} - quaternion={[-poseStamped.pose.orientation.x, poseStamped.pose.orientation.z, poseStamped.pose.orientation.y, poseStamped.pose.orientation.w]} - scale={[1, 1, 1]} - > - <group - position={props.config.mesh?.transform?.translation} - quaternion={static_quaternion} - scale={props.config.mesh?.transform?.scale} - > - <primitive object={modelClone} /> - </group> - </group> - {/* <Frame frameId={props.config.poseFrame}> - <group - position={props.config.mesh?.transform?.translation} - quaternion={static_quaternion} - scale={props.config.mesh?.transform?.scale} - > - <primitive object={modelClone} /> - </group> - </Frame> */} + { + props.config.topics.pose != "" && poseStamped ? + + // Pose based + <group + position={[-poseStamped.pose.position.x, poseStamped.pose.position.z, poseStamped.pose.position.y]} + quaternion={[-poseStamped.pose.orientation.x, poseStamped.pose.orientation.z, poseStamped.pose.orientation.y, poseStamped.pose.orientation.w]} + scale={[1, 1, 1]} + > + <group + position={props.config.mesh?.transform?.translation} + quaternion={static_quaternion} + scale={props.config.mesh?.transform?.scale} + > + <primitive object={modelClone} /> + </group> + </group> + : + + // tf-Frame + <Frame frameId={props.config.poseFrame}> + <group + position={props.config.mesh?.transform?.translation} + quaternion={static_quaternion} + scale={props.config.mesh?.transform?.scale} + > + <primitive object={modelClone} /> + </group> + </Frame> + + } </> ); }