SCARA Robot Python Emulator & 2D/3D Kinematic VisualizerΒΆ

scaraemu is a standalone kinematic emulator, real-time 2D/3D visualizer, and hardware communication bridge for 4-DOF SCARA robotic manipulators.

Developed in python code.

The README is used to introduce the tool and provide instructions on how to install the tool, any machine dependencies it may have and any other information that should be provided before the tool is installed.

scaraemu python checker scaraemu python package scaraemu interface checker scaraemu isp checker scaraemu srp checker gplv3 license apache license python version github issues documentation status github contributors

πŸš€ InstallationΒΆ

scaraemu python3 build

Navigate to release page download and extract release archive.

To install scaraemu type the following

tar xvzf scaraemu-x.y.z.tar.gz
cd scaraemu-x.y.z/
# python3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
pip3 install -r requirements.txt
python3 -m build --no-isolation --wheel
pip3 install ./dist/scaraemu-*-py3-none-any.whl
rm -f get-pip.py
chmod 755 /usr/local/lib/python3.10/dist-packages/usr/local/bin/scaraemu_run.py
ln -s /usr/local/lib/python3.10/dist-packages/usr/local/bin/scaraemu_run.py /usr/local/bin/scaraemu_run.py

You can use Docker to create image/container, or You can use pip to install

# python3
pip3 install scaraemu

πŸ“¦ DependenciesΒΆ

scaraemu requires next modules and libraries

πŸ“ Tool structureΒΆ

scaraemu is based on OOP and Hexagonal Architecture.

Tool structure

scaraemu/
     β”œβ”€β”€ core/
     β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”œβ”€β”€ model/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ kinematics_config_dto.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scara_geometry.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scara_joints.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scara_pose.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scara_step_coords.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ simulation_state_dto.py
     β”‚Β Β  β”‚Β Β  └── telemetry_dto.py
     β”‚Β Β  └── service/
     β”‚Β Β      β”œβ”€β”€ demo_generator.py
     β”‚Β Β      β”œβ”€β”€ emulator_service.py
     β”‚Β Β      β”œβ”€β”€ engine.py
     β”‚Β Β      β”œβ”€β”€ iemulator_service.py
     β”‚Β Β      β”œβ”€β”€ ikinematics_service.py
     β”‚Β Β      β”œβ”€β”€ __init__.py
     β”‚Β Β      β”œβ”€β”€ iservice.py
     β”‚Β Β      └── kinematics_service.py
     β”œβ”€β”€ engine.py
     β”œβ”€β”€ infrastructure/
     β”‚Β Β  β”œβ”€β”€ cli/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ engine.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ icli.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  └── setup/
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ bundle.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ dep_validator.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ dependencies.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ factory.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ keys.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ opt_validator.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ options.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ registry.py
     β”‚Β Β  β”‚Β Β      └── validator.py
     β”‚Β Β  β”œβ”€β”€ command/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ command.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ emulator_command_definition.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ emulator_command_executor.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ icommand_definition.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ icommand_executor.py
     β”‚Β Β  β”‚Β Β  └── __init__.py
     β”‚Β Β  β”œβ”€β”€ communication/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ protocol/
     β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ command_formatter.py
     β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ command_templates.py
     β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ firmware_response_dto.py
     β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  β”‚Β Β  └── protocol_parser.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ serial_port_scanner.py
     β”‚Β Β  β”‚Β Β  └── transport/
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ itransport.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ serial_transport.py
     β”‚Β Β  β”‚Β Β      └── tcp_transport.py
     β”‚Β Β  β”œβ”€β”€ config/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scara_geometry.json
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scaraemu.cfg
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ scaraemu.logo
     β”‚Β Β  β”‚Β Β  └── scheme.json
     β”‚Β Β  └── gui/
     β”‚Β Β      β”œβ”€β”€ canvas_xy.py
     β”‚Β Β      β”œβ”€β”€ canvas_z.py
     β”‚Β Β      β”œβ”€β”€ components/
     β”‚Β Β      β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β      β”‚Β Β  β”œβ”€β”€ jog_panel.py
     β”‚Β Β      β”‚Β Β  β”œβ”€β”€ serial_bar.py
     β”‚Β Β      β”‚Β Β  β”œβ”€β”€ serial_console_panel.py
     β”‚Β Β      β”‚Β Β  β”œβ”€β”€ telemetry_panel.py
     β”‚Β Β      β”‚Β Β  └── trajectory_demo_panel.py
     β”‚Β Β      β”œβ”€β”€ engine.py
     β”‚Β Β      β”œβ”€β”€ hardware_bridge_controller.py
     β”‚Β Β      β”œβ”€β”€ icanvas_xy.py
     β”‚Β Β      β”œβ”€β”€ icanvas_z.py
     β”‚Β Β      β”œβ”€β”€ igui.py
     β”‚Β Β      β”œβ”€β”€ __init__.py
     β”‚Β Β      └── theme.py
     β”œβ”€β”€ __init__.py
     β”œβ”€β”€ py.typed
     └── setup/
         β”œβ”€β”€ bundle.py
         β”œβ”€β”€ dep_validator.py
         β”œβ”€β”€ dependencies.py
         β”œβ”€β”€ factory.py
         β”œβ”€β”€ __init__.py
         β”œβ”€β”€ keys.py
         β”œβ”€β”€ opt_validator.py
         β”œβ”€β”€ options.py
         β”œβ”€β”€ registry.py
         └── validator.py

 15 directories, 79 files

