Browse Source

added runtime download for stl files of husky

tags/v0.3.11-rc1
ShashwatPatil 10 months ago
parent
commit
04bfe6c832
13 changed files with 73 additions and 1430 deletions
  1. +0
    -2
      node-hub/dora-mujoco-husky/README.md
  2. +0
    -136
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/base.dae
  3. +0
    -199
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/base_link.dae
  4. +0
    -199
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/bumper.dae
  5. +0
    -199
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/top_chassis.dae
  6. +0
    -294
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/top_plate.dae
  7. +0
    -199
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/user_rail.dae
  8. +0
    -199
      node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/wheel.dae
  9. +3
    -0
      node-hub/dora-mujoco-husky/dora_mujoco_husky/main.py
  10. +66
    -0
      node-hub/dora-mujoco-husky/dora_mujoco_husky/mesh_downloader.py
  11. BIN
      node-hub/dora-mujoco-husky/husky.gif
  12. +3
    -2
      node-hub/dora-mujoco-husky/pyproject.toml
  13. +1
    -1
      node-hub/gamepad/pyproject.toml

+ 0
- 2
node-hub/dora-mujoco-husky/README.md View File

@@ -41,8 +41,6 @@ dora build demo.yml --uv
```bash
dora run demo.yml --uv
```
If everthing is correct, it should look like this
![Husky MuJoCo Simulation](husky.gif)

## Usage



+ 0
- 136
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/base.dae
File diff suppressed because it is too large
View File


+ 0
- 199
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/base_link.dae
File diff suppressed because it is too large
View File


+ 0
- 199
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/bumper.dae
File diff suppressed because it is too large
View File


+ 0
- 199
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/top_chassis.dae
File diff suppressed because it is too large
View File


+ 0
- 294
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/top_plate.dae View File

