ClearCore Firmware Design

GitHub - precision-sustainable-ag/BBv3-Firmware: Firmware for Benchbot v3.1

Specifications

  • TCP communication with main computer in system.

    • CC will be server side

    • We will use a custom message protocol on top of TCP

      • Protocol should fail safely when malformed messages are received.

    • Will return error if movement command is sent before movement is completed.

  • Use a version of @Daniel Yanke 's “F” code for motion control.

  • Move to absolute position

    • All axes specified in command will move simultaneously

    • To get sequential movement, send sequential commands to explicitly delineate the path

  • Move to relative position

  • Home single Axis

  • Home all Axis

 

  • Investigate Faster deceleration when hitting limit switches.

 

image-20240717-190839.png
Top-level Parser State Machine

 

image-20240716-162723.png
Logic for String Handler to Simplify Case statement Logic

 

“?” is the character to indicate a query. It is not processed

Available Normal Operation Commands

Command

Format(s)

Description

Command

Format(s)

Description

MA

MA {Axis}{Value} [Axis][Value]… \n

Move to an absolute value on the specified axes. Movement will be triggered simultaneously on all specified axes. (Axes must be listed in the order specified during configuration.)

MR

MR {Axis}{Value} [Axis][Value]… \n

Move relative to current position on the specified axes by the specified value. Movement will be triggered simultaneously on all specified axes. (Axes must be listed in the order specified during configuration.)

CS

  1. CS\n

  2. CS ?\n

  1. Config Set, switch into config loading mode.

  2. Config Query, dump all information stored in the current config

ES

ES\n

Emergency stop, software triggered. Cancel all current movement immediately.

?P

?P\n

Query current absolute position.

?A

?A\n

Query current valid axis designations and show the order of axes in the valid axes class variable.

?S

?S\n

Query system status (motor faults, other errors)

Available Config Commands

Command

Format(s)

Description

Command

Format(s)

Description

Mot

  1. Mot {Designator}\n

  2. Mot ?\n

  1. Motor Config. Enter the process for configuring a new motor designation

  2. Motor Query. List all current Motor configurations and parameters.

Axis

  1. Axis {Designator}\n

  2. Axis ?

  1. Axis Config. Enter the process for configuring a new axis designation

  2. Axis Query. List all current Axis configurations and parameters.

E

E {I/O Port Num}\n

Specify the I/O port on the ClearCore to use as an E-stop button

Done

Done\n

Exit from Config Mode to Normal Operation

Available Motor Config Commands

Command

Format(s)

Description

Command

Format(s)

Description

Rev

Rev {Value}\n

Change the Value of the status of whether the motor is meant to be mirroring the rotation of other motors on its axis. Value is of the form of a “0” or “1”.

S/R

S/R {Value}\n

Set the Steps per Revolution to the integer Value given.

LSw

LSw {Pin}\n

Set the motor limit switch to the ClearCore input pin number on which to monitor for limit switch behavior.

Axis

Axis {Desginator}\n

Set the motor to be on the axis specified by the designator.

Done

Done\n

Exit from Motor Config Mode to return to Config Mode

Available Axis Config Commands

Command

Format(s)

Description

Command

Format(s)

Description

Home

Home {Value}\n

Set the home position of the axis in Centimeters

Lim

Lim {ValueMin:ValueMax}\n

Describe the limits of the Axis in cm

Done

Done\n

Exit from Axis Config Mode to return to Config Mode

ClearCore Method Notes

MotorDriver::Move(int32_t dist, MoveTarget moveTarget) Loads the behavior into the motor connector and step/direction pulses seem to be implemented by a co-processor of sorts. Function is non-blocking.