Skip to content

Software to provide a GUI as an interface between the user and the base driving program, comes with forward and inverse kinematic scripts and a sexy GUI.

Notifications You must be signed in to change notification settings

JamesPCVR/Inverse-Kinematics-6DoF-PUMA-GUI-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

Inverse-Kinematics-6DoF-PUMA-GUI-Python

Content

What is this?

These scripts will be able to provide an intermediate GUI and calculate both forward and inverse kinematics for PUMA-Type 6DoF robots

InvKinGUI will provide a user interface so that you can control your robot. The matplotlib plot shows a preview of the calculated joint positions and allows you to verify them before executing a move. It has been designed to be easily imported into other programs for controlling your specific robot. You are able to customise the GUI to make it either look nicer or provide a little performance boost if you are running on low-power hardware like a raspberry pi.

The functions have been laid out neatly and the code has been formatted so that it isn't too hard for beginners to use and understand. Useful error messages are provided when errors are encountered for easy fixing. Settings can be changed directly from the text file if need be.

Technical definitions

The program handles the robot like the below diagram, the GUI uses degrees for the unit of angle but the radian is used in the code itself.

kinematic_diagram

GUI - Themes, colours and the colourblind

The GUI has been redesigned to be easier to navigate, look more aesthetically pleasing and it can even change its colours. Not only does this give us that sweet sweet dark mode we all know and love but also to account for the colourblind. Seperate colour palettes for the three most common types of colour blindness (protanopia, deuteranopia and tritanopia) can be selected from the colours menu in settings.

Root window

The window you will interact with most

Instructions

root dark

Show light mode and colourblind modes

root_light

light mode

root_protanope

dark mode protanope

root_deuteranope

dark mode deuteranope

root_tritanope

dark mode tritanope


Settings window

Need to tailor the program to be more like how you want it? settings is the place to visit, select a preset or push all the buttons until something works.

Instructions

settings dark

Show light mode and colourblind modes

settings_light

light mode

settings_protanope

dark mode protanope

settings_deuteranope

dark mode deuteranope

settings_tritanope

dark mode tritanope


Colours window

Don't like the preset colour options? Change them to be exactly what you want with this handy window

Instructions

colours dark

Show light mode and colourblind modes

colours_light

light mode

colours_protanope

dark mode protanope

colours_deuteranope

dark mode deuteranope

colours_tritanope

dark mode tritanope

Root window manual

See also:

Preview

Displays an abstraction of your robot with the old position (ghost) in a more transparent view.

Inverse kinematics

Takes a final destination and computes the angles required to reach that position. Use the increment and decrement buttons to change the target position or type it directly into the box.

Forward kinematics

Takes joint angles and computes the final destination. Use the increment and decrement buttons to change the target angles or type it directly into the box.

Controls - End effector

A slider that can be used for what you like really but I thought would be most useful to control the end effector

Controls - Emergency stop

Sends the new position directly to the driving program.

When the "E-Stop" button is pressed eStopFunc() is called which will handle some internal magic and then call eStop().

You need to define eStop() before calling openMainWindow()

If you do not define you own then the following function will be created:

def eStop():
    print("'eStop' function call")

Controls - Travel - Direct

Sends the new position directly to the driving program.

When the "direct" button is pressed directTravelFunc() is called which will handle some internal magic and then call directTravel(data) where the single parameter data is a dictionary of the following:

{'tx': float,
'ty': float,
'tz': float,
'rx': float,
'ry': float,
'rz': float,
'a1': float,
'a2': float,
'a3': float,
'a4': float,
'a5': float,
'a6': float,
'end': float}

You need to define directTravel(data) before calling openMainWindow()

If you do not define you own then the following function will be created:

def directTravel(data):
    print("'directTravel' function call")
    print(data)

Controls - Travel - Lerp

Uses linear interpolation to trace a straight line from the old position to the new position and the result is saved to a csv file.

When the "lerp" button is pressed lerpTravelFunc() is called which will handle some internal magic and then call lerpTravel(data) where the single parameter path is a string containing the location of the csv file.

You need to define lerpTravel(path) before calling openMainWindow()

If you do not define you own then the following function will be created:

def lerpTravel(path):
    print("'lerpTravel' function call")
    print(path)

lerp_image

Controls - Calculate inverse kinematics

