Release v0.6.5: Agent API Enhancements and Drift Velocity Demonstrations
What's New
🎯 Enhanced Agent API for Easier Property Access
- New
agent.positionproperty getter (alias foragent.pos) - Exposed
agent.rotational_velocityfor 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 foragent.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
ZeroDivisionErrorintest_greedy_algorithms_statuswhen 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 deprecatedmacos-13) - Improved CI reliability for cross-platform testing
Technical Notes
- All new property getters return cloned data, maintaining safe ownership semantics
- The
positionproperty is an alias forposto provide clearer API semantics rotational_velocityexposes 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 forpositionandrotational_velocityexample/drift_velocity_demo.py: New comprehensive demonstration scriptexample/trajectory_comparison.py: Enhanced with drift velocity callback supportREADME.md: Expanded documentation for drift_velocity usagetests/test_complex_topology.py: Windows compatibility fixpython/canns_lib/_version.py: Version bump to 0.6.5Cargo.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