@@ -1,294 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor>
<author>Blender User</author>
<authoring_tool>Blender 2.71.0 commit date:2014-06-12, commit time:18:39, hash:169c95b</authoring_tool>
</contributor>
<created>2015-04-10T16:18:19</created>
<modified>2015-04-10T16:18:19</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_cameras>
<camera id="Camera-camera" name="Camera">
<optics>
<technique_common>
<perspective>
<xfov sid="xfov">49.13434</xfov>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">100</zfar>
</perspective>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<YF_dofdist>0</YF_dofdist>
<shiftx>0</shiftx>
<shifty>0</shifty>
</technique>
</extra>
</camera>
<camera id="Camera_001-camera" name="Camera.001">
<optics>
<technique_common>
<perspective>
<xfov sid="xfov">49.13434</xfov>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">100</zfar>
</perspective>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<YF_dofdist>0</YF_dofdist>
<shiftx>0</shiftx>
<shifty>0</shifty>
</technique>
</extra>
</camera>
</library_cameras>
<library_lights>
<light id="Lamp-light" name="Lamp">
<technique_common>
<point>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.00111109</quadratic_attenuation>
</point>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>1</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>2880</bufsize>
<buftype>2</buftype>
<clipend>30.002</clipend>
<clipsta>1.000799</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">29.99998</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>8192</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>0</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>75</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>0</type>
</technique>
</extra>
</light>
<light id="Lamp_001-light" name="Lamp.001">
<technique_common>
<point>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.00111109</quadratic_attenuation>
</point>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>9.99987e-4</adapt_thresh>
<area_shape>1</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>2880</bufsize>
<buftype>2</buftype>
<clipend>30.002</clipend>
<clipsta>1.000799</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">29.99998</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>8192</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>0</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>75</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>0</type>
</technique>
</extra>
</light>
</library_lights>
<library_images/>
<library_effects>
<effect id="Dark-effect">
<profile_COMMON>
<technique sid="common">
<phong>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<ambient>
<color sid="ambient">0 0 0 1</color>
</ambient>
<diffuse>
<color sid="diffuse">0.08000001 0.08000001 0.08000001 1</color>
</diffuse>
<specular>
<color sid="specular">0.05 0.05 0.05 1</color>
</specular>
<shininess>
<float sid="shininess">50</float>
</shininess>
<index_of_refraction>
<float sid="index_of_refraction">1</float>
</index_of_refraction>
</phong>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_materials>
<material id="Dark-material" name="Dark">
<instance_effect url="#Dark-effect"/>
</material>
</library_materials>
<library_geometries>
<geometry id="Top_Plate-mesh" name="Top Plate">
<mesh>
<source id="Top_Plate-mesh-positions">
<float_array id="Top_Plate-mesh-positions-array" count="48">0.305 -0.295 0.00634998 -0.345 -0.295 0.00634998 0.305 -0.295 0 -0.345 -0.295 0 -0.365 -0.275 0 -0.365 0.275 0 -0.345 0.295 0 0.305 0.295 0 0.365 -0.235 0 0.365 0.235 0 0.305 0.295 0.00634998 -0.345 0.295 0.00634998 0.365 -0.235 0.00634998 0.365 0.235 0.00634998 -0.365 -0.275 0.00634998 -0.365 0.275 0.00634998</float_array>
<technique_common>
<accessor source="#Top_Plate-mesh-positions-array" count="16" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Top_Plate-mesh-normals">
<float_array id="Top_Plate-mesh-normals-array" count="84">0 -1 0 0 -1 0 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 -1 0 0 -1 0 0 -0.7071063 0.7071074 0 -0.7071063 0.7071074 0 -0.7071063 -0.7071074 0 -0.7071063 -0.7071074 0 0.7071067 -0.707107 0 0.7071067 -0.707107 0 0.7071067 0.707107 0 0.7071067 0.707107 0</float_array>
<technique_common>
<accessor source="#Top_Plate-mesh-normals-array" count="28" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Top_Plate-mesh-vertices">
<input semantic="POSITION" source="#Top_Plate-mesh-positions"/>
</vertices>
<polylist material="Dark-material" count="28">
<input semantic="VERTEX" source="#Top_Plate-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Top_Plate-mesh-normals" offset="1"/>
<vcount>3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
<p>0 0 1 0 2 0 2 1 1 1 3 1 4 2 5 2 3 2 3 3 5 3 6 3 3 4 6 4 2 4 2 5 6 5 7 5 2 6 7 6 8 6 8 7 7 7 9 7 7 8 6 8 10 8 10 9 6 9 11 9 12 10 13 10 0 10 0 11 13 11 10 11 1 12 0 12 14 12 14 13 0 13 10 13 14 14 10 14 15 14 15 15 10 15 11 15 8 16 9 16 12 16 12 17 9 17 13 17 5 18 4 18 15 18 15 19 4 19 14 19 15 20 11 20 5 20 5 21 11 21 6 21 4 22 3 22 14 22 14 23 3 23 1 23 2 24 8 24 0 24 0 25 8 25 12 25 10 26 13 26 7 26 7 27 13 27 9 27</p>
</polylist>
</mesh>
</geometry>
</library_geometries>
<library_controllers/>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Camera" name="Camera" type="NODE">
<matrix sid="transform">0.6858805 -0.3173701 0.6548619 7.481132 0.7276338 0.3124686 -0.6106656 -6.50764 -0.01081678 0.8953432 0.4452454 5.343665 0 0 0 1</matrix>
<instance_camera url="#Camera-camera"/>
</node>
<node id="Lamp" name="Lamp" type="NODE">
<matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
<instance_light url="#Lamp-light"/>
</node>
<node id="Top_Plate" name="Top_Plate" type="NODE">
<matrix sid="transform">1 0 0 -0.00133478 0 1 0 -0.00296879 0 0 1 4.3182e-5 0 0 0 1</matrix>
<instance_geometry url="#Top_Plate-mesh">
<bind_material>
<technique_common>
<instance_material symbol="Dark-material" target="#Dark-material"/>
</technique_common>
</bind_material>
</instance_geometry>
</node>
<node id="Camera_001" name="Camera_001" type="NODE">
<matrix sid="transform">0.6858805 -0.3173701 0.6548619 7.481132 0.7276337 0.3124686 -0.6106656 -6.50764 -0.01081678 0.8953431 0.4452454 5.343665 0 0 0 1</matrix>
<instance_camera url="#Camera_001-camera"/>
</node>
<node id="Lamp_001" name="Lamp_001" type="NODE">
<matrix sid="transform">-0.2908647 -0.7711007 0.5663933 4.076245 0.9551713 -0.1998833 0.2183912 1.005454 -0.05518912 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
<instance_light url="#Lamp_001-light"/>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#Scene"/>
</scene>
</COLLADA>

+ 0
- 199
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/user_rail.dae
File diff suppressed because it is too large
View File


