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

Draft: v2.1.0 #364

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b562322
Update defaults.json
hwiedPro Oct 26, 2023
ea4b644
Fix #339
hwied Oct 26, 2023
c9f5bec
Fix #331
hwied Oct 26, 2023
ccae427
Merge branch 'master' into develop
hwiedPro Feb 13, 2024
f93c1ad
Fix install_requirements.py
hwiedPro Feb 13, 2024
1e7a797
Add frame handling
hwiedPro Feb 13, 2024
1a7a6bb
Fix to_hey_color()
hwiedPro Feb 13, 2024
a62fe45
Catch git_error when getting maintainer, author, url
hwiedPro Feb 13, 2024
078fe49
Get log level from env
hwiedPro Feb 13, 2024
53209f9
Add -m option to run pipeline for specific definition file
hwiedPro Feb 13, 2024
872eb0e
Add possibility to define default_export_config in pipeline.yml
hwiedPro Feb 13, 2024
9db3b92
Add verbose option to execute_shell_command
hwiedPro Feb 13, 2024
b3b1ed1
Make to_pretty_xml_string more robust
hwiedPro Feb 13, 2024
3a9e85f
Adapt append_string to logger usage
hwiedPro Feb 13, 2024
701fb4a
Fix setup_git script
hwiedPro Feb 13, 2024
6492934
Fix Git-LFS Readme integration
hwiedPro Feb 13, 2024
866d796
Fix several path/file handling issues
hwiedPro Feb 13, 2024
b8ea40f
Fix model_testing
hwiedPro Feb 13, 2024
fac9da6
Ensure nothing is changed on export()
hwiedPro Feb 13, 2024
0d94abd
Refactored version of Mathias commit: https://github.com/dfki-ric/pho…
hwiedPro Feb 13, 2024
94bdfa9
Merge remote-tracking branch 'origin/master' into develop
Jun 13, 2024
dd48b5d
[BREAKING CHANGES] Squashed refactoring of python module
Jun 13, 2024
bb154d9
Merge remote-tracking branch 'origin/master' into pre_v2.1.0
Jun 13, 2024
646ceaf
Fix #363
hwiedPro Jun 14, 2024
271f34c
Bugfix for 646ceaf
hwiedPro Jun 14, 2024
1e4cc8e
Fix execute_shell_command for Windows
hwiedPro Jul 3, 2024
c950925
Fix faulty indentation
hwiedPro Jul 3, 2024
5928c9b
Bump version to 2.1.0
hwiedPro Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

extra_requirements = {
"pybullet": "pybullet", # optional for blender
"open3d": "open3d", # optional for blender
"open3d": "open3d", # optional for blender, used for mesh adaption by trimesh
"python-fcl": "python-fcl", # optional for blender
}

Expand All @@ -41,7 +41,11 @@ def install_requirement(package_name, upgrade_pip=False, lib=None, ensure_pip=Tr
lib = bpy.utils.user_resource("SCRIPTS", path="modules")
if ensure_pip:
# Ensure pip is installed
subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
try:
subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
except subprocess.CalledProcessError:
print("WARNING: We couldn't do ensurepip, we try to continue anyways")
pass
# Update pip (not mandatory)
if upgrade_pip:
print(" Upgrading pip...")
Expand All @@ -60,7 +64,11 @@ def check_requirements(optional=False, extra=False, force=False, upgrade_pip=Fal
return
print("Checking requirements:")
# Ensure pip is installed
subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
try:
subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
except subprocess.CalledProcessError:
print("WARNING: We couldn't do ensurepip, we try to continue anyways")
pass
reqs = [requirements]
if optional:
reqs += [optional_requirements]
Expand Down
2 changes: 1 addition & 1 deletion manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<depend package="pyyaml"/><!-- optional="1"/>-->
<!-- Only used for kccd collision export -->
<depend package="control/kccdtools" optional="1"/>
<!-- Only necessary when using the blender add-on-->
<!-- Only necessary when using the blender add-on or for collision mesh processing-->
<depend package="blender" optional="1"/>
<!-- Only used for certain tests-->
<depend package="control/hyrodyn" optional="1" />
Expand Down
12 changes: 11 additions & 1 deletion phobos/blender/io/phobos2blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ def createGeometry(viscol, geomsrc, linkobj=None):
newgeom = bUtils.createPrimitive(viscol.name, geometry_type, dimensions, phobostype=geomsrc, pmaterial="phobos_collision")
newgeom.select_set(True)
else:
# [TODO] we need to handle here the primitive alternatives that are available when loading from smurf
# They can be returned as second return value to make clear that they are different
# Also they should get another colored material
# When we do this we should add support to edit and create such primitive alternatives
# Also they will currently not be exported.
log(
"Unknown geometry type of "
+ type(geometry)
+ str(type(geometry))
+ viscol.name
+ '. Placing empty coordinate system.',
"ERROR",
Expand Down Expand Up @@ -216,6 +221,11 @@ def createLink(link):
geometries.append((geom, viscol))
for viscol in link.collisions:
geom = createGeometry(viscol, "collision")
if geom is None:
# [TODO] this happens when we load from SMURF if this collision has primitives defined but no mesh
# we need to display those primitive alternatives in Blender, too.
# Yet, we are completely ignoring them
continue
bound_box = (
max(bound_box[0], max([c[0] for c in geom.bound_box])),
max(bound_box[1], max([c[1] for c in geom.bound_box])),
Expand Down
512 changes: 332 additions & 180 deletions phobos/ci/base_model.py

Large diffs are not rendered by default.

357 changes: 202 additions & 155 deletions phobos/ci/model_testing.py

Large diffs are not rendered by default.

332 changes: 194 additions & 138 deletions phobos/ci/pipeline.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion phobos/commandline_logging.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
import sys
import os

SUPPORTED_LEVELS = ["DEBUG", "INFO", "WARNING", "ERROR"]
LOGGER_NAME = "phobos_log"
BASE_LOG_LEVEL = "WARNING"
BASE_LOG_LEVEL = os.getenv("PHOBOS_LOG_LEVEL", "WARNING")
LOG_FILE_CONVENTION = None

#The background is set with 40 plus the number of the color, and the foreground with 30
Expand Down
28 changes: 17 additions & 11 deletions phobos/core/multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from ..io.smurf_reflection import SmurfBase
from ..io.xml_factory import plural as _plural, singular as _singular

from ..commandline_logging import get_logger
log = get_logger(__name__)

__IMPORTS__ = [x for x in dir() if not x.startswith("__")]


Expand Down Expand Up @@ -37,7 +40,7 @@ def __init__(self, name=None, world=None, model=None, file=None, origin=None, fr
for frame in _plural(frames):
self._frames.append(frame)
self.anchor = anchor
self.parent = parent.upper()
self.parent = parent
self.child = child
SmurfBase.__init__(self, name=name, returns=["name", "type", "parent", "position", "rotation", "anchor", "root", "file", "child"], **kwargs)
self.excludes += ["origin", "model"]
Expand Down Expand Up @@ -105,7 +108,7 @@ def position(self):
def position(self, val):
if self.origin is None:
self.origin = representation.Pose()
self.origin.xyz = [val["x"], val["y"], val["z"]]
self.origin.position = val

@property
def rotation(self):
Expand Down Expand Up @@ -169,10 +172,11 @@ def __init__(self, name=None, inputfile=None, entities=None, frames=None, **kwar
Representation.__init__(self)
SmurfBase.__init__(self, returns=["entities"], **kwargs)
self.name = name
self.inputfile = inputfile
self.entities = _plural(entities)
self.inputfile = os.path.abspath(inputfile)
self._frames = _plural(frames)
if self.inputfile is not None:
if self.inputfile is not None:
self.inputfile = os.path.abspath(inputfile)
ext = self.inputfile.lower().rsplit(".", 1)[-1]
if ext == "sdf":
# [Todo v2.1.0]
Expand All @@ -199,6 +203,7 @@ def add_robot(self, name, robot, origin=None, anchor=None):
def add_entity(self, entity):
assert isinstance(entity, Entity)
assert self.get_aggregate("entities", str(entity)) is None, f"There is already an entity with the name {str(entity)}"
log.debug("Adding entity "+ entity.name)
self.entities.append(entity)

def get_aggregate(self, typeName, elem):
Expand Down Expand Up @@ -296,13 +301,13 @@ def assemble(self, root_entity=None):
continue
if entity._anchor == "PARENT":
assert "::" in entity.parent, "Please specify the parent in the way entity::link. Received: "+entity.parent
parent_entity, parent_link = entity.parent.split("::", 1)
parent_entity, parent_link_name = entity.parent.split("::", 1)
else:
assert "::" in entity._anchor, "Please specify the anchor in the way entity::link or use the parent keyword. Received: "+entity._anchor
parent_entity, parent_link = entity._anchor.split("::", 1)
parent_entity, parent_link_name = entity._anchor.split("::", 1)
if parent_entity in [str(e) for e in entities_in_tree]:
parent_link = assembly.get_link(parent_entity+"_"+parent_link)
assert parent_link is not None
parent_link = assembly.get_link(parent_entity+"_"+parent_link_name, verbose=True)
assert parent_link is not None, f"parent link {parent_entity}_{parent_link_name} not found "+str(entity)
if isinstance(root_entity.model, Robot):
attach_model = entity.model.duplicate()
assembly.unlink_from_world()
Expand All @@ -317,13 +322,13 @@ def assemble(self, root_entity=None):
# make sure that we have a consistent downward tree
attach_model.exchange_root(child_link)
attach_model.unlink_from_world()
attach_model.rename_all(prefix=entity.name + "_")
attach_model.rename_all(prefix=entity.name + "_", do_not_double=False)
origin = entity.origin.duplicate()
origin.relative_to = str(entity.origin.relative_to).replace("::", "_", 1)
assembly.attach(
other=attach_model,
joint=representation.Joint(
name=str(parent_entity)+"2"+str(entity),
name=str(parent_entity)+"_2_"+str(entity),
parent=parent_link,
child=child_link,
type="fixed",
Expand All @@ -334,6 +339,7 @@ def assemble(self, root_entity=None):
attached += 1

assembly.link_entities()
assert assembly.verify_meshes()
return assembly

def export_sdf(self, use_includes=True):
Expand Down Expand Up @@ -376,4 +382,4 @@ def expot_smurfs(self, outputfile):
if not os.path.exists(os.path.dirname(outputfile)):
os.makedirs(os.path.dirname(outputfile), exist_ok=True)
with open(outputfile, "w") as f:
f.write(dump_json(out))
f.write(dump_json(out))
Loading