Results

Video Demonstrations


Kendo Robot - Pull out sword motion


Kendo Robot - Defense


Kendo Robot - Fight Back

Project Summary

Introduction

The project was a part of the course "Introduction to Robotics", fall semester 2014 at University of California Berkeley.

The end goal of this project is to turn Baxter into a kendo fighter and let him play kendo with a human. The preliminary goal of this project is to make Baxter defend himself and block the attacker’s sword. The second goal is to make it fight back after defense, and try to knock down attacker’s sword. Besides, we also hope baxter can play some martial art actions such as pulling out a sword.

This is an interesting project. It incorporates many technical areas, including image perception, path planning, inverse kinematics and interaction between human and robot. Baxter is a humanoid robot, which makes him a good candidate for the kendo fighter.

Nowadays, there are some research and applications in kendo robot, like MUSA. The kendo robot is not only entertaining but is also closely related to cutting-edge research in robotics, such as accuracy control, response time control and human simulation. In particular, a possible real-world robotics application is to make a robot exercise coach.

Design

Desired Functionality

Design Criteria

Design Illustration

The ARTag is attached in the upper part of the sword that the user is holding. Baxter uses his head camera to detect the ARTag in order to know the approximate pose of the user’s sword. We choose No.23 ARTag.

In our project, the size of ARTag is chosen to be 3.5 cm by 3.5 cm. Through testing, we found that the ARTag can be detected from a distance about 70 cm from the head camera, with a perspective of 150 degrees. This is within the reachable range of the robot. We chose this as the designed defending space.

We use a gripper button control example from the SDK of Rethink Robotics. This program can be run in parallel with other code. We can control the gripper any time we want thus it iss easy for us to pass the sword to the robot. The circular button is used to open the gripper and the dash button is used to close the gripper.

- Algorithm

The algorithms for defense, fightback and pulling out sword action will be illustrated separately.

For defense, after getting the position of the ARTag, we will set the goal position of the right gripper. Since we let the robot always hold the sword vertically, the goal position of the the right gripper can be set to be just 10 cm below the position of ARTag. That is, x_goal = x_artag, y_goal = y_artag, and z_goal = z_artag - 0.10.

For fight back, we first need to know whether the attacker’s sword is to the right or the left of the robot. If it is to the right, the robot will hit from the left. If it is to the left, the robot will hit from the right.

For fight back, we first need to know whether the attacker’s sword is to the right or to the left of the robot. If it is to the right, the robot will hit from the left. If it is to the left, the robot will hit from the right.

For the pulling out sword motion, we set several different stages of action, which are explained in one of the videos. The core of this part is to make Baxter switch the hand holding the swort from the left gripper to the right gripper and to pull out the sword in a straight line without breaking it. While the left gripper is holding the sword, the right gripper will reach the sword in the direction of the y-axis of the left gripper, and then it will pull out the sword in the direction of the x-axis of the left gripper. We use the function “compute_cartesian_path” to achieve this.

To make sure that the robot will not execute weird trajectories or make the sword collide with his own body, we add orientation constraints for the gripper during the path execution. Orientation is expressed in quaternions. During defense, the right gripper is always pointing straightly out to the left.

Because of the reason that the robot waits for a long time before it re-plans a path after failing to do so, the path planning is adjusted down to 1 second, which greatly reduces the response time of the robot’s movement.

When a human holds the sword, it is difficult to hold it perfectly still, and it will most likely tremble some. The robot will plan and execute a new path every time it detects a change in position of the ARTag. As a result, the robot’s arm will shake during the defense. To avoid shaking, the algorithm is designed to plan a new path only if the distance between the new detected position and the previous detected position exceeds the threshold we set. In our program, the threshold is set to be 5 cm.


Design Choices and Tradeoff

The real sword used in kendo competition is very thin. We tried to make our model sword similar to the real sword. However, since we need to attach an ARTag on it and it needs to be large enough for detection, the model sword can’t be too thin. We choose 3.6 cm as a compromised solution.

The reachable range of Baxter is about 100 cm in front of him. We wanted the range of defense of the robot to be as large as possible. However, due to the resolution of the head camera and the size of the ARTag we decided on using, we limited the defense range to be 70 cm, to guarantee its functionality and reliability.

We hoped the robot could use different poses for defense, but this lead to more failures of path planning and sometimes the robot would make the sword collide with its body possibly even hitting people near it. In order to make it safe, we added constraints to the right gripper to make sure it is always pointing straight to the left while moving (as shown in the picture). In this way, the robot will always hold the sword vertically, which also makes the defense algorithm simpler. However, this trades off the flexibility of the robot.


Design Evaluation

Baxter is a low-cost robot which is unfortunately not very accurate. However, our project is not too dependant on a high accuracy so we coordinated the defense range and the size of ARTag. Therefore our design is able to meet the accuracy requirements.

Due to our reliable algorithms, along with orientation constraints and shaking elimination, the system is robust. Throughout a lot of tests that we made, it worked as expected for most of the time.

One downside of our system is that it is not efficient enough. Limited by the delay in ARTag detection and the time needed for the path planning and execution processes, the robot can only response to static attack. That is, a human needs to hold a sword in a certain position without moving. Then it takes the robot about 3 seconds to perform the defense action. This means we are quite far from real-word applications. For a more efficient Kendo robot, it should be able to respond to a moving sword, which would require a real-time control.

Implementation

System Implementation

The robot uses its head camera to detect the ARTag attached to the attacker’s sword. It publishes this information to the ar_track_alvar node. This library is used to calculate the position and orientation of the ARTag and to publish it to the ‘/tf’ topic. The ‘/kendo_node’ is our main program. By subscribing ‘/tf’ topic. It can get the pose of the attacker’s sword and thus calculate the goal pose of the gripper. We then use MoveIt to plan and execute the path. At the same time, a ‘/gripper_control’ node is running in the background. We use rviz to visualize these results.

Hardware

Baxter is an industrial robot built by Rethink Robotics. Introduced in September 2012, Baxter is a 180 cm tall two-armed robot and it weighs 75 kg.

ARTag marker system allows for tracking capabilities that calculate the real camera position and orientation relative to physical markers in real time.

For the sake of safety and being low-cost, we decided to use a simple model sword. We used cardboard to make two model swords. The swords are about 70 cm in length and 3.6 cm in width. The shape is rectangular because we want to attach an ARTag on one of its sides. We also took the resolution of the robot’s head camera into account when deciding the width of the sword.

Software Resources

The Robot Operating System (ROS) is a set of open-source software libraries and tools that facilitates to build robot applications.

Baxter Software Development Kit (SDK) offers an interface to manipulate the robot.

tf is a package that lets the user keep track of multiple coordinate frames over time. We can transform points, vectors, etc, between any two coordinate frames at any desired point in time.

This library is used for identifying and tracking ARTag, and to calculate the position and orientation of the ARTag with respect to different frames.

MoveIt! is a state of the art software for mobile manipulation, incorporating motion planning, manipulation, 3D perception, kinematics, control and navigation. In our project, we mainly use its path planning and execution capabilities.

rviz is a 3D visualizer for displaying sensor data and state information from ROS. We used it to monitor the detection of ARTag and to get the data of gripper pose.

Core Software

The node subscribes to the ‘/tf’ topic, once there is data for ar_marker_23, we read the pose of ARTag using tf listener. If the distance compared to the position of the last detection exceeds the threshold, we set the goal pose of the gripper and execute the defense action.

The fightback part follows after the defense part. After defense, the robot will go back to the start position and determine whether the attack comes from the left side or the right side. If the attack comes from the left side, we plan a path in order to hit from the right, and vice versa. All these path executions are achieved by using MoveIt.

This is also achieved by MoveIt. In particular, we use “compute_cartesian_path” to calculate the waypoints thus the robot will move its right gripper from a certain direction to approach the sword and then pull out the sword in a straight movement . Besides, we also use the button interface. That is, the robot will do a series of actions automatically after we press a cuff button.

This program will keep on going and read the state of the buttons (DigitalIO from baxter_interface). If the state changes, corresponding operation will be executed, as described in the design of the system.

This program is offered by our GSI. It is used to correct the head camera frame since the original one is way off in both rotation and translation. With testing and calibration, this code works well.

This is used to run all the nodes used in the program, including enable the robot, start trajectory controller, start MoveIt, close hand camera, open head camera, start ar_track_alvar, start rviz and run gripper control program.

Results

Our project worked out nicely as expected. Baxter can successfully and consistently detect an incoming attack with good precision. He can then block it and counter attack by moving his sword around, hitting the attackers sword from the other side. Additionally, our kendo robot can also play martial art tricks. He can perform the action of pulling out a sword and wave it, just like a real kendo fighter. Check out our demos!

Conclusion

In conclusion, we finished our project well in time. Our solution meets our design criteria. Apart from finishing our preliminary goal (defense), we also achieved our advanced goal (fightback). Besides, we added some new and interesting functionality (pulling out a sword) to our kendo robot.

We did encounter some difficulties along the way. At the beginning, we had difficulties setting up the development environment and this cost us a lot of time, which is also called project momentum. After getting familiar with all the tools and environment, we progressed smoothly. Another major difficulty was getting a good enough precision of the attacking sword using the ARTag system. We solved this by coordinating the size of ARtag and defending range of the robot.

A possible flaw of our kendo robot is that it has a long response time, which makes it can only respond to a static attack. Due to the limitation of Baxter, it is hard to make a real-time kendo robot with Baxter. However, if we had additional time, it would be possible to implement motion recognition by recording the sword trajectory, and then develop a smarter and more functional defense algorithm. We could set the trajectories instead of just setting the goal pose, which would improve the performance of our kendo robot and make it more realistic.

Team

Ingrid Kugelberg - Visiting Student from Sweden, currently in her first year of Masters, specializing in Mechatronics. Bachelor in Applied Physics and Electrical Engineering (2014). Profile on LinkedIn

James Lam - Senior undergraduate student in EECS department of UC Berkeley, with a concentration of robotics, network, and embedded system Profile on LinkedIn

Jiewen Sun - Graduate student in the Master of Engineering student. Major in EECS with a concentration of robotics and embedded software.Profile on LinkedIn

Scripts

Download our source code here.

References