Skip to content

Commit

Permalink
[refactor] moved local_transformer and costmaps to top-level
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigul committed Apr 9, 2024
1 parent 2c47f2c commit e414c19
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 66 deletions.
14 changes: 7 additions & 7 deletions src/pycram/world_concepts/costmaps.py → src/pycram/costmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from matplotlib import colors
from nav_msgs.msg import OccupancyGrid, MapMetaData

from ..world import UseProspectionWorld
from ..world_concepts.world_object import Object
from ..description import Link
from ..datastructures.local_transformer import LocalTransformer
from ..datastructures.pose import Pose, Transform
from ..world import World
from ..datastructures.dataclasses import AxisAlignedBoundingBox, BoxVisualShape, Color
from .world import UseProspectionWorld
from .world_concepts.world_object import Object
from .description import Link
from .local_transformer import LocalTransformer
from .datastructures.pose import Pose, Transform
from .world import World
from .datastructures.dataclasses import AxisAlignedBoundingBox, BoxVisualShape, Color


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion src/pycram/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing_extensions import Tuple, Union, Any, List, Optional, Dict, TYPE_CHECKING

from .datastructures.enums import JointType
from .datastructures.local_transformer import LocalTransformer
from .local_transformer import LocalTransformer
from .datastructures.pose import Pose, Transform
from .world import WorldEntity
from .datastructures.dataclasses import JointState, AxisAlignedBoundingBox, Color, LinkState, VisualShape
Expand Down
9 changes: 4 additions & 5 deletions src/pycram/designator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@

from .world import World
from .world_concepts.world_object import Object as WorldObject
from .datastructures.enums import ObjectType
from .helper import GeneratorList, bcolors
from threading import Lock
from time import time
from typing_extensions import List, Dict, Any, Optional, Union, get_type_hints, Callable, Iterable
from typing_extensions import List, Dict, Any, Optional, Union, Callable, Iterable

from pycram.datastructures.local_transformer import LocalTransformer
from .local_transformer import LocalTransformer
from .language import Language
from pycram.datastructures.pose import Pose
from .datastructures.pose import Pose
from .robot_descriptions import robot_description
from pycram.datastructures.enums import ObjectType
from .datastructures.enums import ObjectType

import logging

Expand Down
11 changes: 5 additions & 6 deletions src/pycram/designators/actions/actions.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import abc
import inspect
import time

import numpy as np
from tf import transformations
from typing_extensions import Union, Type
from pycram.designator import ActionDesignatorDescription
from pycram.designators.motion_designator import *
from ...designator import ActionDesignatorDescription
from ..motion_designator import *
from ...datastructures.pose import Pose
from ...datastructures.enums import Arms, Grasp
from pycram.task import with_tree
from ...task import with_tree
from dataclasses import dataclass, field
from ..location_designator import CostmapLocation
from ..object_designator import BelieveObject
# from ...bullet_world import BulletWorld
from ...helper import multiply_quaternions
from ...datastructures.local_transformer import LocalTransformer
from ...local_transformer import LocalTransformer
from ...orm.base import Pose as ORMPose
from ...orm.object_designator import Object as ORMObject, ObjectPart as ORMObjectPart
from ...orm.object_designator import Object as ORMObject
from ...orm.action_designator import Action as ORMAction
from ...plan_failures import ObjectUnfetchable, ReachabilityFailure
from ...robot_descriptions import robot_description
Expand Down
10 changes: 5 additions & 5 deletions src/pycram/designators/location_designator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
from typing_extensions import List, Union, Iterable, Optional, Callable

from .object_designator import ObjectDesignatorDescription, ObjectPart
from pycram.world import World, UseProspectionWorld
from pycram.world_reasoning import link_pose_for_joint_config
from ..world import World, UseProspectionWorld
from ..world_reasoning import link_pose_for_joint_config
from ..designator import DesignatorError, LocationDesignatorDescription
from pycram.world_concepts.costmaps import OccupancyCostmap, VisibilityCostmap, SemanticCostmap, GaussianCostmap
from ..costmaps import OccupancyCostmap, VisibilityCostmap, SemanticCostmap, GaussianCostmap
from ..robot_descriptions import robot_description
from pycram.datastructures.enums import JointType
from ..datastructures.enums import JointType
from ..helper import transform
from ..pose_generator_and_validator import PoseGenerator, visibility_validator, reachability_validator
from ..robot_description import ManipulatorDescription
from pycram.datastructures.pose import Pose
from ..datastructures.pose import Pose


