Skip to content

Release v0.6.5: Agent API Enhancements and Drift Velocity Demonstrations

Choose a tag to compare

@Routhleck Routhleck released this 30 Dec 13:41
· 8 commits to master since this release

What's New

🎯 Enhanced Agent API for Easier Property Access

  • New agent.position property getter (alias for agent.pos)
  • Exposed agent.rotational_velocity for advanced motion control
  • Simplified access to agent state without using history dictionary

📖 Comprehensive Drift Velocity Demonstrations

  • New demonstration script showing systematic exploration and motion control
  • Enhanced trajectory comparison with dynamic drift velocity callbacks
  • Expanded documentation with practical usage examples

Major Features / Key Changes

Enhanced Agent Property Access

  • agent.position: New property getter providing clearer semantic access to current position (alias for agent.pos)
  • agent.rotational_velocity: Exposed internal rotational velocity state (angular velocity in rad/s for 2D agents)
  • Simplified API: Direct property access eliminates the need to use agent.history["pos"][-1] patterns
from canns_lib.spatial import Environment, Agent
import numpy as np

env = Environment(dimensionality="2D", boundary_conditions="periodic")
agent = Agent(env, rng_seed=42)

# New simplified access
current_pos = agent.position      # Instead of agent.history["pos"][-1]
current_vel = agent.velocity       # Direct access
hd_angle = np.arctan2(agent.head_direction[1], agent.head_direction[0])

📖 Drift Velocity Demonstrations

  • example/drift_velocity_demo.py: Comprehensive demonstration script (500+ lines) showcasing:
    • Systematic grid exploration with drift velocity control
    • Directional biasing and circular motion patterns
    • Interactive visualization of agent trajectories
  • Enhanced example/trajectory_comparison.py: Added support for dynamic drift velocity via callback functions
  • README updates: Expanded documentation with drift_velocity usage examples and parameter explanations

🔧 Bug Fixes and Improvements

  • Windows compatibility: Fixed ZeroDivisionError in test_greedy_algorithms_status when computation is too fast
  • Code quality: Translated remaining Chinese comments to English for better international collaboration
  • Rust formatting: Applied consistent code formatting across the codebase

🚀 CI/CD Updates

  • Updated macOS Intel runner to macos-15-intel (official replacement for deprecated macos-13)
  • Improved CI reliability for cross-platform testing

Technical Notes

  • All new property getters return cloned data, maintaining safe ownership semantics
  • The position property is an alias for pos to provide clearer API semantics
  • rotational_velocity exposes the internal OU process state for advanced use cases
  • No breaking changes - all additions are backward compatible

Files Modified

  • src/spatial/agent.rs: Added property getters for position and rotational_velocity
  • example/drift_velocity_demo.py: New comprehensive demonstration script
  • example/trajectory_comparison.py: Enhanced with drift velocity callback support
  • README.md: Expanded documentation for drift_velocity usage
  • tests/test_complex_topology.py: Windows compatibility fix
  • python/canns_lib/_version.py: Version bump to 0.6.5
  • Cargo.toml: Version bump to 0.6.5

Use Cases

  • Researchers: Direct property access simplifies data collection during experiments
  • Developers: Cleaner API for building applications on top of spatial navigation
  • Students: Drift velocity demonstrations provide ready-to-run examples for learning

Full Changelog: v0.6.4...v0.6.5