✨ Features¢

  • 2D Planar Dual-Link Visualizer: Real-time rendering of primary ($L_1$) and secondary ($L_2$) arm links, active joint angles, target crosshair, and animated motion path trail.

  • Side Elevation Z-Tower View: Multi-rod lead screw carriage elevation, active tool height, and radial extension profile visualization.

  • Interactive Targeting & Jogging: Direct mouse click position targeting on both XY and Z canvases, Cartesian delta jogging ($X, Y, Z, Phi$), Lefty/Righty elbow toggling, and Emergency Stop.

  • Autonomous Trajectory Demos: Pre-programmed autonomous demonstration trajectories (Circle, Square, 5-Point Star, 3D Helical Coil).

  • Hardware Serial Bridge & Protocol Parser: Bidirectional streaming over USB Serial (RP2040 micro-commands) with raw terminal telemetry log and manual command console.

  • Configurable Kinematics & Dimensions: Dynamic robot link lengths ($L_1, L_2$), stroke limits ($Z_{min}, Z_{max}$), and speed bounds configurable via CLI options and JSON schema.

  • Strict Quality & SOLID Standards: 100% protocol conformity, zero ISP/SRP violations, high test coverage, and 10.00 / 10.00 Pylint score.

πŸ“ SCARA Kinematic & Geometric ConfigurationΒΆ

The robot dimensions and physical boundaries can be customized in scara_geometry.json or injected programmatically:

Kinematic LimitsΒΆ

Parameter

Default Value

Description

l1

150.0 mm

Primary arm link length (shoulder to elbow).

l2

120.0 mm

Secondary arm link length (elbow to wrist).

r_min

30.0 mm

Inner singular deadzone radius (\(|L_1 - L_2|\)).

r_max

270.0 mm

Maximum horizontal reach boundary (\(L_1 + L_2\)).

z_min

0.0 mm

Minimum vertical height limit (bed level).

z_max

100.0 mm

Maximum vertical stroke limit.

min_speed

1.0 mm/s

Minimum allowable feedrate speed.

max_speed

100.0 mm/s

Maximum allowable safe feedrate speed.

πŸ“Š Code coverageΒΆ

Code coverageΒΆ

Name

Stmts

Miss

Cover

scaraemu/__init__.py

9

0

100%

scaraemu/core/__init__.py

9

0

100%

scaraemu/core/model/__init__.py

9

0

100%

scaraemu/core/model/kinematics_config_dto.py

18

0

100%

scaraemu/core/model/scara_geometry.py

24

0

100%

scaraemu/core/model/scara_joints.py

17

0

100%

scaraemu/core/model/scara_pose.py

16

0

100%

scaraemu/core/model/scara_step_coords.py

16

0

100%

scaraemu/core/model/simulation_state_dto.py

17

0

100%

scaraemu/core/model/telemetry_dto.py

21

0

100%

scaraemu/core/service/__init__.py

9

0

100%

scaraemu/core/service/demo_generator.py

55

0

100%

scaraemu/core/service/emulator_service.py

120

28

77%

scaraemu/core/service/engine.py

24

0

100%

scaraemu/core/service/iemulator_service.py

30

0

100%

scaraemu/core/service/ikinematics_service.py

24

0

100%

scaraemu/core/service/iservice.py

17

0

100%

scaraemu/core/service/kinematics_service.py

97

4

96%

scaraemu/engine.py

64

64

0%

scaraemu/infrastructure/cli/__init__.py

9

0

100%

scaraemu/infrastructure/cli/engine.py

40

7

82%

scaraemu/infrastructure/cli/icli.py

15

0

100%

scaraemu/infrastructure/cli/setup/__init__.py

9

0

100%

scaraemu/infrastructure/cli/setup/bundle.py

22

1

95%

scaraemu/infrastructure/cli/setup/dep_validator.py

36

1

97%

scaraemu/infrastructure/cli/setup/dependencies.py

18

0

100%

scaraemu/infrastructure/cli/setup/factory.py

37

1

97%

scaraemu/infrastructure/cli/setup/keys.py

28

0

100%

scaraemu/infrastructure/cli/setup/opt_validator.py

35

1

97%

scaraemu/infrastructure/cli/setup/options.py

17

0

100%

scaraemu/infrastructure/cli/setup/registry.py

31

1

97%

scaraemu/infrastructure/cli/setup/validator.py

43

5

88%

scaraemu/infrastructure/command/__init__.py

9

0

100%

scaraemu/infrastructure/command/command.py

16

0

100%

scaraemu/infrastructure/command/emulator_command_definition.py

