Expand description
§ycbust
A library for downloading and extracting the YCB (Yale-CMU-Berkeley) Object and Model Set for 3D rendering and robotic simulation environments.
§Example
use ycbust::{download_ycb, Subset, DownloadOptions};
use std::path::Path;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Download representative objects with default options
download_ycb(
Subset::Representative,
Path::new("/tmp/ycb"),
DownloadOptions::default(),
).await?;
Ok(())
}§Lower-level API
For more control, you can use the individual functions:
use ycbust::{fetch_objects, get_tgz_url, download_file, extract_tgz};
use reqwest::Client;
use std::path::Path;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::new();
// Fetch available objects
let objects = fetch_objects(&client).await?;
println!("Available objects: {:?}", objects);
// Get URL for a specific object
let url = get_tgz_url("003_cracker_box", "google_16k");
// Download and extract
let dest = Path::new("/tmp/ycb/003_cracker_box_google_16k.tgz");
download_file(&client, &url, dest, true).await?;
extract_tgz(dest, Path::new("/tmp/ycb"), true)?;
Ok(())
}Structs§
- Download
Options - Options for downloading YCB objects.
Enums§
- Subset
- Subset of objects to download.
Constants§
- BASE_
URL - Base URL for the YCB dataset on S3.
- OBJECTS_
URL - URL for the objects index JSON file.
- REPRESENTATIVE_
OBJECTS - Representative subset of 3 commonly used objects.
- TEN_
OBJECTS - Subset of 10 commonly used objects.
Functions§
- download_
file - Downloads a file from a URL to the specified destination path.
- download_
ycb - High-level function to download YCB objects.
- extract_
tgz - Extracts a .tgz (gzip-compressed tar) archive to the specified output directory.
- fetch_
objects - Fetches the list of available objects from the YCB dataset.
- get_
subset_ objects - Returns the list of objects for a given subset without fetching from the network.
- get_
tgz_ url - Constructs the download URL for a specific object and file type.
- url_
exists - Checks if a URL exists by sending a HEAD request.