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

Added fitting floor for apartment #252

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions resources/objects/plane_colored.urdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="0.0" ?>
<robot name="plane">
<link name="planeLink">
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value=".0"/>
<inertia ixx="0" ixy="0" ixz="0" iyy="0" iyz="0" izz="0"/>
</inertial>
<visual>
<origin rpy="0 0 0" xyz="9.4 2.5 0"/>
<geometry>
<mesh filename="plane.obj" scale="0.64 0.17 0.4"/>
</geometry>
<material name="white">
<color rgba="0.89 0.72 0.56 1"/>
</material>
</visual>
<collision>
<origin rpy="0 0 0" xyz="9.4 2.5 0"/>
<geometry>
<mesh filename="plane.obj" scale="0.64 0.17 0.4"/>
</geometry>
</collision>
</link>
</robot>

9 changes: 7 additions & 2 deletions src/pycram/ros_utils/viz_marker_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@
from std_msgs.msg import ColorRGBA
from visualization_msgs.msg import Marker, MarkerArray

from ..datastructures.dataclasses import BoxVisualShape, CylinderVisualShape, MeshVisualShape, SphereVisualShape
from pycrap import Floor
from ..datastructures.dataclasses import BoxVisualShape, CylinderVisualShape, MeshVisualShape, SphereVisualShape, Color
from ..datastructures.pose import Pose, Transform
from ..datastructures.world import World
from ..designator import ObjectDesignatorDescription
from ..ros.data_types import Duration, Time
from ..ros.logging import loginfo, logwarn, logerr
from ..ros.publisher import create_publisher
from ..ros.ros_tools import sleep
from ..world_concepts.world_object import Object


class VizMarkerPublisher:
"""
Publishes an Array of visualization marker which represent the situation in the World
"""

def __init__(self, topic_name="/pycram/viz_marker", interval=0.1):
def __init__(self, topic_name="/pycram/viz_marker", interval=0.1, spawn_floor = True):
"""
The Publisher creates an Array of Visualization marker with a Marker for each link of each Object in the
World. This Array is published with a rate of interval.
Expand All @@ -34,6 +36,9 @@ def __init__(self, topic_name="/pycram/viz_marker", interval=0.1):
self.topic_name = topic_name
self.interval = interval

if spawn_floor:
_ = Object("plane_colored", Floor, f"plane_colored.urdf")

self.pub = create_publisher(self.topic_name, MarkerArray, queue_size=10)

self.thread = threading.Thread(target=self._publish)
Expand Down