KUKA IIWA 7 R800 python simulator

This folder contains necessary files to run the simulation of the KUKA IIWA 7 R800 robot

Contents

Installation

  • Install Docker (see Docker how-to)

  • clone this repository

    cd SOME_PATH
    git clone git@gitlab.fel.cvut.cz:body-schema/robots/kuka.git kuka_ws
    cd kuka_ws && git checkout pyKUKA
    
  • run the docker (see Docker how-to for more parameters)

    cd SOME_PATH/kuka_ws/Docker
    
    • to build it on your computer (slower variant, can tak hours):

      ./deploy.py -b -p SOME_PATH/kuka_ws -c kuka_sim

  • you should be in docker environment. Run

    cd kuka_ws
    catkin config --init --extend /opt/ros/noetic
    catkin build
    source devel/setup.bash
    
  • the setup is now completed. catkin config may not work if you initialized the workspace before. Run catkin clean --yes and repeat from catkin config

  • To test if everything works:

    roscore &
    rviz
    
    • you should see RVIZ window running. Close it and run pkill -f roscore to stop the roscore

Run the Docker again after installation

  • go to the Docker folder and run deploy command again

    cd SOME_PATH/kuka_ws/Docker
    ./deploy.py -e -c kuka_sim
    
    • the same can be achieved with

      docker start kuka_sim && docker attach kuka_sim

  • to open new terminal in docker

    • use deploy.py

      ./deploy.py -t -c kuka_sim

    • or

      docker exec -it kuka /bin/bash

Code

The documentation PDF can be found in kuka.pdf.
Online documentation is available at lukasrustler.cz/pykuka.

Run

The simulator can be run in two mode:
  1. ROS version - real-time, high-level planners (MoveIt!, …)

  2. Native - much faster than real-time, only low-level control

ROS version

  • install necessary things and build the workspace

  • run the simulator

    • in the terminal, run

      roslaunch bullet_ros simulation.launch
      
    • this will start the simulator and RVIZ with the robot #### Control the robot

    • to test the connection etc. you can just move the robot in RVIZ and plan from there

    • or, see examples.py

    • it shows how to control the robot, gripper. How to play trajectories and how to get IK without moving

    • the simulated robot provides position_controllers/JointTrajectoryController and velocity_controllers/JointGroupVelocityController, i.e., waypoint controller through moveit or direct assignment of joint velocities to the joints

    • the default is PositionJointInterface_trajectory_controller. You need to switch with rosservice /controller_manager/switch_controller before running joint commands

Non-ROS version

Docker how-to

FAQ

  • applications do not run on your screen (or you have some strange screen related errors)

    • in another terminal run xhost local:docker

      • if it does not work, try xhost +

        • if this does not work, nothing can be done

  • you get error of not being in sudo group when running image

    • check output of id -u command. If the output is not 1000 you have to build the image by yourself and can not pull it

      • this happens when your account is not the first one created on your computer

  • ``sudo apt install something`` does not work

    • you need to run sudo apt update first after you run the container for the first time

      • apt things are removed in Dockerfile, so it does not take unnecessary space in the image

Docker Installation

Parameters for deploy.py

  • cd to folder with Dockerfile

  • ./deploy.py

    • -b or --build when building

      • default: False

    • -nv or --nvidia when you want to use your Nvidia card

      • you have to use it when creating a new container

      • default: False

    • -e if you just want to run existing docker without building

      • default: False

    • -p or --path with path to current folder

      • default: “”

    • c or --container with desired name of the new, created container

      • default: my_new_docker

    • t or --terminal to run new terminal in running docker session

      • default: False

    • -pu or --pull to pull the image from our NAS server

      • default: False

    • -pv or --python-version to specify addition python version to install

      • default: 3.11

    • -pcv or --pycharm-version to specify version of pycharm to use

      • default: 2023.2.3

    Do this on computer where you will run the code. If you have a server you have to run it on the server over SSH to make things work properly.

Non-docker installation

This repository contains files to make everything run under ros noetic on Ubuntu 20.04. If you want to install it by yourself, see Dockerfile for inspiration. Also, use pcan_python as it is changed from python2 to python 3; and peak-linux-driver as this is working version. There are probably some hacks needed, so see the Dockerfile.

pyKUKA

bullet_ros