Content
1. Get prepared with codes
1.1. Install visual studio code as IDE
refer to https://blog.csdn.net/huangdianye/article/details/126574121
1.2. Create a ROS workspace
refer to https://blog.csdn.net/huangdianye/article/details/126562693
1.3. Download iiwa_stack and compile it
introduction of iiwa_stack: https://github.com/IFL-CAMP/iiwa_stack/wiki
cd <to_the_src_directory_of_the_ros_workspace>
git clone https://github.com/IFL-CAMP/iiwa_stack.git src/iiwa_stack
ctrl+shift+B to huild the project
2. Laptop configuration (the Leading side - test connection)
2.1 Bashrc setting
$ gedit ~/.bashrc
and add the following two command lines into the bashrc file:
export ROS_IP=172.31.1.150
export ROS_MASTER_URI=http://$ROS_IP:11311
2.2 Wired setting
2.3 Test the connection
mind the ip address setting from the following side:
ping 172.31.1.145 # for iiwa7
ping 172.31.1.147 # for iiwa14
PS: the ip address is preset to the sunrise workbench running on the kuka control carbinet.
3. Get Started
to get started with KUKA iiwa, we have to take care of two sides, your laptop and the smart pad.
3.1 Run roscore first!!! (From the Laptop side)
roscore
3.2 Turn on the “ROSSmartServo” application (From the Smart pad side)
One could consider the “ROSSmartServo” as a roslaunch file to be launched by physically press the button on the smart pad.
- start ROSSmartServo via the SmartPad. Attention: Do not open the other one!!!
- start handguide mode
3.3 Confirm the rostopic is sucessfully transmitted
3.3.1 get the topic list
rostopic list
3.3.2 get the topic content
cd <to_the_root_directory_of_the_workspace>
source devel/setup.bash
rostopic echo /iiwa/state/CartesianPose
4 Run Moveit and get TF tree
4.1 Prepare
sudo apt install ros-noetic-moveit
create a ros package called iiwa_core
4.2 launch file
roslaunch iiwa_core iiwa_model.launch
4.3 recall other file
- iiwa_model.launch
<?xml version="1.0"?>
<launch>
<arg name="sim" default="false" doc="If true, the robot will be simulated in Gazebo" />
<!-- hardware_interface to use : PositionJointInterface, EffortJointInterface, VelocityJointInterface. -->
<arg name="hardware_interface" default="PositionJointInterface"/>
<!-- The is gonna have its nodes/topics under a namespace with the same name. -->
<arg name="robot_name" default="iiwa"/>
<!-- Model of the iiwa to use : iiwa7, iiwa14 -->
<arg name="model" default="iiwa7"/>
<arg name="rviz" default="true" />
<remap from="/$(arg hardware_interface)_trajectory_controller/follow_joint_trajectory"
to="/$(arg robot_name)/$(arg hardware_interface)_trajectory_controller/follow_joint_trajectory" />
<remap from="robot_description" to="/$(arg robot_name)/robot_description" />
<remap from="/get_planning_scene" to="/$(arg robot_name)/get_planning_scene" />
<!-- Working with the real robot. -->
<group ns="$(arg robot_name)" unless="$(arg sim)">
<!-- Load controllers accordingly to parameters -->
<include file="$(find iiwa_control)/launch/iiwa_control.launch">
<arg name="hardware_interface" value="$(arg hardware_interface)" />
<arg name="controllers" value="joint_state_controller $(arg hardware_interface)_trajectory_controller" />
<arg name="robot_name" value="$(arg robot_name)" />
<arg name="model" value="$(arg model)" />
</include>
<!-- Robot interface -->
<include file="$(find iiwa_hw)/launch/iiwa_hw.launch" >
<arg name="hardware_interface" value="$(arg hardware_interface)" />
</include>
</group>
<!-- Load move_group -->
<group ns="$(arg robot_name)">
<include file="$(find iiwa_moveit)/launch/move_group.launch">
<arg name="publish_monitored_planning_scene" value="true" />
<arg name="hardware_interface" value="$(arg hardware_interface)"/>
<arg name="robot_name" value="$(arg robot_name)"/>
<arg name="model" value="$(arg model)" />
</include>
<include if="$(arg rviz)" file="$(find iiwa_core)/launch/iiwa_rviz.launch">
<arg name="config" value="true"/>
</include>
</group>
</launch>
- iiwa_rviz.launch
<?xml version="1.0"?>
<launch>
<arg name="debug" default="false" />
<arg unless="$(arg debug)" name="launch_prefix" value="" />
<arg if="$(arg debug)" name="launch_prefix" value="gdb --ex run --args" />
<arg name="config" default="false" />
<arg unless="$(arg config)" name="command_args" value="" />
<arg if="$(arg config)" name="command_args" value="-d $(find iiwa_core)/launch/iiwa_model.rviz" />
<node name="$(anon rviz)" launch-prefix="$(arg launch_prefix)" pkg="rviz" type="rviz" respawn="false"
args="$(arg command_args)" output="screen">
<rosparam command="load" file="$(find iiwa_moveit)/config/kinematics.yaml"/>
</node>
</launch>
- iiwa_model.rviz
Panels:
- Class: rviz/Displays
Help Height: 84
Name: Displays
Property Tree Widget:
Expanded:
- /TF1/Status1
- /RobotModel1
Splitter Ratio: 0.7425600290298462
Tree Height: 781
- Class: rviz/Help
Name: Help
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Acceleration_Scaling_Factor: 0.1
Class: moveit_rviz_plugin/MotionPlanning
Enabled: false
Move Group Namespace: ""
MoveIt_Allow_Approximate_IK: false
MoveIt_Allow_External_Program: false
MoveIt_Allow_Replanning: false
MoveIt_Allow_Sensor_Positioning: false
MoveIt_Planning_Attempts: 10
MoveIt_Planning_Time: 5
MoveIt_Use_Cartesian_Path: false
MoveIt_Use_Constraint_Aware_IK: true
MoveIt_Workspace:
Center:
X: 0
Y: 0
Z: 0
Size:
X: 2
Y: 2
Z: 2
Name: MotionPlanning
Planned Path:
Color Enabled: false
Interrupt Display: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
iiwa_link_0:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_7:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_ee:
Alpha: 1
Show Axes: false
Show Trail: false
world:
Alpha: 1
Show Axes: false
Show Trail: false
Loop Animation: true
Robot Alpha: 0.5
Robot Color: 150; 50; 150
Show Robot Collision: false
Show Robot Visual: true
Show Trail: false
State Display Time: 0.05 s
Trail Step Size: 1
Trajectory Topic: move_group/display_planned_path
Use Sim Time: false
Planning Metrics:
Payload: 1
Show Joint Torques: false
Show Manipulability: false
Show Manipulability Index: false
Show Weight Limit: false
TextHeight: 0.07999999821186066
Planning Request:
Colliding Link Color: 255; 0; 0
Goal State Alpha: 1
Goal State Color: 250; 128; 0
Interactive Marker Size: 0
Joint Violation Color: 255; 0; 255
Planning Group: manipulator
Query Goal State: true
Query Start State: false
Show Workspace: false
Start State Alpha: 1
Start State Color: 0; 255; 0
Planning Scene Topic: move_group/monitored_planning_scene
Robot Description: robot_description
Scene Geometry:
Scene Alpha: 1
Scene Color: 50; 230; 50
Scene Display Time: 0.20000000298023224
Show Scene Geometry: true
Voxel Coloring: Z-Axis
Voxel Rendering: Occupied Voxels
Scene Robot:
Attached Body Color: 150; 50; 150
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
iiwa_link_0:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_7:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_ee:
Alpha: 1
Show Axes: false
Show Trail: false
world:
Alpha: 1
Show Axes: false
Show Trail: false
Robot Alpha: 0.5
Show Robot Collision: false
Show Robot Visual: true
Value: false
Velocity_Scaling_Factor: 0.1
- Class: rviz/TF
Enabled: true
Frame Timeout: 15
Frames:
All Enabled: true
iiwa_link_0:
Value: true
iiwa_link_1:
Value: true
iiwa_link_2:
Value: true
iiwa_link_3:
Value: true
iiwa_link_4:
Value: true
iiwa_link_5:
Value: true
iiwa_link_6:
Value: true
iiwa_link_7:
Value: true
iiwa_link_ee:
Value: true
world:
Value: true
Marker Alpha: 1
Marker Scale: 0.30000001192092896
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
world:
iiwa_link_0:
iiwa_link_1:
iiwa_link_2:
iiwa_link_3:
iiwa_link_4:
iiwa_link_5:
iiwa_link_6:
iiwa_link_7:
iiwa_link_ee:
{}
Update Interval: 0
Value: true
- Alpha: 0.800000011920929
Class: rviz/RobotModel
Collision Enabled: false
Enabled: true
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
iiwa_link_0:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_7:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
iiwa_link_ee:
Alpha: 1
Show Axes: false
Show Trail: false
world:
Alpha: 1
Show Axes: false
Show Trail: false
Name: RobotModel
Robot Description: robot_description
TF Prefix: ""
Update Interval: 0
Value: true
Visual Enabled: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: world
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
Value: true
Views:
Current:
Class: rviz/XYOrbit
Distance: 1.8138381242752075
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 0.4586904048919678
Y: -0.09752808511257172
Z: -4.6193542857508874e-07
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.44479644298553467
Target Frame: world
Yaw: 5.634957313537598
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1016
Help:
collapsed: false
Hide Left Dock: false
Hide Right Dock: false
MotionPlanning:
collapsed: false
MotionPlanning - Trajectory Slider:
collapsed: false
QMainWindow State: 000000ff00000000fd0000000100000000000001c00000039efc0200000007fb000000100044006900730070006c006100790073010000003d0000039e000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a0056006900650077007300000003b0000000b0000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e006701000002db0000017a0000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000001600000016fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e00670000000243000001980000017d00ffffff000005720000039e00000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Views:
collapsed: false
Width: 1848
X: 72
Y: 27
5. Turn of KUKA iiwa
Always keep in mind that the ROSSmartServo should be turned off first before close the roscore running on the laptop or the desktop PC.
-
turn off the handguide mode
-
turn off the ROSSmartServo application
-
finally turn off the roscore
-
close the terminal
03, March, 2023
Dianye Huang
Munchen