Make sure you are using robo-nd VM or have Ubuntu+ROS installed locally.
Check the version of gazebo installed on your system using a terminal:
$ gazebo --version
To run projects from this repository you need version 7.7.0+ If your gazebo version is not 7.7.0+, perform the update as follows:
$ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
$ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install gazebo7
Once again check if the correct version was installed:
$ gazebo --version
For the rest of this setup, catkin_ws is the name of active ROS Workspace, if your workspace name is different, change the commands accordingly
If you do not have an active ROS workspace, you can create one by:
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make
Now that you have a workspace, clone or download this repo into the src directory of your workspace:
$ cd ~/catkin_ws/src
$ git clone https://github.com/Junzhuodu/Forward-Inverse-Kinematics.git
Now from a terminal window:
$ cd ~/catkin_ws
$ rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
Build the project:
$ cd ~/catkin_ws
$ catkin_make
Add following to your .bashrc file
export GAZEBO_MODEL_PATH=~/catkin_ws/src/Forward-Inverse-Kinematics/kuka_arm/models
source ~/catkin_ws/devel/setup.bash
$ roslaunch kuka_arm forward_kinematics.launch
If successful, you should see:
You can use tf_echo
command on ROS to easily obtain the transform between parent and child links from the TF display on the left side panel.
$ rosrun tf tf_echo [reference frame] [target frame]
Open another terminal window and type:
$ rosrun tf tf_echo base_link gripper_link
You can use the tf_echo
command to obtain the orientation and position of the end-effector.
As for how to create forward kinematics and inverse kinematics for KR210, you can read the writeup.md
file.
After you finsh your forward kinematics section, you can run Calculate_FK.py
to verify that each individual transform is correct.
$ python Calculate_FK.py
After you finish your inverse kinematics section, you can run Calculate_IK.py
to check your inverse calculations.
$ python Calculate_IK.py
$ cd ~/catkin_ws
$ rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
$ cd ~/catkin_ws/src/Forward-Inverse-Kinematics/kuka_arm/scripts
$ sudo chmod +x target_spawn.py
$ sudo chmod +x IK_server.py
$ sudo chmod +x safe_spawner.sh
Build the project:
$ cd ~/catkin_ws
$ catkin_make
Launch the project:
$ cd ~/catkin_ws/src/Forward-Inverse-Kinematics/kuka_arm/scripts
$ ./safe_spawner.sh