Perception-based trajectory generation