+
    KTj                        R t ^ RIt^ RIt^ RIt^ RIHu Ht ^ RIt	^ RI
t
^ RIHtHt ^ RIHtHtHtHtHtHt ]! ]P.                  4      ^8  d   ]P.                  ^,          MRt]! ]P.                  4      ^8  d   ]P.                  ^,          MRtRt]P6                  ! ]RR7       ]t]! ]! ]^ ,          ],          4      4      ]! ]! ]^,          ],          4      4      utt ]! ]! ]R	,          R
,          ],          4      4      t!]! ]4      t"]"PG                  ]] 3]!^R7      t$]PJ                  PM                  ]R4      t']
PP                  ! ]']$4       ]
PR                  PU                  ]]
PR                  PW                  4       4      t,],P[                  ]$P\                  ^8X  d   ]
P^                  ! ]$]
P`                  4      M]$4      w  t1t2t3]1 U u. uFA  p ]	Ph                  Pk                  V ^ ,          ^ ,          V ^ ,          ^,          ,
          4      NKC  	  up t6]7! R] R]  R]2f   ^ M]! ]24       R]2e   ]8! R ]2Ps                  4        4       4      M.  24       ]7! R]	Pt                  ! ]64      R R]],          R R] R]	Pt                  ! ]64      ],          R R2	4       ]
P^                  ! ]$]
P`                  4      t;]	Px                  ! ^Z]^3^]	Pz                  4      t>]
P~                  ! ]>R]! ]^ ,          4       R]! ]^,          4       R]! ]4       R]R,          ^ ,           R]R,          RR,           R2RS]
P                  R RT^4       ]! ]! ^2],          4      4      tA]
P                  ! ]>RU^]A,           ^>3RT^4       ]
P~                  ! ]>R!^]A,           ^
,           ^D3]
P                  R"RT^4       ]	P                  ! ];]>.4      t;]
P                  ! ];RV]^,
          ];P                  ^ ,          ^,
          3RT^4       ]
PP                  ! ]PJ                  PM                  ]R#4      ];4       ^ R$IFHGtG ]R%,          tHRW F\  tI]GP                  ! ]PJ                  PM                  ]]I4      4      P                  ]PJ                  PM                  ]]I4      ]H]H3R&7       K^  	  ]GP                  ! R']! ]! ^],          4      4      ]! ]! R(],          4      4      3R)4      tM]GP                  ! ]PJ                  PM                  ]R#4      4      P                  R'4      tO]MP                  ]O]MP                  ]OP                  ,
          ^,          ]MP                  ]OP                  ,
          ^,          34       ]MP                  ]PJ                  PM                  ]R*4      ]H]H3R&7       ]MP                  ]PJ                  PM                  ]R+4      R,]HR-7       ]7! R.]HR R/24       ]^ ,          R0,          ]^,          R0,          utStT]P                  ! ]]PJ                  PM                  ]R14      4       ]J! ]PJ                  PM                  ]R24      R34      P                  R4]SR5 R6]TR5 R724       ]P                  ! ]4      tX]XP                  4       tZ]ZP                  R84      t\]P                  ! ]\R9R:R;R<R=R>R/4       ]P                  ! ]\R?R:R;R9R;/4       ]P                  ! ]\R@R:RAR>R1RB]SR5 R6]TR5 RC2RDRE/4       ]w  t^t_t`]P                  ! ]ZP                  RF4      RGR<R@R@RAR?R;RH]^ R6]_ R6]` 2RIRJRKRJ/4       ]P                  ! ]XRL4       ]PJ                  PM                  ]PJ                  P                  ]4      RM4      tc]XP                  ]cRNRO7       ]P                  ! ]']PJ                  PM                  ]PJ                  P                  ]4      R4      4       ]7! RP] RQ]c 24       R# u up i )Xa  Generate the large calib board and hook it into MuJoCo.

Outputs (into ./calib_board_out/ + the arm model dir):
  calib_board_grid.png        exact 8px/mm board texture (true 35mm markers)
  calib_board_print_page.png  printable page + a 50mm scale bar to verify print scale
  calib_board.xml             standalone board plane + floor + light (for localization)
  <armdir>/arm_calib_board.xml   arm_umi_v2 + the calib board plane at BOARD_POSE (AR overlay)