+ 0
- 199
node-hub/dora-mujoco-husky/dora_mujoco_husky/husky/meshes/wheel.dae
File diff suppressed because it is too large
View File


+ 3
- 0
node-hub/dora-mujoco-husky/dora_mujoco_husky/main.py View File

@@ -3,6 +3,7 @@ import mujoco
import mujoco.viewer
import pyarrow as pa
import os
from .mesh_downloader import ensure_meshes

def clamp(value, min_val, max_val):
"""Clamp value between min_val and max_val"""
@@ -14,6 +15,8 @@ def main():
node = Node("mujoco_husky")
print("Initializing Mujoco Husky simulation...")
ensure_meshes()
# Load Husky model
model_path = os.path.join(os.path.dirname(__file__), "husky/husky.xml")
model = mujoco.MjModel.from_xml_path(model_path)


+ 66
- 0
node-hub/dora-mujoco-husky/dora_mujoco_husky/mesh_downloader.py View File

@@ -0,0 +1,66 @@
import os
import requests
import hashlib
from pathlib import Path
import shutil

BASE_URL = "https://raw.githubusercontent.com/robotlearning123/dual_ur5_husky_mujoco/dual_ur5_husky_mujoco/husky_description/meshes_mujoco"

MESH_URLS = {
"base_link.stl": f"{BASE_URL}/base_link.stl",
"wheel.stl": f"{BASE_URL}/wheel.stl",
"top_plate.stl": f"{BASE_URL}/top_plate.stl",
"user_rail.stl": f"{BASE_URL}/user_rail.stl",
"bumper.stl": f"{BASE_URL}/bumper.stl"
}

def get_cache_dir():
"""Get or create cache directory for mesh files"""
cache_dir = Path.home() / ".cache" / "dora-mujoco-husky" / "meshes"
cache_dir.mkdir(parents=True, exist_ok=True)
return cache_dir

def download_file(url: str, filepath: Path):
"""Download file from URL with progress indicator"""
print(f"Downloading {filepath.name} from {url}")
try:
response = requests.get(url, stream=True)
response.raise_for_status()
total_size = int(response.headers.get('content-length', 0))
block_size = 8192
with open(filepath, 'wb') as f:
for chunk in response.iter_content(chunk_size=block_size):
if chunk:
f.write(chunk)
print(f"Successfully downloaded {filepath.name}")
except requests.exceptions.RequestException as e:
print(f"Error downloading {filepath.name}: {e}")
raise

def ensure_meshes():
"""Ensure all mesh files are available, downloading if necessary"""
cache_dir = get_cache_dir()
mesh_dir = Path(__file__).parent / "husky" / "meshes"
mesh_dir.mkdir(parents=True, exist_ok=True)
print("Checking mesh files...")
for filename, url in MESH_URLS.items():
cache_file = cache_dir / filename
mesh_file = mesh_dir / filename
# Check if file exists in cache
if not cache_file.exists():
download_file(url, cache_file)
# Copy from cache to mesh directory if needed
if not mesh_file.exists():
print(f"Installing {filename} to {mesh_file}")
shutil.copy2(cache_file, mesh_file)
print("All mesh files are ready")

if __name__ == "__main__":
ensure_meshes()

BIN
node-hub/dora-mujoco-husky/husky.gif View File

Before After
Width: 400  |  Height: 225  |  Size: 580 kB

+ 3
- 2
node-hub/dora-mujoco-husky/pyproject.toml View File

@@ -1,6 +1,6 @@
[project]
name = "dora-mujoco-husky"
version = "0.0.0"
version = "0.2.0"
authors = [{ name = "Shashwat Patil", email = "email@email.com" }]
description = "dora-mujoco-husky"
license = { text = "MIT" }
@@ -10,7 +10,8 @@ requires-python = ">=3.10"
dependencies = [
"dora-rs >= 0.3.9",
"mujoco >= 3.1.6",
"pyarrow >= 14.0.1"
"pyarrow >= 14.0.1",
"requests >= 2.31.0",
]

[dependency-groups]


+ 1
- 1
node-hub/gamepad/pyproject.toml View File

@@ -1,6 +1,6 @@
[project]
name = "gamepad"
version = "0.0.0"
version = "0.1.0"
authors = [{ name = "Shashwat Patil", email = "email@email.com" }]
description = "gamepad"
license = { text = "MIT" }


Loading…
Cancel
Save