z1_controller/README.md

6.9 KiB
Raw Blame History

v3.6.1

The z1_controller is mainly used to control the robot arm and communicate with the Z1 SDK

Notice

support robot: Z1(v3.6.1) not support robot: Z1(v3.4, v3.5)

Dependencies

  • ROSMelodic
  • build-essential
sudo apt install build-essential
  • Boost (version 1.5.4 or higher)
dpkg -S /usr/include/boost/version.hpp	# check boost version
sudo apt install libboost-dev			# install boost
  • CMake (version 2.8.3 or higher)
cmake --version 		# check cmake version
sudo apt install cmake	# install cmake
  • Eigen (version 3.3.9 or higher)
cd eigen-3.3.9
mkdir build && cd build
cmake ..
sudo make install
sudo ln -s /usr/local/include/eigen3  /usr/include/eigen3
sudo ln -s /usr/local/include/eigen3/Eigen  /usr/local/include/Eigen
  • RBDL (version 2.6.0)
cd rbdl-2.6.0
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release ..
sudo make install
sudo sh -c "echo '/usr/local/lib' >> /etc/ld.so.conf"
sudo ldconfig

Build

# config /<path to>/z1_controller/CMakeList.txt
cd /<path to>/z1_controller && mkdir build && cd build
cmake ..
make -j4

Usage

The default IP of the robot is 192.168.123.110, you need to change the IP of your PC before using the SDK so that your PC can ping to the robot.

First, please connect the network cable between your PC and robot. Then run ifconfig in a terminal, you will find your port name. For example, enpxxx.

sudo ifconfig enpxxx down  # enpxxx is your PC port
sudo ifconfig enpxxx 192.168.123.162/24
sudo ifconfig enpxxx up
ping 192.168.123.110

Then run program.

cd /<path to>/z1_controller/build
sudo ./z1_ctrl
  • FSM(finite-state machine)
State Keyswitch Switchable
BACKTOSTART 1 2
PASSIVE 1 ~ 2 3 =
JOINTCTRL 2 ~ 1 3 4 5 6 7 8 9 0 -
CARTESIAN 3 ~ 1 2 4 5 6 9
MoveJ 4 ~ 1 2 3 5 6 9
MoveL 5 ~ 1 2 3 4 6 9
MOVEC 6 ~ 1 2 3 4 5 9
TEACH 7 ~ 1 2
TEACHREPEAT 8 automatically switches to 2
SAVESTATE 9 automatically switches to 2
TOSTATE 0 automatically switches to 2
TRAJECTORY - ~ 1 2
CALIBRATION = automatically switches to 2
NEXT ] next state

FSM Details

  • Key ~ (BACKTOSTART) : All motors return to initial positions

  • Key1PASSIVE: All motor enter passive state(The state of the Z1 startup)

  • Key2 JOINTCTRL

    Joint ID 0 1 2 3 4 5 Gripper
    Keyboard Q/A W/ S D/ E R/F T/G Y/H up/down
    Joint Action
    (right hand)
    positive
    /negative
    positive
    /negative
    positive
    /negative
    positive
    /negative
    positive
    /negative
    positive
    /negative
    positive
    /negative
  • Key3CARTESIAN: The reference coordinate system is cartesian

    Keyboard Q/A W/S E/D R/F T/G Y/H
    Key Function forward
    /backward
    right
    /left
    up
    /down
    roll
    (right hand)
    pitch
    (right hand)
    yaw
    (right hand)
  • Key4MoveJ:

    Key4—— Enter the desired end poseroll pitch yaw x y z——The Z1 joint rotate to the joint target pointAfter Z1 arrived the target point, it automatically switches to the joint space control state
    
  • Key5MoveL:

    Key5——Enter the desired end poseroll pitch yaw x y z——The Z1 follows the generated straight trajectory to the target pointAfter Z1 arrived the target point, it automatically switches to the joint space control state
    
  • Key6MoveC:

    Key6——Enter the desired middle and end poseroll pitch yaw x y z——The Z1 follows the generated arc trajectory to the target pointAfter Z1 arrived the target point, it automatically switches to the joint space control state
    
  • Key7TEACH:

    Key7——Enter the teaching trajectory label —— Drag Z1 —— Press Key2 to complete teaching.
    
  • Key8TEACHREPEAT:

    Key8———— Enter the saved teaching trajectory label—— Z1 repeate the teaching trajectory
    
  • Key9SAVESTATE:

    Key9——Enter the current pose label —— Z1 automatically switches to the joint space control state
    
  • Key0TOSTATE:

    Key0——Enter the pose label to saveAfter Z1 arrived the target point, it automatically switches to the joint space control state
    
  • Key -TRAJECTORY:

    Key - —— Z1 repeats in a written trajectory
    
  • Key=CALIBRATION)

    Key= —— Set the current position as the initial position, and enter the joint space control state after setting
    
  • Key ] NEXT: used to debug joystick contrl

    Key]—— Enter next state
    

SDK

If you want to develop your own control methods of Z1, you can refer to the SDK(z1_sdk).

We have written an example of keyboard control based on SDK, you can use it fllowing the steps below.

State change

  • First, set(CTRL_PANEL SDK) # z1_ws/src/z1_controller/CMakeList.txtand then rebuild the z1_ws to generate z1_ctrl, then open a teminal to run z1_ctrl

    cd /<path to>/z1_controller/build
    sudo ./z1_ctrl
    
  • Sencond, build the z1_sdk, and then open another terminal to run example.

    cd /<path to>/z1_sdk && mkdir build && cd build
    cmake ..
    make -j4
    ./example_state_send
    

Low level control

sudo ./z1_ctrl			# Running in a terminal
./example_lowCmd_send	# Running in another terminal

Keyboard control

sudo ./z1_ctrl				# Running in a terminal
./example_keyboard_send		# Running in another terminal

State control

sudo ./z1_ctrl				# Running in a terminal
./example_keyboard_send		# Running in another terminal