class Location(LocationDesignatorDescription):
Expand Down
2 changes: 1 addition & 1 deletion src/pycram/external_interfaces/ik.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from pycram.world_concepts.world_object import Object
from ..helper import calculate_wrist_tool_offset, _apply_ik
from pycram.datastructures.local_transformer import LocalTransformer
from pycram.local_transformer import LocalTransformer
from pycram.datastructures.pose import Pose
from ..robot_descriptions import robot_description
from ..plan_failures import IKError
Expand Down
2 changes: 1 addition & 1 deletion src/pycram/external_interfaces/robokudo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from ..designator import ObjectDesignatorDescription
from pycram.datastructures.pose import Pose
from pycram.datastructures.local_transformer import LocalTransformer
from pycram.local_transformer import LocalTransformer
from pycram.world import World
from pycram.datastructures.enums import ObjectType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rospy import Duration

from geometry_msgs.msg import TransformStamped
from .pose import Pose, Transform
from .datastructures.pose import Pose, Transform
from typing_extensions import List, Optional, Union, Iterable


Expand Down
4 changes: 2 additions & 2 deletions src/pycram/pose_generator_and_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from .world import World
from .world_concepts.world_object import Object
from .world_reasoning import contact
from .world_concepts.costmaps import Costmap
from .datastructures.local_transformer import LocalTransformer
from .costmaps import Costmap
from .local_transformer import LocalTransformer
from .datastructures.pose import Pose, Transform
from .robot_description import ManipulatorDescription
from .robot_descriptions import robot_description
Expand Down
3 changes: 1 addition & 2 deletions src/pycram/process_modules/boxy_process_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from ..designators.motion_designator import *
from ..datastructures.enums import JointType
from ..external_interfaces.ik import request_ik
from ..datastructures.local_transformer import LocalTransformer

from ..world import World
from ..datastructures.local_transformer import LocalTransformer
from ..local_transformer import LocalTransformer
from ..process_module import ProcessModule, ProcessModuleManager
from ..robot_descriptions import robot_description

Expand Down
9 changes: 2 additions & 7 deletions src/pycram/process_modules/default_process_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
from ..datastructures.enums import JointType
from ..external_interfaces.ik import request_ik
from ..helper import _apply_ik
from ..process_module import ProcessModule, ProcessModuleManager
# from ..process_modules.pr2_process_modules import Pr2Navigation as DefaultNavigation, Pr2PickUp as DefaultPickUp, \
# Pr2Place as DefaultPlace, Pr2WorldStateDetecting as DefaultWorldStateDetecting, Pr2Open as DefaultOpen, \
# Pr2Close as DefaultClose, Pr2MoveGripper as DefaultMoveGripper, Pr2Detecting as DefaultDetecting, \
# Pr2MoveTCP as DefaultMoveTCP
from ..process_module import ProcessModule
from ..robot_descriptions import robot_description
from ..world import World
from ..datastructures.local_transformer import LocalTransformer
from ..local_transformer import LocalTransformer
from ..designators.motion_designator import *
from ..world_reasoning import visible, link_pose_for_joint_config

Expand Down
3 changes: 1 addition & 2 deletions src/pycram/process_modules/donbot_process_modules.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from threading import Lock

import numpy as np
from typing_extensions import Optional

from ..worlds.bullet_world import World
from ..designators.motion_designator import MoveArmJointsMotion, WorldStateDetectingMotion
from ..datastructures.local_transformer import LocalTransformer
from ..local_transformer import LocalTransformer
from ..process_module import ProcessModule, ProcessModuleManager
from ..robot_descriptions import robot_description
from ..process_modules.pr2_process_modules import Pr2Detecting as DonbotDetecting, _move_arm_tcp
Expand Down
11 changes: 3 additions & 8 deletions src/pycram/process_modules/hsr_process_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
from threading import Lock
from typing import Any

from typing_extensions import Optional

from ..datastructures.enums import JointType
from ..robot_descriptions import robot_description
from ..process_module import ProcessModule, ProcessModuleManager
from ..world import World
from ..datastructures.pose import Pose, Point
from ..process_module import ProcessModule
from ..datastructures.pose import Point
from ..helper import _apply_ik
from ..external_interfaces.ik import request_ik
from .. import world_reasoning as btr
import logging
import time
from ..datastructures.local_transformer import LocalTransformer
from ..local_transformer import LocalTransformer
from ..designators.motion_designator import *
from ..external_interfaces import giskard

Expand Down
13 changes: 6 additions & 7 deletions src/pycram/process_modules/pr2_process_modules.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from threading import Lock
from typing_extensions import Any, Optional, Tuple
from abc import abstractmethod
from typing_extensions import Any

import actionlib

