Skip to content
Snippets Groups Projects
Commit c93110ec authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Adjusting robot to be rendered with either the pose or the tf-frame

parent 6aad9a10
No related branches found
No related tags found
1 merge request!11Reworking the mesh loading
Pipeline #297516 passed
...@@ -6,8 +6,16 @@ ...@@ -6,8 +6,16 @@
"rosbridge": { "rosbridge": {
"uri": "wss://bugwright.vr.rwth-aachen.de/rosbridge" "uri": "wss://bugwright.vr.rwth-aachen.de/rosbridge"
}, },
"topics": { "static_mesh": {
"mesh": "/mesh_publisher/shape" "uri": "meshes/Porto_230616_122018.gltf",
"tf_frame": "mesh_ref",
"transform": {
"rotation": [
-90,
0,
180
]
}
} }
}, },
"transformTree": { "transformTree": {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
"type": "UAV", "type": "UAV",
"name": "UIB Drone", "name": "UIB Drone",
"topics": { "topics": {
"pose": "/mesh_pf1/pose",
"images": [ "images": [
{ {
"topic": "/mussol/camera/image_raw/compressed", "topic": "/mussol/camera/image_raw/compressed",
......
...@@ -6,8 +6,16 @@ ...@@ -6,8 +6,16 @@
"rosbridge": { "rosbridge": {
"uri": "ws://172.23.7.1:9090" "uri": "ws://172.23.7.1:9090"
}, },
"topics": { "static_mesh": {
"mesh": "/mesh_publisher/shape" "uri": "meshes/Porto_230616_122018.gltf",
"tf_frame": "mesh_ref",
"transform": {
"rotation": [
-90,
0,
180
]
}
} }
}, },
"transformTree": { "transformTree": {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
"type": "UAV", "type": "UAV",
"name": "UIB Drone", "name": "UIB Drone",
"topics": { "topics": {
"pose": "/mesh_pf1/pose",
"images": [ "images": [
{ {
"topic": "/mussol/camera/image_raw/compressed", "topic": "/mussol/camera/image_raw/compressed",
......
...@@ -17,11 +17,6 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) { ...@@ -17,11 +17,6 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
const gltf = useLoader(GLTFLoader, props.config.mesh?.uri || ""); const gltf = useLoader(GLTFLoader, props.config.mesh?.uri || "");
const modelClone = useMemo<Object3D>(() => { return gltf.scene.clone(true); }, [gltf]); 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(); const static_quaternion = new Quaternion();
if (props.config.mesh?.transform?.rotation) { 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); 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,6 +24,10 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) { ...@@ -29,6 +24,10 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
return ( return (
<> <>
{
props.config.topics.pose != "" && poseStamped ?
// Pose based
<group <group
position={[-poseStamped.pose.position.x, poseStamped.pose.position.z, poseStamped.pose.position.y]} 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]} quaternion={[-poseStamped.pose.orientation.x, poseStamped.pose.orientation.z, poseStamped.pose.orientation.y, poseStamped.pose.orientation.w]}
...@@ -42,7 +41,10 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) { ...@@ -42,7 +41,10 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
<primitive object={modelClone} /> <primitive object={modelClone} />
</group> </group>
</group> </group>
{/* <Frame frameId={props.config.poseFrame}> :
// tf-Frame
<Frame frameId={props.config.poseFrame}>
<group <group
position={props.config.mesh?.transform?.translation} position={props.config.mesh?.transform?.translation}
quaternion={static_quaternion} quaternion={static_quaternion}
...@@ -50,7 +52,9 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) { ...@@ -50,7 +52,9 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
> >
<primitive object={modelClone} /> <primitive object={modelClone} />
</group> </group>
</Frame> */} </Frame>
}
</> </>
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment