Skip to content

Commit 4c35d2c

Browse files
authored
Enable initial position param in kinova xacros (Kinovarobotics#190)
1 parent eac70d1 commit 4c35d2c

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

kortex_description/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif()
99
find_package(ament_cmake REQUIRED)
1010

1111
install(
12-
DIRECTORY arms grippers launch multiple_robots robots rviz
12+
DIRECTORY arms grippers launch multiple_robots robots rviz config
1313
DESTINATION share/${PROJECT_NAME}
1414
)
1515

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# NOTE: Used for both 6 and 7 dof bots. The joint_7 value will be unused for 6 dof bots
2+
joint_1: 0.0
3+
joint_2: 0.0
4+
joint_3: 0.0
5+
joint_4: 0.0
6+
joint_5: 0.0
7+
joint_6: 0.0
8+
joint_7: 0.0

kortex_description/robots/gen3.xacro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<xacro:arg name="use_external_cable" default="false" />
2828

2929
<xacro:include filename="$(find kortex_description)/robots/kortex_robot.xacro" />
30+
<!-- initial position for simulations (Mock Hardware, Gazebo, Ignition) -->
31+
<xacro:arg name="initial_positions_file" default="$(find kortex_description)/config/initial_positions.yaml"/>
32+
<!-- convert to property to use substitution in function -->
33+
<xacro:property name="initial_positions_file" default="$(arg initial_positions_file)"/>
3034
<link name="world" />
3135
<xacro:load_robot
3236
parent="world"
@@ -51,7 +55,8 @@
5155
sim_gazebo="$(arg sim_gazebo)"
5256
sim_ignition="$(arg sim_ignition)"
5357
sim_isaac="$(arg sim_isaac)"
54-
use_external_cable="$(arg use_external_cable)" >
58+
use_external_cable="$(arg use_external_cable)"
59+
initial_positions="${xacro.load_yaml(initial_positions_file)}" >
5560
<origin xyz="0 0 0" rpy="0 0 0" /> <!-- position robot in the world -->
5661
</xacro:load_robot>
5762

kortex_description/robots/kinova.urdf.xacro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
<!-- import main macro -->
3737
<xacro:include filename="$(find kortex_description)/robots/kortex_robot.xacro" />
3838

39+
<!-- initial position for simulations (Mock Hardware, Gazebo, Ignition) -->
40+
<xacro:arg name="initial_positions_file" default="$(find kortex_description)/config/initial_positions.yaml"/>
41+
42+
<!-- convert to property to use substitution in function -->
43+
<xacro:property name="initial_positions_file" default="$(arg initial_positions_file)"/>
44+
3945
<!-- create link fixed to the "world" -->
4046
<link name="world" />
4147

@@ -61,7 +67,8 @@
6167
fake_sensor_commands="$(arg fake_sensor_commands)"
6268
sim_gazebo="$(arg sim_gazebo)"
6369
sim_ignition="$(arg sim_ignition)"
64-
sim_isaac="$(arg sim_isaac)" >
70+
sim_isaac="$(arg sim_isaac)"
71+
initial_positions="${xacro.load_yaml(initial_positions_file)}" >
6572
<origin xyz="0 0 0" rpy="0 0 0" /> <!-- position robot in the world -->
6673
</xacro:load_robot>
6774

kortex_description/robots/kortex_robot.xacro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
isaac_joint_commands:=/isaac_joint_commands
2828
isaac_joint_states:=/isaac_joint_states
2929
use_external_cable:=false
30+
initial_positions:=${dict(joint_1=0.0,joint_2=0.0,joint_3=0.0,joint_4=0.0,joint_5=0.0,joint_6=0.0,joint_7=0.0)}
3031
gripper_max_velocity:=100.0
3132
gripper_max_force:=100.0">
3233

@@ -57,7 +58,8 @@
5758
gripper_joint_name="${gripper_joint_name}"
5859
gripper_max_velocity="${gripper_max_velocity}"
5960
gripper_max_force="${gripper_max_force}"
60-
use_external_cable="${use_external_cable}">
61+
use_external_cable="${use_external_cable}"
62+
initial_positions="${initial_positions}">
6163
<xacro:insert_block name="origin" />
6264
</xacro:load_arm>
6365

0 commit comments

Comments
 (0)