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
Branches
No related tags found
1 merge request!11Reworking the mesh loading
Pipeline #297516 passed
......@@ -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": {
......
......@@ -5,7 +5,6 @@
"type": "UAV",
"name": "UIB Drone",
"topics": {
"pose": "/mesh_pf1/pose",
"images": [
{
"topic": "/mussol/camera/image_raw/compressed",
......
......@@ -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": {
......
......@@ -5,7 +5,6 @@
"type": "UAV",
"name": "UIB Drone",
"topics": {
"pose": "/mesh_pf1/pose",
"images": [
{
"topic": "/mussol/camera/image_raw/compressed",
......
......@@ -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,6 +24,10 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
return (
<>
{
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]}
......@@ -42,7 +41,10 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
<primitive object={modelClone} />
</group>
</group>
{/* <Frame frameId={props.config.poseFrame}>
:
// tf-Frame
<Frame frameId={props.config.poseFrame}>
<group
position={props.config.mesh?.transform?.translation}
quaternion={static_quaternion}
......@@ -50,7 +52,9 @@ export default function Robot(props: PropsWithoutRef<RobotProps>) {
>
<primitive object={modelClone} />
</group>
</Frame> */}
</Frame>
}
</>
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment