[PYTHON] I made my own parallel link robot (software version)

Parallel link robot production (software edition)

A memo for making a parallel link robot, also known as a delta robot. Soft edition.

In the mechanical edition, we used 3D CAD and 3D printing services to create the main body of a parallel link robot consisting of three servo motors. This time, I will write about the software that I made to control the servo motor from Python and move it as a robot. fusion_rendering_3.png

Required specifications

When controlling a robot, the procedure of teaching the robot the movement, which is generally called "teaching", is performed, and then the robot is automatically executed as taught. There are three main types of teaching. This time I decided to implement all of these.

Types of teaching Description
Online teaching Using the remote control that controls the robot, teach the movement while actually moving the robot.
Offline teaching Move the robot on the simulator to teach the movement.
Direct teaching Touch the robot with bare hands to teach direct movements.

Class structure

It is a class diagram of a module written in Python. class_diagram.png

The role of each class.

name of the class role
PS4Controller A class that uses the pygame module to acquire various operation information from the PS4 DualShock4 controller. The information on the analog stick is used to instruct the three-dimensional movement of the delta robot. The ○ △ □ × buttons are used to switch the view mode of the drawing area of the simulation model of the delta robot.
AX12Driver dynamixel_A class that controls the Dynamixel AX12 servomotor using the sdk module. By controlling the positioning of the three server motors that make up the delta robot, the delta robot operates up, down, left, and right.
DeltaModel A class that provides computational logic for delta robot kinematics and inverse kinematics.
DeltaBase An abstract class that provides the functions commonly required to control delta robots. In addition to initializing various classes, it provides a function to constantly draw a 3D graph of the robot shape using matplotlib.
DeltaTeaching An abstract class that provides the functionality commonly needed for teaching Delta robots. The position information of the servo motor during the teaching operation is recorded in the memory and output to a file at the end of the program. The output format is JSON.
DeltaTeachingOffline A class for offline teaching of Delta robots. From the operation information obtained from PS4Controller, the movement speed in each axial direction is acquired and the current position of the robot is calculated. Use the inverse kinematics calculation function of DeltaModel to convert the position information into the angle information of the motor. A function inherited from DeltaBase that draws the updated robot status on a virtual model on a 3D graph.
DeltaTeachingOnline A class for online teaching of Delta robots. The virtual model is controlled using the function inherited from the DeltaTeachingOffline class, and the position control instruction of the servo motor is given to the AX12Driver so that the virtual model and the actual machine are in the same state.
DeltaTeachingDirect A class for direct teaching of Delta robots. Acquires the current position information (angle) of the servo motor from the AX12Driver and records it. At the same time, the function inherited from DeltaBase reflects the same information in the virtual model on the 3D graph.
DeltaPlayerOffline A class that automatically executes offline Delta robots. By inputting the time series data of the position information of the servo motor recorded at the time of various teachings, the taught movement is reproduced by a virtual model on a 3D graph.
DeltaPlayerOnline A class that automatically executes online Delta robots. The virtual model is controlled using the function inherited from DeltaPlayerOffline, and the position control instruction of the servo motor is given to the AX12 Driver so that the virtual model and the actual machine are in the same state.

Source code

https://github.com/kizitorashiro/deltarobot

Referenced site

This is the site that I referred to when implementing it.

item URL
Inverse kinematics of delta robots https://tony-mooori.blogspot.com/2016/09/kinematics.html
Delta robot kinematics http://hypertriangle.com/~alex/delta-robot-tutorial/
Delta robot kinematics https://github.com/awesomebytes/delta_robot/blob/master/src/delta_kinematics.py
PS4 DualShock4 https://gist.github.com/claymcleod/028386b860b75e4f5472
Dynamixel servo motor specifications http://support.robotis.com/jp/product/dynamixel/ax_series/dxl_ax_actuator.htm
Dynamixel servo motor driver https://github.com/ROBOTIS-GIT/DynamixelSDK

Operation demo

demo1.png

Online teaching

Use the PS4 controller as a remote control to move the Delta robot. The virtual model on the PC and the actual machine operate in synchronization. The virtual model can be displayed with a different viewpoint by switching to view mode. Online Teaching Video

Offline teaching

Using the PS4 controller as a remote controller, you can control the virtual model of the Delta robot and at the same time record the position information as time series data. After that, the robot automatically replays the same movement. Offline Teaching Video

Direct teaching

Move the robot by directly touching it with your hands. Every time the position of the robot changes, that information is recorded as time series data. After that, the robot automatically replays the same movement. Direct Teaching Video

Recommended Posts

I made my own parallel link robot (software version)
I made my own parallel link robot (mechanical edition)
I made my own language. (1)
I made my own language (2)
I made my own AML
I made my own Python library
I made my own primitive static site generator
I made my goimports
I made my own OSS because I wanted to contribute to it
[Python] I made my own library that can be imported dynamically
Python> I made a test code for my own external file
I made my own filter plugin for text parsing of Ansible
I made my own research tool using the legal API [Smart Roppo]
Since I made my own smart lock, I will summarize the difficult points
I don't have the skills or strength, but I made my own compiler
I am making my own aws cli
I made my dog "Monaka Bot" with LineBot
[I tried using Pythonista3] Importing my own module
I made my own Django Middleware so that I can access request information from anywhere