Skip to content

fix(robot): the first line of print(robot) names the class and the model - #862

Merged
petercorke merged 2 commits into
mainfrom
fix/robot-header-label
Oct 19, 2026
Merged

petercorke merged 2 commits into
mainfrom
fix/robot-header-label

Conversation

@petercorke

Copy link
Copy Markdown
Owner

print(robot) began with a hard-coded ERobot: for every robot that is not a DHRobot, which is the name of a class that no longer exists, and so said the wrong thing for a Robot, a Robot2 and a URDF model.

Behaviour change

The first line of the display of a robot is now X: name or X.Y: name, where X is the kind of robot (Robot, Robot2, DHRobot or URDFRobot) and Y is the class of the model when it is a subclass, for example:

Robot.Planar_Y: Planar-Y, 6 joints (RRRRRR), 2 branches
URDFRobot.Panda: panda (by Franka Emika), 7 joints (RRRRRRR), 1 gripper, geometry, collision
DHRobot.Puma560: Puma 560 (by Unimation), 6 joints (RRRRRR), dynamics, geometry
Robot: arm, 1 joints (R)

A subclass written by a user shows as Robot.Mine: .... Code that parses the first line of the display would be affected; the rest of the display is unchanged.

Changes

  • BaseRobot._class_label() gives the label, and is used by BaseRobot.__str__ and DHRobot.__str__, which each had a copy of the header. The README example is updated.
  • tests/test_robot_label.py (5 tests): an ETS model, a URDF model, a DH model, the classes themselves (Robot, DHRobot, Robot2), and a user's subclass.

Full suite: only the 20 test_servo_half_turn failures from the stale compiled extension in my worktree; mypy clean. Written with AI assistance (Claude Code).

🤖 Generated with Claude Code

…del, as DHRobot.Puma560

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke
petercorke enabled auto-merge (squash) October 19, 2026 21:25
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 7 high

Alerts:
⚠ 7 issues (≤ 0 issues of at least minor severity)

Results:
7 new issues

Category Results
Security 7 high

View in Codacy

🟢 Metrics 11 complexity · 0 duplication

Metric Results
Complexity 11
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 4766ca6 into main Oct 19, 2026
22 of 23 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (eee9488) to head (99f99b6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/roboticstoolbox/robot/BaseRobot.py 0.00% 7 Missing ⚠️
src/roboticstoolbox/robot/DHRobot.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #862   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        146     146           
  Lines      16846   16851    +5     
=====================================
- Misses     16846   16851    +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant