Command Server - CodeClubLuxembourg/plottybot-toolkit-web GitHub Wiki
Command Server
Role
The command server in PlottyBot acts as the core processing unit for handling incoming commands. It runs as a Python script (plottybot.py
) that receives instructions from the PHP frontend and processes them accordingly.
List of Processed Commands and Their Actions
Basic Commands
- pen_up: Lifts the pen up. Checks if a command is already running.
- pen_down: Lowers the pen. Checks if a command is already running.
- go_to(x, y): Moves the plotter to coordinates (x, y). Checks for valid coordinates and calibration.
- draw: Starts drawing if calibration is complete and no other command is running.
- pause: Pauses the current drawing operation.
- play: Resumes a paused drawing.
- stop: Stops the current drawing operation.
- update_ink_refill_routine: Updates the ink refill routine from disk.
Calibration Commands
- calibrate_automatic: Initiates automatic calibration. Ensures no other command is running.
- calibrate_manually: Starts manual calibration.
- calibrate_manually_step_down: Moves calibration one step down.
- calibrate_manually_step_up: Moves calibration one step up.
- calibrate_manually_step_left: Moves calibration one step left.
- calibrate_manually_step_right: Moves calibration one step right.
- calibrate_manually_step_stop: Stops manual calibration movement.
- calibrate_manually_fixate_down/up/left/right: Fixes specific calibration points.
Parameters Commands
- reset_to_defaults: Resets all parameters to default values.
- ink_refill_routine_enabled(true/false): Enables or disables the ink refill routine.
- ink_refill_every_penstroke(true/false): Sets whether to refill ink after each pen stroke.
- ink_refill_every_x(x): Sets the frequency of ink refills.
- default_step_sleep(value): Adjusts the sleep time between steps.
- pen_down_pulse_width(value): Sets pulse width for pen down.
- pen_up_pulse_width(value): Sets pulse width for pen up.
- pen_down_action_time(value): Time for pen-down action.
- pen_up_action_time(value): Time for pen-up action.
- pen_down_sleep_before_move_time(value): Time before moving the pen down.
- pen_up_sleep_before_move_time(value): Time before moving the pen up.
- acceleration_steps(value): Number of acceleration steps.
- deceleration_steps(value): Number of deceleration steps.
- acceleration_slow_steps_sleep(value): Sleep time for slow acceleration steps.
- acceleration_fast_steps_sleep(value): Sleep time for fast acceleration steps.
External Connection Commands
- connect_to_mg_session(id): Connects to an external MG session for event-based interactions.
- disconnect_from_mg_session: Disconnects from an MG WebSocket session.
Live Keyboard Commands
- ht_live_keyboard_on: Activates live keyboard input for pen strokes.
- ht_live_keyboard_off: Deactivates live keyboard input.
- add_to_ht_penstrokes: Reads additional pen strokes from a file and adds them.
Testing and Misc Commands
- test_ink_refill_routine: Runs a test of the ink refill routine.
- get_status: Retrieves various status parameters as JSON.
- test_bottom_stepper: Tests the bottom stepper motor.
- test_top_stepper: Tests the top stepper motor.