Skip to content

Fix/log dir#1

Open
rojas70 wants to merge 74 commits intoCleiverRuiz:masterfrom
learningLogisticsLab:fix/log-dir
Open

Fix/log dir#1
rojas70 wants to merge 74 commits intoCleiverRuiz:masterfrom
learningLogisticsLab:fix/log-dir

Conversation

@rojas70
Copy link
Copy Markdown

@rojas70 rojas70 commented Oct 6, 2025

No description provided.

rojas70 and others added 30 commits June 17, 2025 13:55
…esary for the robot to be controlled by the python scripts.
train.py:
- creates a gym environment and a model using SAC with HER and trains for a specified number of timesteps
- saves to a zip file
test.py
- reloads environment and module and runs deterministicly for several episodes
- train.py set for 1M timesteps of training
- test.py filepath to model updated to reflect accurate location
- pick_and_place.py import statement changed to reflect new filestructure

Added sac_her_push_1M.zip
- stores model trained by sac_her algorithm on the push environment for 1M timesteps
- Updated and advanced train.py for the push task that includes logging, vectorized environments, and periodic recorded evaluations
… with SAC_HER

with basic logging to tensorboard. We also addressed filepath and importing issues with our current filestructure.
With the new implementations you can run, for example, the test.py for push with the following terminal command
WHILE IN the franka_mujoco folder: python3 -m examples.push.sac.test
Additionally an issue with the panda_mocap.xml file was fixed so now the arm should move fully.
…f any packages we need to insert. In this way, imports work from everywhere.
….4.0, in creating the SAC model, replay_buffer_kwargs needs only two options here:

        replay_buffer_kwargs=dict(
            goal_selection_strategy=GoalSelectionStrategy.FUTURE,
            copy_info_dict=False,

along with a learning_starts parameter that is set to max_length*num_virtual_envs.

We have not explicitly extracted the max_length_steps in one rollout but think it is 100. So the MAX_EPISODE_LENGTH is currently set to 100 * 5 virtual environments = 500.
rojas70 added 30 commits June 23, 2025 16:35
Almost final. Still having trouble lifting the block in the air.
… try to debug why no learning was occuring.

Changes include commenting VecNormalize in train_advanced.py as well as changing things like batch size and the copy_info_dict
arguement under the HerReplayBuffer. Changes to train.py were very minimal.
Some refinements to sliding friction parameters in panda_mocap.xml to minimize sliding. Helped some but not perfect.

TODO:
- fix sliding
- better confition for success.
- print success.
- only save rollouts that succeeded
…or alongside fingertip `<geom>` declarations to increase friction.

These changes ultimately did not result in successful pinch picks but were kept.

Summary of Changes:
1. Use full 6-D friction (sliding + torsion + rolling).
2. Employ realistic elliptic friction cones.
3. Detect all contacts on each fingertip.
4. Use much stiffer, well‐damped contact springs.

Explanations:
1. What does `condim` do? Why change from 4 to 6?

The `condim` attribute on a `<geom>` controls **how many contact‐constraint dimensions MuJoCo enforces** at that contact point:

* **`condim="3"`** (the default) gives you 1 normal dimension + 2 tangential sliding directions (standard Coulomb friction).
* **`condim="4"`** adds **torsional friction** about the contact normal, resisting the block twisting out of your fingers.
* **`condim="6"`** adds **rolling friction** as well—two more dimensions resisting the block rolling away around axes tangent to the contact patch.

By bumping from `4→6`, you preserve both torsional **and** rolling resistance.  In a pinch grasp, the block can still roll out of a 4-dimensional contact, but with 6 you get full 3D frictional impedance, making the grip much more robust against both twists **and** rolls.

---

2. Where to put the elliptic‐cone / `impratio` change?

These go in your global `<option>` block at the top of `panda_mocap.xml`.  For example, right under `<mujoco>`:

```xml
<mujoco model="panda">
  <!-- … other top‐level settings … -->
  <option
    cone="elliptic"      <!-- switch from default “pyramidal” friction cones -->
    impratio="10"        <!-- make friction boundaries “harder” without raising μ -->
    noslip_iterations="0"  <!-- leave at 0 unless you enable noslip -->
    />
  <!-- … rest of your assets, worldbody, etc. … -->
```

That single `<option>` line activates **elliptic** friction cones and boosts the friction‐to‐normal impedance ratio to 10.

---

3. Where to enable multi-CCD / nativeCCD?

Also in the `<option>` block—just add these attributes alongside the above:

```xml
  <option
    cone="elliptic"
    impratio="10"
    multiccd="true"     <!-- enable multi‐point continuous‐collision detection -->
    nativeccd="true"    <!-- enable MuJoCo’s native CCD as a fallback -->
    />
```

That ensures MuJoCo finds *all* contact points on your fingertips (not just one), which is critical for reliable pinch grasps.

---

4. Where to tweak `solref` / `solimp` on your `<geom>`s?

Any `<geom>` you care about—typically your fingertip collision geoms—can get stiffer, more damped contact springs by adding `solref` and `solimp`.  For example, in your `<default class="fingertip_pad_collision_1">` section:

```xml
<default class="fingertip_pad_collision_1">
  <geom
    type="box"
    size="0.0085 0.004 0.0085"
    pos="0 0.0055 0.0445"
    condim="6"
    friction="45.0 1.0 0.8"
    solref="0.02 1"         <!-- stiffness: [timeconst, damping ratio] -->
    solimp="0.9 0.99 0.0001" <!-- [softness, restitution, regularization] -->
    />
</default>
```

Or inline on each fingertip `<geom>`:

```xml
<geom class="fingertip_pad_collision_2"
      condim="6"
      friction="45 1 0.8"
      solref="0.02 1"
      solimp="0.9 0.99 0.0001"/>
```

Those values make the contact springs both **stiffer** (small `timeconst`) and **highly damped**, reducing slow slips without blowing up the simulation.

---

#### Putting it all together

Near the top of `panda_mocap.xml` you’ll end up with something like:

```xml
<mujoco model="panda">
  <option
    cone="elliptic"
    impratio="10"
    multiccd="true"
    nativeccd="true"
    noslip_iterations="0"
  />
  ...
  <default class="fingertip_pad_collision_1">
    <geom
      type="box"
      size="0.0085 0.004 0.0085"
      pos="0 0.0055 0.0445"
      condim="6"
      friction="45.0 1.0 0.8"
      solref="0.02 1"
      solimp="0.9 0.99 0.0001"
    />
  </default>
  <!-- repeat for your other fingertip_pad_collision_x defaults -->
  ...
</mujoco>
```
These changes should give better physical pinch grasps without weld shortcuts.
…eporting.

- Created activate and deactivate weld functions in pick_place_demo.py that were activated/deactivated during lift phase of pick.
- Improved error calculations and conditions to ensure smooth transitions.
- Improved message logs to screen
- Ensured that only successful runs have their data recorded.
- Ensured observations, actions, rewards, terminated, truncateds, and dones were all saved to file.
- improved functionality to save in same directory as demo .py location.
…ges to train_advanced (commeted videos and other sac specific changes)
…single.py from the push folder with naming changes
- Fixed bug where i did not close the mujoco viewer at the end.
-
Small improvements indicating how to activate a file and how to create an alias
…rticularly to be able to read and write to /home/student/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants