-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gcode class #48
Merged
Merged
Gcode class #48
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
e8f6574
initialwork
philipp1604 b779f49
Current State Gcode_class
philipp1604 4bfc69a
Final Comit before Merge
philipp1604 60a5f3d
Merge branch 'main' into gcode_class
philipp1604 8d0ed55
Final Comit G-Code Class
philipp1604 b3e9e1d
Update gcode_dem.py
philipp1604 10e4d2b
new commit
philipp1604 12c7a68
Adjusting Codiga Errors
philipp1604 5ec0835
Update of the GCodeProcessor
philipp1604 10cad6a
Deletion of leftover files
philipp1604 cb1e25c
Final Adjustment GCodeProcessor
philipp1604 03abc0a
Renaming plane to axis
philipp1604 b3104fb
Update of read_gcode
philipp1604 4567a24
Update init-Method
philipp1604 a0a3a31
Update __init__
philipp1604 5a2bf30
Offset_def inside the __init__
philipp1604 22c9f7d
Changing GCodeProcessor to iterable object
philipp1604 700deae
Update GCodeProcessor as Iterable
philipp1604 a72dd9a
G1 commands inserted into GCode
philipp1604 9dae74d
Interpolation with Lamda Calls
philipp1604 7d1a91f
Converting into elemenary operations
philipp1604 ff0eec5
Converting every operation into a elementary operation
philipp1604 71c483a
Completion of G-Code Processor
philipp1604 7ce83fc
Adapting Test Class
philipp1604 3928a95
New version of the GCodeProccessor complete
philipp1604 57b7e5a
Reupload last Comit
philipp1604 f88a7d9
T-,M-,G- Command as Dictionaries
philipp1604 3235ff0
Merge branch 'main' into gcode_class
philipp1604 2f6b9c9
Update Test Class to Dictionary
philipp1604 fcb82a5
Implementation of self.interpolation_precision
philipp1604 08409a2
Debugging interpolation precision
philipp1604 07a6792
Debugged Interpolation Precsision
philipp1604 aba4b74
Addition of comments to the GCodeProcessor class
philipp1604 49edd97
set_path renamed to create_movement_operations
philipp1604 3307aa5
G Code Processor Update
philipp1604 e5c5e20
G Code Processor
philipp1604 9a59cb0
GCodeProcessor ready for Review
philipp1604 f64381e
Correction of the comments excpect monastry
philipp1604 326e5f2
Final Comit
philipp1604 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
% with "%" it is possible to place comments in the G-Code | ||
|
||
%Go to default position and adjust the orientation | ||
G0 X1.9 Y-0.5 Z1.7 A-1.5708 B0 C0 | ||
|
||
%Approach Gripper | ||
G0 X2.7 | ||
G0 Z1.3 | ||
|
||
%Toolchange (if programmed) | ||
T1 | ||
%Move up and adjust orientation | ||
G0 Z1.5 A-3.1415 B0 C0 | ||
%Go back to the default position | ||
G0 X1.9 Y-0.5 | ||
|
||
%Close the gripper | ||
M10 | ||
%Open the gripper | ||
M11 | ||
|
||
%Approach Toolchange position | ||
G0 X2.7 | ||
G0 Z0.7 | ||
|
||
|
||
%Decouple Gripper (if programmed) | ||
T0 | ||
|
||
%Move up and adjust orientation | ||
G0 Z1.9 A-1.57 B0 C0 | ||
%Go to default position | ||
G0 X1.9 Y-0.5 | ||
|
||
|
||
|
||
%Zero Offset - Activation | ||
G54 | ||
%Square movement and orientation flip | ||
G0 X0.2 | ||
G0 Y0.2 | ||
G0 X0 | ||
G0 Y0 | ||
%Zero Offset - Deactivation | ||
G500 | ||
|
||
%Go to default position and adjust the orientation | ||
G0 X1.9 Y-0.5 Z1.9 A-1.5707 B0 C0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
% with "%" it is possible to place comments in the G-Code | ||
|
||
%Go to default position and adjust the orientation | ||
G0 X1.9 Y-0.5 Z1.5 A-1.5707 B0 C0 | ||
%Approach Gripper | ||
G1 X2.7 | ||
G1 Z1.3 | ||
|
||
%Toolchange (if programmed) | ||
T1 | ||
%Move up and adjust orientation | ||
G1 Z1.5 A3.1415 B0 C0 | ||
%Go back to the default position | ||
G1 X1.9 Y-0.5 | ||
|
||
%Close the gripper | ||
M10 | ||
%Open the gripper | ||
M11 | ||
|
||
%Approach Toolchange position | ||
G1 X2.7 | ||
G1 Z0.7 | ||
|
||
|
||
%Decouple Gripper (if programmed) | ||
T0 | ||
|
||
%Move up and adjust orientation | ||
G1 Z1.9 A-1.5707 B0 C0 | ||
%Go to default position | ||
G1 X1.9 Y-0.5 | ||
|
||
|
||
|
||
%Zero Offset - Activation | ||
G54 | ||
%Square movement and orientation flip | ||
G1 X0.2 | ||
G1 Y0.2 | ||
G1 X0 | ||
G1 Y0 | ||
%Zero Offset - Deactivation | ||
G500 | ||
|
||
%Go to default position and adjust the orientation | ||
G1 X1.9 Y-0.5 Z1.9 A-1.5707 B0 C0 | ||
|
||
%Circular Interpolation - G2 in X-Y Plane | ||
G17 | ||
G2 Y0.5 R0.6 | ||
G2 Y-0.5 R0.6 | ||
|
||
%Circular Interpolation - G3 in X-Y Plane | ||
G3 Y0.5 R0.6 | ||
G3 Y-0.5 R0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
G0 X1.9 Y-0.5 Z1.7 A-1.5707 B0 C0 | ||
G54 | ||
G1 X0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import os | ||
import pybullet as p | ||
import pybullet_data | ||
import pybullet_industrial as pi | ||
import numpy as np | ||
|
||
|
||
def actuate_gripper(gripper: pi.Gripper, val: int): | ||
return gripper.actuate(val) | ||
|
||
|
||
def couple_endeffector(gripper: pi.Gripper, robot: pi.RobotBase, link: chr): | ||
return gripper.couple(robot, link) | ||
|
||
|
||
def decouple_endeffector(gripper: pi.Gripper): | ||
return gripper.decouple() | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
dirname = os.path.dirname(__file__) | ||
urdf_file1 = os.path.join(dirname, | ||
'robot_descriptions', 'comau_nj290_robot.urdf') | ||
urdf_file2 = os.path.join(dirname, | ||
'robot_descriptions', 'gripper_cad.urdf') | ||
urdf_file3 = os.path.join(dirname, | ||
'Objects', 'FoFa', 'FoFa.urdf') | ||
|
||
pysics_client = p.connect(p.GUI, options='--background_color_red=1 ' + | ||
'--background_color_green=1 ' + | ||
'--background_color_blue=1') | ||
p.setPhysicsEngineParameter(numSolverIterations=10000) | ||
p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0) | ||
p.setAdditionalSearchPath(pybullet_data.getDataPath()) | ||
p.setGravity(0, 0, -10) | ||
|
||
p.loadURDF("cube.urdf", [1.9, 0, 0.5], useFixedBase=True) | ||
|
||
p.loadURDF(urdf_file3, [-2, 5, 0], useFixedBase=True, globalScaling=0.001) | ||
|
||
test_robot = pi.RobotBase(urdf_file1, [0, 0, 0], [0, 0, 0, 1]) | ||
|
||
test_robot.set_joint_position(({'q2': np.deg2rad(-15.0), | ||
'q3': np.deg2rad(-90.0)})) | ||
for _ in range(100): | ||
p.stepSimulation() | ||
|
||
start_orientation = p.getQuaternionFromEuler([np.pi, 0, 0]) | ||
test_gripper = pi.Gripper(urdf_file2, [2.7, -0.5, 1.2], start_orientation) | ||
endeffector_list = [] | ||
endeffector_list.append(test_gripper) | ||
|
||
# M-Commands have to be added in this convention | ||
m_commands = { | ||
"10": [lambda: actuate_gripper(test_gripper, 1)], | ||
"11": [lambda: actuate_gripper(test_gripper, 0)] | ||
} | ||
|
||
# T-Commands have to be added in this convention | ||
t_commands = { | ||
"0": [lambda: decouple_endeffector(test_gripper)], | ||
"1": [lambda: couple_endeffector(test_gripper, test_robot, 'link6')] | ||
} | ||
|
||
dirname = os.path.dirname(__file__) | ||
textfile = os.path.join(dirname, 'Gcodes', 'gcode_G123.txt') | ||
|
||
with open(textfile, encoding='utf-8') as f: | ||
gcode_input = f.read() | ||
|
||
demonstration_object = pi.GCodeProcessor(gcode_input, test_robot, | ||
endeffector_list, | ||
m_commands, t_commands) | ||
|
||
# Create an iterator from the demonstration object | ||
demonstration_iterator = iter(demonstration_object) | ||
|
||
# Iterate over the demonstration object | ||
for _ in demonstration_iterator: | ||
# Execute the simulation steps | ||
for _ in range(200): | ||
p.stepSimulation() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is called twice for some reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line was removed