Skip to content
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

GCodeLogger #57

Merged
merged 24 commits into from
Jul 24, 2024
Merged

GCodeLogger #57

merged 24 commits into from
Jul 24, 2024

Conversation

philipp1604
Copy link
Collaborator

Description

This pull request implements the GCodeLogger, which serves as the counterpart to the GCodeProcessor, enabling the tracking of robot movement in G-Code format. The changes include the addition of the GCodeLogger class and the demonstration method g_code_logger_dem.py. Additionally, the class has been thoroughly tested with the test_g_code_logger file.

The GCodeLogger class encompasses two main functionalities:

  1. Logging G-Code: The class can monitor the current positions of the robot and track any changes noticed in the position. Documentation is provided with two different types of G-Codes, following the same style as in the GCodeProcessor. The g_code_robot_view tracks the position using Cartesian coordinates, while the g_code_joint_position tracks the G-Code with the angle of the robot joints.

  2. Writing G-Code: The class is capable of writing the G-Code to a text file from the g_code variable. The method for writing G-Code follows the correct order of the elements in the G-Code.

The demonstration method runs and tracks the robot-view and joint-position G-Code of an input G-Code. The tracked G-Codes are played in order to demonstrate usability. Furthermore, an alternative for tracking G-Code is presented at the end of the main method.

Motivation and Context

The motivation behind the GCodeLogger was to have a counterpart to the GCodeProcessor, enabling the tracking of robot movement in the G-Code format. The classes are designed to work together seamlessly. With the addition of the GCodeLogger, it becomes easier to apply simulation sequences in the real-world environment, as the created G-Code can be immediately utilized.

How has this been tested?

Every method has been tested in the test_g_code_logger.py file. The write_g_code method writes pseudo G-Code to a temporary file and compares the output to the desired result. The update_g_code methods are tested by comparing the tracked G-Code to the position that the robot was moved to. To ensure proper comparison of positions, the tracked G-Code is rounded.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

philipp1604 and others added 16 commits April 4, 2024 18:28
- this is the g_code logger class which has been moved from another project
- slight changes to the Logger Class
- the function for rounding decimals has been removed because it caused errors when running the G_Code
- the ability to round decimals will be implemented in the G-Code Simplifier
For creating the full GCodeLogger Class current changes from the GCodeProcessor have been moved to the Logger branch.
- there has been an error accuring with the joint limits if they have been slightly out of bounds
- therefore a joint limit ajduster has been implemented
- the adjuster checks if there has been a joint position recorded higher than the limits of the joint
- moving GCodeLogger into src file
- changing the structure of the GCodeLogger
- removing unused methods
- changing methods to private
- full implementation of GCodeLogger Class, Demonstration & Test Class
- this is the full version ready for a pull request
- changing the G1 entry for the Joint Position GCode
- last checks did not work maybe due to a bug
- leave robot_base unchanged
- undo changes robot_base
- solver parameters to 10000
- delte test logger
Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 94.36620% with 4 lines in your changes missing coverage. Please review.

Project coverage is 87.75%. Comparing base (485b14e) to head (1d2c231).

Files Patch % Lines
src/pybullet_industrial/g_code_logger.py 94.28% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
+ Coverage   87.26%   87.75%   +0.48%     
==========================================
  Files          15       16       +1     
  Lines         966     1037      +71     
==========================================
+ Hits          843      910      +67     
- Misses        123      127       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- Adding prefix and postfix
- Adding commands that are not part of the interpolation at the end
- Removing scientific notation at the end of number prompts
- after there has been a problem with setting up the test class, the form was updated
Build 3.8 to Build 3.10 throw the following error:

FAILED tests/test_grippers.py::TestGrippers::test_grippers - AssertionError: False is not true

Solution:

robot was changed to test_robot
- the demonstration method was updated according the new changes
Build 3.8 to Build 3.10 throw the following error:

FAILED tests/test_grippers.py::TestGrippers::test_grippers - AssertionError: False is not true
- see if bug is still happening
- robot was set up the same way as in test_grippers
- p.disconnect was added
Copy link
Contributor

@MaHajo MaHajo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

@philipp1604 philipp1604 merged commit fc4d1f4 into main Jul 24, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants