Skip to content

Commit

Permalink
added conditional Say class using print only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benteng Ma committed Jun 21, 2024
1 parent 5954f51 commit 0268c6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion skills/src/lasr_skills/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .detect_3d import Detect3D
from .detect_3d_in_area import Detect3DInArea
from .wait_for_person import WaitForPerson
from .say import Say
from .say import Say, PrintSay
from .wait_for_person_in_area import WaitForPersonInArea
from .describe_people import DescribePeople
from .look_to_point import LookToPoint
Expand Down
5 changes: 4 additions & 1 deletion skills/src/lasr_skills/describe_people.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import smach
import cv2_img
import numpy as np
from lasr_skills import Say
if "tiago" in os.environ["ROS_MASTER_URI"]:
from lasr_skills import Say
else:
from lasr_skills import PrintSay as Say
from lasr_vision_msgs.srv import (
YoloDetection,
BodyPixMaskDetection,
Expand Down
9 changes: 9 additions & 0 deletions skills/src/lasr_skills/say.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import smach_ros
import rospy

from pal_interaction_msgs.msg import TtsGoal, TtsAction, TtsText

Expand Down Expand Up @@ -43,3 +44,11 @@ def __init__(
),
input_keys=["text"],
)


class PrintSay(object):
def __init__(
self, text: Union[str, None] = None, format_str: Union[str, None] = None
):
if text is not None:
rospy.loginfo(text)

0 comments on commit 0268c6a

Please sign in to comment.