Skip to content

Commit f9e9784

Browse files
Minor changes to create_robot_* methods in robot.jl
1 parent 328e126 commit f9e9784

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

src/robot.jl

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct Robot{T,T_SC,n_q,n_v,n_τ}
7878
end
7979

8080
"""
81-
create_robot_franka(vis)
81+
create_robot_franka(model, vis)
8282
8383
Create a new [Franka Emika](https://www.franka.de/research) robot.
8484
"""
@@ -107,24 +107,24 @@ function create_robot_franka(model::String, vis::Visualizer)
107107
end
108108

109109
"""
110-
create_robot_kuka(model, vis)
110+
create_robot_kinova_gen2(model, vis)
111111
112-
Create a new [KUKA LBR iiwa 7/14](https://www.kuka.com/en-gb/products/robotics-systems/industrial-robots/lbr-iiwa) robot.
112+
Create a new [Kinova Gen2](https://www.kinovarobotics.com/en/products/gen2-robot) robot.
113113
"""
114-
function create_robot_kuka(model::String, vis::Visualizer)
115-
choices = ["iiwa7", "iiwa14"]
114+
function create_robot_kinova_gen2(model::String, vis::Visualizer)
115+
choices = ["j2s6s200"]
116116
if model choices
117117
msg = """
118118
Argument `model` provided value \"$(model)\" is not valid.
119119
Valid options are: $(choices)"""
120120
error(msg)
121121
else
122-
commit_hash = artifact_commit_hash("iiwa_stack")
123-
package_path = joinpath(artifact"iiwa_stack", "iiwa_stack-$(commit_hash)")
122+
commit_hash = artifact_commit_hash("kinova-ros")
123+
package_path = joinpath(artifact"kinova-ros", "kinova-ros-$(commit_hash)")
124124
urdfpath = joinpath(@__DIR__, "..", "robots", "$(model).urdf")
125125

126126
mechanism = parse_urdf(urdfpath, remove_fixed_tree_joints=false)
127-
frame_ee = default_frame(findbody(mechanism, "iiwa_link_ee"))
127+
frame_ee = default_frame(findbody(mechanism, "$(model)_end_effector"))
128128
remove_fixed_tree_joints!(mechanism)
129129

130130
urdfvisuals = URDFVisuals(urdfpath, package_path=[package_path])
@@ -136,7 +136,7 @@ function create_robot_kuka(model::String, vis::Visualizer)
136136
end
137137

138138
"""
139-
create_robot_kinova_gen3(vis)
139+
create_robot_kinova_gen3(model, vis)
140140
141141
Create a new [Kinova Gen3 lite](https://www.kinovarobotics.com/en/products/gen3-lite-robot) robot.
142142
"""
@@ -165,30 +165,38 @@ function create_robot_kinova_gen3(model::String, vis::Visualizer)
165165
end
166166

167167
"""
168-
create_robot_kinova_j2s6s200(vis)
168+
create_robot_kuka(model, vis)
169169
170-
Create a new [Kinova Gen2](https://www.kinovarobotics.com/en/products/gen2-robot) robot.
170+
Create a new [KUKA LBR iiwa 7/14](https://www.kuka.com/en-gb/products/robotics-systems/industrial-robots/lbr-iiwa) robot.
171171
"""
172-
function create_robot_kinova_j2s6s200(vis::Visualizer)
173-
commit_hash = artifact_commit_hash("kinova-ros")
174-
package_path = joinpath(artifact"kinova-ros", "kinova-ros-$(commit_hash)")
175-
urdfpath = joinpath(@__DIR__, "..", "robots", "j2s6s200.urdf")
172+
function create_robot_kuka(model::String, vis::Visualizer)
173+
choices = ["iiwa7", "iiwa14"]
174+
if model choices
175+
msg = """
176+
Argument `model` provided value \"$(model)\" is not valid.
177+
Valid options are: $(choices)"""
178+
error(msg)
179+
else
180+
commit_hash = artifact_commit_hash("iiwa_stack")
181+
package_path = joinpath(artifact"iiwa_stack", "iiwa_stack-$(commit_hash)")
182+
urdfpath = joinpath(@__DIR__, "..", "robots", "$(model).urdf")
176183

177-
mechanism = parse_urdf(urdfpath, remove_fixed_tree_joints=false)
178-
frame_ee = default_frame(findbody(mechanism, "j2s6s200_end_effector"))
179-
remove_fixed_tree_joints!(mechanism)
184+
mechanism = parse_urdf(urdfpath, remove_fixed_tree_joints=false)
185+
frame_ee = default_frame(findbody(mechanism, "iiwa_link_ee"))
186+
remove_fixed_tree_joints!(mechanism)
180187

181-
urdfvisuals = URDFVisuals(urdfpath, package_path=[package_path])
182-
mvis = MechanismVisualizer(mechanism, urdfvisuals, vis["robot"])
183-
# setelement!(mvis, frame_ee) # Visualize a triad at the end-effector
188+
urdfvisuals = URDFVisuals(urdfpath, package_path=[package_path])
189+
mvis = MechanismVisualizer(mechanism, urdfvisuals, vis["robot"])
190+
# setelement!(mvis, frame_ee) # Visualize a triad at the end-effector
184191

185-
Robot(urdfpath, mechanism, frame_ee, mvis)
192+
Robot(urdfpath, mechanism, frame_ee, mvis)
193+
end
186194
end
187195

188196
"""
189-
create_robot_ur10e(vis)
197+
create_robot_ur(ur_type, vis)
190198
191-
Create a new robot.
199+
Create a new [Universal Robots](https://www.universal-robots.com/products/) robot.
192200
"""
193201
function create_robot_ur(ur_type::String, vis::Visualizer)
194202
choices = ["ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e"]
@@ -217,7 +225,7 @@ end
217225
export
218226
Robot,
219227
create_robot_franka,
220-
create_robot_kuka,
228+
create_robot_kinova_gen2,
221229
create_robot_kinova_gen3,
222-
create_robot_kinova_j2s6s200,
230+
create_robot_kuka,
223231
create_robot_ur

0 commit comments

Comments
 (0)