# diazpaz/movemaster architecture

> Architecture diagram of the GitHub repository diazpaz/movemaster, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/diazpaz/movemaster
- Repository: https://github.com/diazpaz/movemaster

## Overview

This repository is a one-axis SPARK MAX motion-control project, with a terminal pendant, a ROS 2 telemetry adapter, protocol utilities, and a separate CAN motor-identification script. The principal workflow is operator command → backend configuration and motion commands → SPARK MAX over CAN, with telemetry available to the caller. The sampled ROS node publishes joint state from backend telemetry. Evidence is limited to the supplied excerpts and SOURCE INDEX; some subsystem details and links are therefore omitted or marked unverified.

Main entry points: [`main/teach_pendant_backend.py`](https://github.com/diazpaz/movemaster/blob/main/main/teach_pendant_backend.py) (Axis backend), [`control_analysis/ensayo_neo_can.py`](https://github.com/diazpaz/movemaster/blob/main/control_analysis/ensayo_neo_can.py) (NEO CAN test), [`movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py`](https://github.com/diazpaz/movemaster/blob/main/movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py) (ROS 2 node), [`main/pendant_terminal.py`](https://github.com/diazpaz/movemaster/blob/main/main/pendant_terminal.py) (Terminal pendant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Operator interfaces"]
  node_pendant["Terminal pendant"]
  node_motion_example["Motion example<br/>[example_motion.py]"]
  node_maxmotion_example["MAXMotion example"]
  node_ros_node["ROS 2 node<br/>[movemaster_node.py]"]
end

subgraph group_motion["Motion control"]
  node_backend["Axis backend"]
end

subgraph group_protocol["CAN protocol"]
  node_main_codec["JSON protocol codec"]
  node_library_codec["Protocol library copy"]
end

subgraph group_analysis["CAN analysis"]
  node_analysis_script["NEO CAN test<br/>[ensayo_neo_can.py]"]
  node_test_results["Recorded test results"]
  node_can_decoder["Arbitration ID decoder"]
end

node_operator(("Operator"))
node_spark{{"SPARK MAX"}}
node_ros_consumer(("ROS joint-state consumers"))

node_operator -->|"enters commands"| node_pendant
node_pendant -->|"issues axis commands"| node_backend
node_operator -->|"sets target"| node_motion_example
node_motion_example -->|"configures and moves"| node_backend
node_operator -.->|"runs example"| node_maxmotion_example
node_maxmotion_example -->|"uses protocol"| node_main_codec
node_backend -->|"uses protocol"| node_main_codec
node_backend -.->|"sends and receives CAN"| node_spark
node_spark -.->|"returns telemetry"| node_backend
node_ros_node -->|"reads telemetry"| node_backend
node_ros_node -->|"publishes joint states"| node_ros_consumer
node_operator -.->|"starts test"| node_analysis_script
node_analysis_script -->|"sends CAN frames"| node_spark
node_analysis_script -.->|"records results"| node_test_results
node_operator -->|"enters arbitration ID"| node_can_decoder

click node_pendant "https://github.com/diazpaz/movemaster/blob/main/main/pendant_terminal.py"
click node_motion_example "https://github.com/diazpaz/movemaster/blob/main/main/example_motion.py"
click node_maxmotion_example "https://github.com/diazpaz/movemaster/blob/main/main/example_maxmotion_json.py"
click node_ros_node "https://github.com/diazpaz/movemaster/blob/main/movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py"
click node_backend "https://github.com/diazpaz/movemaster/blob/main/main/teach_pendant_backend.py"
click node_main_codec "https://github.com/diazpaz/movemaster/blob/main/main/sparkmax_json_protocol.py"
click node_library_codec "https://github.com/diazpaz/movemaster/blob/main/libraries/sparkmax_json_protocol.py"
click node_analysis_script "https://github.com/diazpaz/movemaster/blob/main/control_analysis/ensayo_neo_can.py"
click node_test_results "https://github.com/diazpaz/movemaster/tree/main/control_analysis/resultados_neo"
click node_can_decoder "https://github.com/diazpaz/movemaster/blob/main/tools/decode_arbitration_id.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pendant,node_motion_example,node_maxmotion_example,node_ros_node toneBlue
class node_backend toneAmber
class node_main_codec,node_library_codec toneMint
class node_analysis_script,node_test_results,node_can_decoder toneRose
class node_operator,node_spark,node_ros_consumer toneIndigo
```

## Components

### Operator interfaces

- [Terminal pendant](https://github.com/diazpaz/movemaster/blob/main/main/pendant_terminal.py): `main/pendant_terminal.py`
- [Motion example](https://github.com/diazpaz/movemaster/blob/main/main/example_motion.py): `main/example_motion.py`
- [MAXMotion example](https://github.com/diazpaz/movemaster/blob/main/main/example_maxmotion_json.py): `main/example_maxmotion_json.py`
- [ROS 2 node](https://github.com/diazpaz/movemaster/blob/main/movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py): `movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py`

### Motion control

- [Axis backend](https://github.com/diazpaz/movemaster/blob/main/main/teach_pendant_backend.py): `main/teach_pendant_backend.py`

### CAN protocol

- [JSON protocol codec](https://github.com/diazpaz/movemaster/blob/main/main/sparkmax_json_protocol.py): `main/sparkmax_json_protocol.py`
- [Protocol library copy](https://github.com/diazpaz/movemaster/blob/main/libraries/sparkmax_json_protocol.py): `libraries/sparkmax_json_protocol.py`

### CAN analysis

- [NEO CAN test](https://github.com/diazpaz/movemaster/blob/main/control_analysis/ensayo_neo_can.py): `control_analysis/ensayo_neo_can.py`
- [Recorded test results](https://github.com/diazpaz/movemaster/tree/main/control_analysis/resultados_neo): `control_analysis/resultados_neo`
- [Arbitration ID decoder](https://github.com/diazpaz/movemaster/blob/main/tools/decode_arbitration_id.py): `tools/decode_arbitration_id.py`

### Other components

- **Operator**
- **SPARK MAX**
- **ROS joint-state consumers**

## Connections

- Operator → Terminal pendant: enters commands (evidence: `main/pendant_terminal.py`)
- Terminal pendant → Axis backend: issues axis commands (evidence: `main/pendant_terminal.py`)
- Operator → Motion example: sets target (evidence: `main/example_motion.py`)
- Motion example → Axis backend: configures and moves (evidence: `main/example_motion.py`)
- Operator → MAXMotion example: runs example
- MAXMotion example → JSON protocol codec: uses protocol (evidence: `main/example_maxmotion_json.py`)
- Axis backend → JSON protocol codec: uses protocol (evidence: `main/teach_pendant_backend.py`)
- Axis backend → SPARK MAX: sends and receives CAN
- SPARK MAX → Axis backend: returns telemetry
- ROS 2 node → Axis backend: reads telemetry (evidence: `movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py`)
- ROS 2 node → ROS joint-state consumers: publishes joint states (evidence: `movemaster_ws/src/movemaster_ros/movemaster_ros/movemaster_node.py`)
- Operator → NEO CAN test: starts test
- NEO CAN test → SPARK MAX: sends CAN frames (evidence: `control_analysis/ensayo_neo_can.py`)
- NEO CAN test → Recorded test results: records results
- Operator → Arbitration ID decoder: enters arbitration ID (evidence: `tools/decode_arbitration_id.py`)
