Skip to content

Commit a1ae4c4

Browse files
committed
add xacro2urdf conversion
1 parent 5d7a2a9 commit a1ae4c4

File tree

6 files changed

+1297
-0
lines changed

6 files changed

+1297
-0
lines changed

roboticstoolbox/models/DH/Lite6.py

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/usr/bin/env python
2+
3+
import numpy as np
4+
from spatialmath.base import trotz, transl
5+
from roboticstoolbox import DHRobot, RevoluteDH
6+
7+
8+
class Lite6(DHRobot):
9+
"""
10+
A class representing the Lite6 robot arm.
11+
12+
``Lite6()`` is a class which models a ufactory lite 6 robot and
13+
describes its kinematic characteristics using modified DH
14+
conventions.
15+
16+
.. runblock:: pycon
17+
18+
>>> import roboticstoolbox as rtb
19+
>>> robot = rtb.models.DH.Lite6()
20+
>>> print(robot)
21+
22+
.. note::
23+
- SI units of metres are used.
24+
- The model includes a tool offset.
25+
"""
26+
27+
def __init__(self):
28+
29+
# deg = np.pi/180
30+
mm = 1e-3
31+
32+
tool_offset = (103) * mm
33+
34+
# This Lite6 model is defined using modified
35+
# Denavit-Hartenberg parameters
36+
L = [
37+
RevoluteDH(
38+
a=0,
39+
d=243.3*mm,
40+
alpha=-np.pi/2,
41+
qlim=np.array([-2.0*np.pi, 2*np.pi]),
42+
m=1.169,
43+
I=[
44+
1.45164E-03,
45+
1.24E-05,
46+
-6.7E-06,
47+
8.873E-04,
48+
1.255E-04,
49+
1.31993E-03,
50+
],
51+
G=1,
52+
),
53+
RevoluteDH( #theta offset : -90°
54+
a=200*mm,
55+
d=0.0,
56+
alpha= np.pi,
57+
qlim=np.array([-2.61799, 2.61799]),
58+
m=1.192,
59+
I=[
60+
1.5854E-03,
61+
-6.766E-06,
62+
-1.15136E-03,
63+
5.6097E-03,
64+
1.14E-06,
65+
4.85E-03,
66+
],
67+
G=1,
68+
),
69+
RevoluteDH( #theta offset : -90°
70+
a=87*mm,
71+
d=0,
72+
alpha=np.pi/2,
73+
qlim=np.array([-0.061087, 5.235988]),
74+
m=0.930,
75+
I=[
76+
8.861E-04,
77+
-3.9287E-04,
78+
7.066E-05,
79+
1.5785E-03,
80+
-2.445E-05,
81+
1.84677E-03,
82+
],
83+
G=1,
84+
),
85+
RevoluteDH(
86+
a=0,
87+
d=227.6*mm,
88+
alpha=np.pi/2,
89+
qlim=np.array([-2*np.pi, 2*np.pi]),
90+
m=1.31,
91+
I=[
92+
3.705E-03,
93+
-2.0E-06,
94+
7.17E-06,
95+
3.0455E-03,
96+
-9.3188E-04,
97+
1.5413E-03,
98+
],
99+
G=1,
100+
),
101+
RevoluteDH(
102+
a=0,
103+
d=0,
104+
alpha=-np.pi / 2,
105+
qlim=np.array([-2.1642, 2.1642]),
106+
m=0.784,
107+
I=[
108+
5.668E-04,
109+
6E-07,
110+
-5.3E-06,
111+
5.077E-04,
112+
-4.8E-07,
113+
5.3E-04,
114+
],
115+
G=1,
116+
),
117+
RevoluteDH(
118+
a=0.0,
119+
d=61.5*mm,
120+
alpha=0,
121+
qlim=np.array([-2*np.pi, 2*np.pi]),
122+
m=0.180,
123+
I=[
124+
7.726E-05,
125+
1E-06,
126+
4E-07,
127+
8.5665E-05,
128+
-6E-07,
129+
1.4814E-04,
130+
],
131+
G=1,
132+
),
133+
]
134+
135+
tool = transl(0, 0, tool_offset) @ trotz(-np.pi / 4)
136+
137+
super().__init__(
138+
L,
139+
name="Lite6",
140+
manufacturer="ufactory",
141+
meshdir="meshes/ufactory/Lite6",
142+
tool=tool,
143+
)
144+
145+
146+
self.qr = np.array([0, 0, 0, 2.5, 0, 0])
147+
self.qz = np.zeros(6)
148+
149+
self.addconfiguration("qr", self.qr)
150+
self.addconfiguration("qz", self.qz)
151+
152+
153+
if __name__ == "__main__": # pragma nocover
154+
155+
lite6 = Lite6()
156+
print(lite6)
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/usr/bin/env python
2+
3+
import numpy as np
4+
from spatialmath.base import trotz, transl
5+
from roboticstoolbox import DHRobot, RevoluteMDH
6+
7+
8+
class Lite6(DHRobot):
9+
"""
10+
A class representing the Lite6 robot arm.
11+
12+
``Lite6()`` is a class which models a ufactory lite 6 robot and
13+
describes its kinematic characteristics using modified DH
14+
conventions.
15+
16+
.. runblock:: pycon
17+
18+
>>> import roboticstoolbox as rtb
19+
>>> robot = rtb.models.DH.Lite6()
20+
>>> print(robot)
21+
22+
.. note::
23+
- SI units of metres are used.
24+
- The model includes a tool offset.
25+
"""
26+
27+
def __init__(self):
28+
29+
# deg = np.pi/180
30+
mm = 1e-3
31+
32+
tool_offset = (103) * mm
33+
34+
# This Lite6 model is defined using modified
35+
# Denavit-Hartenberg parameters
36+
L = [
37+
RevoluteMDH(
38+
a=0,
39+
d=243.3*mm,
40+
alpha=0,
41+
qlim=np.array([-2.0*np.pi, 2*np.pi]),
42+
m=1.169,
43+
I=[
44+
1.45164E-03,
45+
1.24E-05,
46+
-6.7E-06,
47+
8.873E-04,
48+
1.255E-04,
49+
1.31993E-03,
50+
],
51+
G=1,
52+
),
53+
RevoluteMDH( #theta offset : -90°
54+
a=0.0,
55+
d=0.0,
56+
alpha=- np.pi / 2,
57+
qlim=np.array([-2.61799, 2.61799]),
58+
m=1.192,
59+
I=[
60+
1.5854E-03,
61+
-6.766E-06,
62+
-1.15136E-03,
63+
5.6097E-03,
64+
1.14E-06,
65+
4.85E-03,
66+
],
67+
G=1,
68+
),
69+
RevoluteMDH( #theta offset : -90°
70+
a=200*mm,
71+
d=0,
72+
alpha=np.pi,
73+
qlim=np.array([-0.061087, 5.235988]),
74+
m=0.930,
75+
I=[
76+
8.861E-04,
77+
-3.9287E-04,
78+
7.066E-05,
79+
1.5785E-03,
80+
-2.445E-05,
81+
1.84677E-03,
82+
],
83+
G=1,
84+
),
85+
RevoluteMDH(
86+
a=87*mm,
87+
d=227.6*mm,
88+
alpha=np.pi/2,
89+
qlim=np.array([-2*np.pi, 2*np.pi]),
90+
m=1.31,
91+
I=[
92+
3.705E-03,
93+
-2.0E-06,
94+
7.17E-06,
95+
3.0455E-03,
96+
-9.3188E-04,
97+
1.5413E-03,
98+
],
99+
G=1,
100+
),
101+
RevoluteMDH(
102+
a=0,
103+
d=0,
104+
alpha=np.pi / 2,
105+
qlim=np.array([-2.1642, 2.1642]),
106+
m=0.784,
107+
I=[
108+
5.668E-04,
109+
6E-07,
110+
-5.3E-06,
111+
5.077E-04,
112+
-4.8E-07,
113+
5.3E-04,
114+
],
115+
G=1,
116+
),
117+
RevoluteMDH(
118+
a=0.0,
119+
d=61.5*mm,
120+
alpha=-np.pi / 2,
121+
qlim=np.array([-2*np.pi, 2*np.pi]),
122+
m=0.180,
123+
I=[
124+
7.726E-05,
125+
1E-06,
126+
4E-07,
127+
8.5665E-05,
128+
-6E-07,
129+
1.4814E-04,
130+
],
131+
G=1,
132+
),
133+
]
134+
135+
tool = transl(0, 0, tool_offset) @ trotz(-np.pi / 4)
136+
137+
super().__init__(
138+
L,
139+
name="Lite6",
140+
manufacturer="ufactory",
141+
meshdir="meshes/ufactory/Lite6",
142+
tool=tool,
143+
)
144+
145+
146+
self.qr = np.array([0, 0, 0, 2.5, 0, 0])
147+
self.qz = np.zeros(6)
148+
149+
self.addconfiguration("qr", self.qr)
150+
self.addconfiguration("qz", self.qz)
151+
152+
153+
if __name__ == "__main__": # pragma nocover
154+
155+
lite6 = Lite6()
156+
print(lite6)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Generate URDF file :
2+
3+
4+
```
5+
python xacro.py -o ./lite6.urdf lite6.xacro
6+
```
7+
8+
github : https://github.com/doctorsrn/xacro2urdf
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" ?>
2+
<robot name="lite6" xmlns:xacro="http://ros.org/wiki/xacro">
3+
<xacro:include filename="$(find urdf)/lite6.urdf.xacro"/>
4+
<xacro:lite6 prefix=""
5+
joint1_lower_limit="${-2.0*3.14159}" joint1_upper_limit="${2.0*3.14159}"
6+
joint2_lower_limit="${-2.61799}" joint2_upper_limit="${2.61799}"
7+
joint3_lower_limit="${-0.061087}" joint3_upper_limit="${5.235988}"
8+
joint4_lower_limit="${-2.0*3.14159}" joint4_upper_limit="${2.0*3.14159}"
9+
joint5_lower_limit="${-2.1642}" joint5_upper_limit="${2.1642}"
10+
joint6_lower_limit="${-2.0*3.14159}" joint6_upper_limit="${2.0*3.14159}"/>
11+
</robot>

0 commit comments

Comments
 (0)