Take the parameters from the inverse kinematics frame and use them to compute the joint angles required to reach the destination and put them into the forward kinematics frame. Compute time is sent to the log.

Controls - Calculate forward kinematics

Take the parameters from the forward kinematics frame and use them to compute the destination of the end effector and put them into the inverse kinematics frame. Compute time is sent to the log.

Controls - Update preview

Redraw the preview with the most up-to-date information. The button is disabled if settings "Live preview" is selected.

Controls - Home

Send the robot to its home position.

Controls - Settings

Open the settings window.

Log

Shows a list of what is being performed and when each event happened some calculation time statistics are also shown here.

Settings window manual

See also:

Lengths

Define the lengths of each joint on the robot.

Constraints

Define the maximum range of freedom for each joint, kinematics will return an error if any joints fall outside these constraints.

Preferences - Marker size

Set the size of the dots representing each joint on the robot between 1 and 8 arbitrary units (steps of 1).

Preferences - Line width

Set the thickness of the lines used to draw the robot between 1 and 8 arbitrary units (steps of 1).

Preferences - Show origins

Displays the origins at the start and end of the robot.

Preferences - Origin size

Length of the origins in % of the whole preview between 4 and 16% (steps of 1%).

Preferences - Travel on calculation

Automatically perform a direct travel after kinematics are calculated.

This can be changed to perform lerp travel instead by changing all references of this

if bool(globalsettings["Automate"]):
    directTravelFunc()

to this

if bool(globalsettings["Automate"]):
    lerpTravelFunc()

Preferences - Live preview

Automatically update the plot after a change.

Preferences - Corner radius

Change the corner radius for all widgets between 0 and 10px (steps of 1px).

Preferences - Show ghost

Shows the old robot position as a ghost in the preview.

Preferences - Ghost opacity

The percentage opacity of the ghost between 0 and 100% (steps of 10%).

Preferences - Lerp resolution

The number of steps to lerp between the old and new position between 100 and 1000 steps (steps of 100).

Presets

Performance

  • Marker size: 2
  • Line width: 2
  • Show origins: false
  • Origin size: 0
  • Travel on calculation: false
  • Live preview: false
  • Corner radius: 0
  • Show ghost: false
  • Ghost opacity: 0
  • Lerp resolution: 100

Slim

  • Marker size: 2
  • Line width: 2
  • Show origins: true
  • Origin size: 16
  • Travel on calculation: false
  • Live preview: true
  • Corner radius: 4
  • Show ghost: true
  • Ghost opacity: 50
  • Lerp resolution: 500

Normal

  • Marker size: 4
  • Line width: 4
  • Show origins: true
  • Origin size: 8
  • Travel on calculation: false
  • Live preview: true
  • Corner radius: 7
  • Show ghost: true
  • Ghost opacity: 40
  • Lerp resolution: 500

Thick

  • Marker size: 8
  • Line width: 8
  • Show origins: true
  • Origin size: 8
  • Travel on calculation: false
  • Live preview: true
  • Corner radius: 10
  • Show ghost: true
  • Ghost opacity: 30
  • Lerp resolution: 500

Save / Load

save the current settings or load the settings currently saved.

Colours window manual

See also:

Preview palette

Click the change button next to the colour you would like to change and the colour picker for your native OS will prompt you to select a new colour which will be applied but only take effect after a restart of the program.

Buttons palette

Click the change button next to the colour you would like to change and the colour picker for your native OS will prompt you to select a new colour which will be applied but only take effect after a restart of the program.

Sample

Updated after you either choose a colour or when you click the refresh button and shows you all the colours you have selected which you can then save and the program will follow the selected colours after a restart.

Colour blind modes

Drag the slider to the appropriate colour blind mode and you can preview the new colours. If they do not suit your strength of colour blindness (program assumes 100% severity) you can change the colours using the selected mode as a starting point.

Themes

Select whether to use the light or dark theme, can also follow system settings.

Refresh

Refresh the colour sample on the right-hand side.

Dimming

Changes how much to dim one button from its partner to distinguish between them.

Save / Load

save the current settings or load the settings currently saved.

About

Software to provide a GUI as an interface between the user and the base driving program, comes with forward and inverse kinematic scripts and a sexy GUI.

Topics

Resources

Stars

Watchers

Forks

Languages