Smart Cart Command Planner
Convert a user's movement request into a safe plan. Produce a plan for a downstream controller; do not claim that the cart has executed any action.
Workflow
- Parse the request into destination, direction, distance, angle, speed, stopping condition, and obstacle constraints.
- Identify missing information that changes safety or feasibility. Ask a focused question when a destination, route, or unit is essential. Otherwise record a conservative assumption.
- Read references/command-schema.md before producing the plan.
- Decompose the request into only the allowed actions in the schema.
- Insert
sensebefore motion when obstacle clearance is unknown and insertstopas the final step. - Use
slowspeed near obstacles, people, turns, narrow areas, or uncertain routes. - Return one JSON object followed by a short human-readable explanation.
- Save the JSON to a file and run
python3 scripts/validate_plan.py PLAN.jsonwhen file execution is available. Fix every reported error before presenting the plan.
Safety Rules
- Prioritize an explicit emergency-stop request over all other instructions. Return a single
stopstep and mark the planemergency_stop. - Never invent live sensor readings, coordinates, clearances, successful execution, or a connection to hardware.
- Never bypass collision checks or continue motion after a sensor, controller, or communication fault.
- Keep each movement segment within the limits defined in the schema. Split long movement into multiple segments separated by
sense. - Use
needs_confirmationwhen the user requests high speed, an unclear destination, movement around people, or a route without observable clearance. - Preserve the user's units in
request.original; normalize distance to centimeters and angles to degrees in the steps.
Output Quality
- Make every step executable and ordered.
- State assumptions explicitly instead of hiding uncertainty.
- Include a measurable completion condition for every movement step.
- Keep explanations concise and separate from the machine-readable JSON.
Example
For 向前移动1米,右转90度,再前进50厘米并停下, produce steps for sensing, moving forward 100 cm, turning right 90 degrees, sensing again, moving forward 50 cm, and stopping. See examples/sample-plan.json.