Run where aruco_plane.obj and the arm model live (cad tree / mj_arm_v2).
N)DICTboard)CALIB_BOARD
CONTENT_MM	CANVAS_MM	PX_PER_MM	MARKER_MMBOARD_POSE_XYZzmj_arm_v2/arm_umi_v2.xmlzmj_arm_v2/aruco_plane.objcalib_board_outT)exist_okmargin_mi  )
marginSize
borderBitscalib_board_grid.pngzgrid xzpx  z markers ids c              #   8   "   T F  p\        V4      x  K  	  R # 5i)N)int).0is   & ar_view/gen_calib_board.py	<genexpr>r   (   s     .1As   z  median marker side z.1fzpx  (expect z.0fzpx = zmm) -> z.2fmmzCALIB BOARD  zmm  zmm markers  ids ids-z  (print at 100%)g333333?z50mm (measure to verify scale)g      ?calib_board_print_page.png)Imagegffffff9@)dpiRGBi)  whitezcalib_board_a4.pngzcalib_board.pdfPDF)
resolutionztagged PNGs at z5 dpi; wrote calib_board.pdf (A4, prints at true size)g     r@zaruco_plane.objzcalib_board.xmlwa/  <mujoco model="calib_board">
  <compiler autolimits="true"/>
  <visual><global offwidth="1600" offheight="1600"/></visual>
  <asset>
    <texture name="calib" type="2d" file="calib_board_grid.png"/>
    <material name="calib" texture="calib"/>
    <mesh name="calib_plane" file="aruco_plane.obj" scale="z.5f a   0.001" inertia="shell"/>
    <texture name="grid" type="2d" builtin="checker" rgb1="0.22 0.27 0.32" rgb2="0.16 0.2 0.24" width="300" height="300"/>
    <material name="floor" texture="grid" texuniform="true" texrepeat="4 4"/>
  </asset>
  <worldbody>
    <light pos="0 0 1.2" dir="0 0 -1" diffuse="0.9 0.9 0.9"/>
    <geom type="plane" size="1 1 0.05" pos="0 0 0" material="floor"/>
    <geom type="mesh" mesh="calib_plane" material="calib" pos="0 0 0.001" contype="0" conaffinity="0"/>
  </worldbody>
</mujoco>
assettexturenamecalibtype2dfilematerialmeshcalib_planescalez 0.001inertiashell	worldbodygeomposcontype0conaffinityz  zarm_calib_board.xmlunicode)encodingzwrote z(/ (grid, print page, calib_board.xml) + )      )    r;   r;   )r9   >   )   r=   )r   r   )d__doc__osshutilsysxml.etree.ElementTreeetreeElementTreeETnumpynpcv2aruco_boardsr   r   mkboardcalib_boardr   r   r   r   r   r	   lenargvARM_XML	PLANE_OBJOUTmakedirsppmr   roundcwch	margin_pxgbgenerateImagegridpathjoin	grid_pathimwritearucoArucoDetectorDetectorParametersdetdetectMarkersndimcvtColorCOLOR_GRAY2BGRcornersr   _linalgnormsidesprintsortedflattenmedianpagefulluint8stripputTextFONT_HERSHEY_SIMPLEXbarlinevstack	rectangleshapePILr   DPIfopensavenewa4convertpppastewidthheightsxsycopywriteparsetreegetrootrootfindr#   
SubElementbxbybzindentdirnamearm_out)cs   0r   <module>r      s  	 
  
 " "  
 / ` `SXX*#((1+0Jsxx=1,CHHQK2M	 C$  
U9Q<#%&	'U9Q<#3E-F)GBk*-4s:;<	[	RY1EGGLL45	 It 	iidCII$@$@$BC##dii[\nCLLs7I7I$Jbfga4;<Gq!Q!A$q')	*G< bT2$d1S:-25/..	.rJL M bii.s3<	#c?RRWXaWb cIIeS %R) * ||D#,,-
RS"((+ E]3y|#4"5Qs9Q<7H6IcR[nM] ^u%a();u+=b+A*BBSUc..YC 
%S/ 28R.)Q 7 E3b3hmR5H#JbJbdgirtu v	yy$ dFR!VTZZ]Q%67A F BGGLL:;T B
 $	?A	JJrww||C#$))"'',,sA*>S#J)O 
@
YYus5y12CcIo8N4OPRYZ
ZZS">?@HHO rxx"(("q(299ryy+@Q*FG H S./c3Z @ S+,e D Cy UV W 
1	y|e3B Irww||C):; < RWW\\#()3 / 5 5 ;< =?s81RH 
M7 & 
xx||~		' eY&$H^ _ ` eZ&'9g!F G eVfmV=N%"S2c(&'A9gW X
B dii$fvv}j'AbT2$'CMN 		$ 
'',,rwww/1F
G 

7Y
 ' Irww||BGGOOG$<>TU V se;G9E FM 	=s   A_