Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Aug 10, 2024
1 parent 0098901 commit 34c6268
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/listing/renderers/StlRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const StlRenderer = ({ url, edit, onDelete, disabled }: Props) => {
far={500}></PerspectiveCamera>
<directionalLight color={0xeb4634} position={[1, 0.75, 0.5]} />
<directionalLight color={0xccccff} position={[-1, 0.75, -0.5]} />
<OrbitControls />
<OrbitControls zoomSpeed={0.2} />
<Suspense fallback={<Loader />}>
<Center>
<Model url={url} meshType={meshType} />
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/listing/renderers/UrdfRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ const getMaterial = (meshType: MeshType) => {
};

const Model = ({ url, meshType }: ModelProps) => {
// TODO: Go back to using URL.
const filepath =
"https://raw.githubusercontent.com/facebookresearch/fairo/main/polymetis/polymetis/data/franka_panda/panda_arm.urdf";

console.log(url);
console.log(url, meshType);

const ref = useRef<Group>();
const robot = useLoader(URDFLoader, filepath);
Expand Down Expand Up @@ -96,7 +97,7 @@ const UrdfRenderer = ({ url, edit, onDelete, disabled }: Props) => {
far={500}></PerspectiveCamera>
<directionalLight color={0xeb4634} position={[1, 0.75, 0.5]} />
<directionalLight color={0xccccff} position={[-1, 0.75, -0.5]} />
<OrbitControls />
<OrbitControls zoomSpeed={0.2} />
<Suspense fallback={<Loader />}>
<Center>
<Model url={url} meshType={meshType} />
Expand Down
2 changes: 1 addition & 1 deletion store/app/routers/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Annotated

from fastapi import APIRouter, Depends, Form, HTTPException, UploadFile, status
from fastapi.responses import RedirectResponse
from fastapi.responses import RedirectResponse, FileResponse
from pydantic.main import BaseModel

from store.app.db import Crud
Expand Down
12 changes: 10 additions & 2 deletions tests/test_listings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@ async def test_listings(app_client: AsyncClient, tmpdir: Path) -> None:
data = response.json()
assert data["artifact"]["artifact_id"] is not None

# Downloads the URDF.
# Gets the URDF URL.
artifact_id = data["artifact"]["artifact_id"]
response = await app_client.get(f"/artifacts/download/{artifact_id}", headers=auth_headers)
response = await app_client.get(f"/artifacts/url/urdf/{artifact_id}", headers=auth_headers)
assert response.status_code == status.HTTP_307_TEMPORARY_REDIRECT, response.content
redirect_url = response.headers["location"]

# Downloads the URDF.
response = await app_client.get(redirect_url, headers=auth_headers)
assert response.status_code == status.HTTP_200_OK, response.content
response_content = response.content.decode()

breakpoint()

# Uploads an STL.
stl_path = Path(__file__).parent / "assets" / "teapot.stl"
Expand Down

0 comments on commit 34c6268

Please sign in to comment.