Skip to content

Commit

Permalink
added explanatory comments to modification class
Browse files Browse the repository at this point in the history
  • Loading branch information
GrmanRodriguez authored and AlexAntn committed Feb 10, 2022
1 parent 1f55ac8 commit 0cca967
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions urdfModifiers/core/modification.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from dataclasses import dataclass

@dataclass
class ModificationType:
"""Standard class to describe a specific type of modification"""
value = None
absolute = False

Expand All @@ -20,6 +22,7 @@ def __init__(self):

@classmethod
def from_config_section(cls, config_section):
"""Constructs a modification from a section of a configparser.ConfigParser class"""
new_modification = cls()

dimension_scale = config_section.get('dimension_scale', None)
Expand Down Expand Up @@ -52,15 +55,19 @@ def from_config_section(cls, config_section):
return new_modification

def add_density(self, value, absolute):
"""Adds a modification of the density"""
self.density = ModificationType(value, absolute)

def add_dimension(self, value, absolute):
"""Adds a modification of the main dimension"""
self.dimension = ModificationType(value, absolute)

def add_mass(self, value, absolute):
"""Adds a modification of the mass"""
self.mass = ModificationType(value, absolute)

def add_radius(self, value, absolute):
"""Adds a modification of the radius"""
self.radius = ModificationType(value, absolute)

def __str__(self):
Expand Down

0 comments on commit 0cca967

Please sign in to comment.