Expand All @@ -12,16 +11,16 @@
from ..process_module import ProcessModule, ProcessModuleManager
from ..external_interfaces.ik import request_ik
from ..helper import _apply_ik
from pycram.datastructures.local_transformer import LocalTransformer
from ..local_transformer import LocalTransformer
from ..designators.object_designator import ObjectDesignatorDescription
from ..designators.motion_designator import MoveMotion, LookingMotion, \
DetectingMotion, MoveTCPMotion, MoveArmJointsMotion, WorldStateDetectingMotion, MoveJointsMotion, \
MoveGripperMotion, OpeningMotion, ClosingMotion
from ..robot_descriptions import robot_description
from pycram.world import World
from pycram.world_concepts.world_object import Object
from pycram.datastructures.pose import Pose
from pycram.datastructures.enums import JointType, ObjectType
from ..world import World
from ..world_concepts.world_object import Object
from ..datastructures.pose import Pose
from ..datastructures.enums import JointType, ObjectType
from ..external_interfaces import giskard
from ..external_interfaces.robokudo import query

Expand Down
3 changes: 1 addition & 2 deletions src/pycram/resolver/location/database_location.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from dataclasses import dataclass

import numpy as np
import sqlalchemy.orm
import sqlalchemy.sql
from sqlalchemy import select, Select
from typing_extensions import List

from ...world_concepts.costmaps import Rectangle, OccupancyCostmap
from ...costmaps import Rectangle, OccupancyCostmap
from ...designator import LocationDesignatorDescription
from ...designators.location_designator import CostmapLocation
from ...orm.action_designator import PickUpAction
Expand Down
7 changes: 3 additions & 4 deletions src/pycram/resolver/probabilistic/probabilistic_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
import portion
from probabilistic_model.probabilistic_circuit.distributions import GaussianDistribution, SymbolicDistribution
from probabilistic_model.probabilistic_circuit.probabilistic_circuit import ProbabilisticCircuit, \
DecomposableProductUnit, DeterministicSumUnit
DecomposableProductUnit
from random_events.events import Event, ComplexEvent
from random_events.variables import Symbolic, Continuous
import tqdm
from typing_extensions import Optional, List, Iterator
from ...world import World
from ...world_concepts.costmaps import OccupancyCostmap, VisibilityCostmap
from ...costmaps import OccupancyCostmap, VisibilityCostmap
from ...designator import ActionDesignatorDescription, ObjectDesignatorDescription
from ...designators.actions.actions import MoveAndPickUpPerformable, ActionAbstract
from ...datastructures.enums import Arms, Grasp, TaskStatus
from ...datastructures.local_transformer import LocalTransformer
from ...local_transformer import LocalTransformer
from ...orm.queries.queries import PickUpWithContext
from ...orm.task import TaskTreeNode
from ...orm.action_designator import PickUpAction as ORMPickUpAction
from ...plan_failures import ObjectUnreachable, PlanFailure
from ...datastructures.pose import Pose
import plotly.graph_objects as go


class ProbabilisticAction:
Expand Down
2 changes: 1 addition & 1 deletion src/pycram/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .cache_manager import CacheManager
from .datastructures.enums import JointType, ObjectType, WorldMode
from .world_concepts.event import Event
from .datastructures.local_transformer import LocalTransformer
from .local_transformer import LocalTransformer
from .datastructures.pose import Pose, Transform
from .world_concepts.constraints import Constraint
from .datastructures.dataclasses import (Color, AxisAlignedBoundingBox, CollisionCallbacks,
Expand Down
2 changes: 1 addition & 1 deletion src/pycram/world_concepts/world_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ..datastructures.dataclasses import (Color, ObjectState, LinkState, JointState,
AxisAlignedBoundingBox, VisualShape)
from ..datastructures.enums import ObjectType, JointType
from ..datastructures.local_transformer import LocalTransformer
from ..local_transformer import LocalTransformer
from ..datastructures.pose import Pose, Transform

Link = ObjectDescription.Link
Expand Down
2 changes: 1 addition & 1 deletion test/test_action_designator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pycram.designators import action_designator, object_designator
from pycram.designators.actions.actions import MoveTorsoActionPerformable, PickUpActionPerformable, \
NavigateActionPerformable, FaceAtPerformable
from pycram.datastructures.local_transformer import LocalTransformer
from pycram.local_transformer import LocalTransformer
from pycram.robot_descriptions import robot_description
from pycram.process_module import simulated_robot
from pycram.datastructures.pose import Pose
Expand Down
2 changes: 1 addition & 1 deletion test/test_costmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from random_events.events import Event, ComplexEvent

from bullet_world_testcase import BulletWorldTestCase
from pycram.world_concepts.costmaps import OccupancyCostmap
from pycram.costmaps import OccupancyCostmap
from pycram.datastructures.pose import Pose


Expand Down
2 changes: 1 addition & 1 deletion test/test_local_transformer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import rospy


from pycram.datastructures.local_transformer import LocalTransformer
from pycram.local_transformer import LocalTransformer
from pycram.datastructures.pose import Pose, Transform
from bullet_world_testcase import BulletWorldTestCase

Expand Down

0 comments on commit e414c19

Please sign in to comment.