24

1

96%

scaraemu/infrastructure/command/emulator_command_executor.py

32

5

84%

scaraemu/infrastructure/command/icommand_definition.py

14

0

100%

scaraemu/infrastructure/command/icommand_executor.py

14

0

100%

scaraemu/infrastructure/communication/__init__.py

9

0

100%

scaraemu/infrastructure/communication/protocol/__init__.py

9

0

100%

scaraemu/infrastructure/communication/protocol/command_formatter.py

38

0

100%

scaraemu/infrastructure/communication/protocol/command_templates.py

20

0

100%

scaraemu/infrastructure/communication/protocol/firmware_response_dto.py

17

0

100%

scaraemu/infrastructure/communication/protocol/protocol_parser.py

64

3

95%

scaraemu/infrastructure/communication/serial_port_scanner.py

43

3

93%

scaraemu/infrastructure/communication/transport/__init__.py

9

0

100%

scaraemu/infrastructure/communication/transport/itransport.py

22

5

77%

scaraemu/infrastructure/communication/transport/serial_transport.py

102

59

42%

scaraemu/infrastructure/communication/transport/tcp_transport.py

96

55

43%

scaraemu/infrastructure/gui/__init__.py

9

0

100%

scaraemu/infrastructure/gui/canvas_xy.py

105

71

32%

scaraemu/infrastructure/gui/canvas_z.py

74

46

38%

scaraemu/infrastructure/gui/components/__init__.py

9

0

100%

scaraemu/infrastructure/gui/components/jog_panel.py

76

47

38%

scaraemu/infrastructure/gui/components/serial_bar.py

70

46

34%

scaraemu/infrastructure/gui/components/serial_console_panel.py

56

35

38%

scaraemu/infrastructure/gui/components/telemetry_panel.py

62

34

45%

scaraemu/infrastructure/gui/components/trajectory_demo_panel.py

46

25

46%

scaraemu/infrastructure/gui/engine.py

174

114

34%

scaraemu/infrastructure/gui/hardware_bridge_controller.py

93

19

80%

scaraemu/infrastructure/gui/icanvas_xy.py

19

2

89%

scaraemu/infrastructure/gui/icanvas_z.py

17

2

88%

scaraemu/infrastructure/gui/igui.py

16

2

88%

scaraemu/infrastructure/gui/theme.py

28

0

100%

scaraemu/setup/__init__.py

9

0

100%

scaraemu/setup/bundle.py

25

1

96%

scaraemu/setup/dep_validator.py

36

1

97%

scaraemu/setup/dependencies.py

21

0

100%

scaraemu/setup/factory.py

80

3

96%

scaraemu/setup/keys.py

39

0

100%

scaraemu/setup/opt_validator.py

36

2

94%

scaraemu/setup/options.py

22

0

100%

scaraemu/setup/registry.py

34

1

97%

scaraemu/setup/validator.py

53

5

91%

Total

2683

700

74%

πŸ›  UsageΒΆ

Install package

pip3 install scaraemu

Prepare main entry point by downloading main.py or create your own.

wget -O main.py https://raw.githubusercontent.com/vroncevic/scaraemu/main/main.py

CLI Command OptionsΒΆ

Launch the graphical emulator with default configuration:

python3 main.py emulator

Launch with custom geometry overrides:

python3 main.py emulator --l1 160.0 --l2 110.0 --verbose
Emulator CLI OptionsΒΆ

Option

Type

Choices

Description

–l1

float

Length in mm

Override primary arm length L1 in millimeters.

–l2

float

Length in mm

Override secondary arm length L2 in millimeters.

–z-min

float

Limit in mm

Minimum vertical Z boundary in millimeters.

–z-max

float

Limit in mm

Maximum vertical Z boundary in millimeters.

–robot-config

str

File path

Path to custom robot geometry JSON file.

–verbose

bool

Flag

Enable verbose ATS operational logging.

Interactive Emulation & Control WorkflowΒΆ

  1. 2D/3D Kinematic Visualizer: * Inspect top-down planar canvas (XY) and side elevation carriage (Z). * Directly click anywhere inside reachable annular workspace to command moves.

  2. Manual Jogging & Axis Control: * Step along \(X, Y, Z, \Phi\) with configurable step sizes under Monitor & Jog. * Toggle between Lefty and Righty elbow configurations or toggle motor power.

  3. Autonomous Demo Trajectories: * Under the Trajectories tab, select Circle, Square, 5-Star, or 3D Helix. * Watch the real-time simulation interpolator render toolhead paths.

  4. Hardware Bridge & Telemetry Streaming: * Connect to physical SCARA microcontroller via /dev/ttyACM0 or TCP socket. * Telemetry updates synchronize live hardware position with the visualizer.

  5. Serial Command Console: * Inspect incoming raw protocol packets (<TELEM...>, <RESP:...>) and send custom commands.

πŸ“š DocsΒΆ

More documentation and info at

πŸ‘₯ ContributingΒΆ

Contributing to scaraemu