How to generate a perfect URDF for a cobot (Robotic Arm) for ros2 using Solid works for gravity compensation mode with cyclic syncronous torque mode?

We have a cobot. We are making URDF for ROS2 and for real hardware for gravity compensation mode and CST Cyclic Synchronous Torque Mode with EtherCAT. Links and Joints are such that if Link X has motor, motor is all inside this link joint, and its output rotating side is attached with the flange (half inside link X and half inside Link Y)

Flange is attached fixed to Link Y via screws so it rotates with Link Y Flange other face is attached to output (rototaing part of Link X)

The Motor has Strain Wave Gear (harmonic Drive) attached to its rotor.

Problem: Now, I want to know what Part of Motor should be taken along with Link X, Like in tag as part of the link and same for Link Y.

Because we are going to put these masses separately in soldiworks and then generate its URDF.
So, what things belong to what part. Like do we add stator in link X as fixed in solidworks so its Center of Mass is calculated with it for tag? or what

  • rotor mass
  • strain wave gear input side mass
  • strain wave gear output side mass
  • stator mass

Please Someone guide me how to achieve this in industrial way and correct way. Also how much error in mass is okay?

After launch please validator because I kept running into the same problem: testing URDF files required a full ROS install just to catch basic structural errors.
**Live tool (no signup): Free URDF Validator RoboInfra simple upload file and validate.

:locked: Privacy note:

i) Your URDF/Xacro files are never stored or reused
ii) Everything runs in-memory and is discarded after validation
iii) Only minimal metadata is used for abuse protection