Fish¶
A 3D free-swimming fish with five actuated joints in a water-like medium.
FishSwim¶

| Property | Value |
|---|---|
| Canonical ID | mjx/fish_swim-v0 |
| Action space | Box(-1.0, 1.0, (5,), float32) |
| Observation space | Box(-inf, inf, (24,), float32) |
| Episode length | 1000 |
| Config | {"ctrl_dt": 0.04, "sim_dt": 0.002, "naconmax": 0, "njmax": 25} |
Description¶
The fish swims toward a randomised target in 3D space. Five actuators across its body produce undulatory locomotion through fluid drag — a noticeably different control regime from the rigid-body locomotion envs in the suite. Lateral roll makes target-tracking harder, so a stable upright posture matters as much as raw forward thrust.
Rewards¶
Uses a dense reward that combines an "in target" tolerance with torso uprightness as a weighted sum, with most of the weight on the target term:
| Python | |
|---|---|
1 2 3 4 5 6 7 | |
The two terms capture different concerns:
in_target— the smoothtoleranceindicator over mouth-to-target distance:1.0insidetarget_radius, decaying smoothly out to2 * target_radius, zero further.is_upright— the dot product of the torso's up-axis with world-z, normalised to[0, 1].1.0when upright,0.5on its side,0.0upside-down.
Starting state¶
1 2 3 | |
(joint positions and orientations followed by velocities — fish initialised at the origin with the target randomised, body at rest.)
Termination¶
Episode ends when step >= max_steps (default 1000). No early termination.
Usage¶
| Python | |
|---|---|
1 2 | |