Skip to content

Commit 9233077

Browse files
committed
feat: late night fixes
1 parent 4910fb1 commit 9233077

File tree

4 files changed

+31
-53
lines changed

4 files changed

+31
-53
lines changed

common/navigation/lasr_person_following/nodes/person_following.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def _update_params(self):
8585
self._dynamic_recovery(config)
8686

8787
config = Config()
88-
config.bools.append(BoolParameter(name="enabled"), value=1)
89-
config.doubles.append(DoubleParameter(name="inflation_radius"), value=0.2)
88+
config.bools.append(BoolParameter(name="enabled", value=1))
89+
config.doubles.append(DoubleParameter(name="inflation_radius", value=0.2))
9090

9191
self._dynamic_local_costmap(config)
9292

common/navigation/lasr_person_following/src/lasr_person_following/person_following.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,15 @@ def _cancel_goal(self) -> None:
342342

343343
def _check_finished(self) -> bool:
344344
if self._tts_client_available:
345-
self._tts("Have we arrived?", wait=True)
345+
self._tts("Have we arrived? Please say Yes We Have Arrived", wait=True)
346346

347347
if self._transcribe_speech_client_available:
348348
self._transcribe_speech_client.send_goal_and_wait(
349349
TranscribeSpeechGoal()
350350
)
351351
transcription = self._transcribe_speech_client.get_result().sequence
352352

353-
return "yes" in transcription.lower()
353+
return "yes" in transcription.lower() or "arrived" in transcription.lower() or "arrive" in transcription.lower()
354354
return True
355355

356356
def _get_pose_on_path(
@@ -416,11 +416,6 @@ def follow(self) -> FollowResult:
416416

417417
while not rospy.is_shutdown():
418418

419-
if self._should_stop:
420-
rospy.loginfo("Received stop signal")
421-
self._tts("I am stopping now", wait=True)
422-
break
423-
424419
tracks: PersonArray = rospy.wait_for_message("/people_tracked", PersonArray)
425420

426421
# Get the most recent track of the person we are following

skills/src/lasr_skills/receive_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def __init__(self, object_name: Union[str, None] = None, vertical: bool = True):
147147
smach.StateMachine.add(
148148
"SAY_PLACE",
149149
Say(
150-
text=f"Please place the {object_name} in my end-effector. I will wait for a few seconds.",
150+
text=f"Please place the {object_name} in my hand. I will wait for a few seconds.",
151151
),
152152
transitions={
153153
"succeeded": "WAIT_5",
@@ -159,7 +159,7 @@ def __init__(self, object_name: Union[str, None] = None, vertical: bool = True):
159159
smach.StateMachine.add(
160160
"SAY_PLACE",
161161
Say(
162-
format_str="Please place the {} in my end-effector. I will wait for a few seconds.",
162+
format_str="Please place the {} in my hand. I will wait for a few seconds.",
163163
),
164164
transitions={
165165
"succeeded": "WAIT_5",

tasks/carry_my_luggage/src/carry_my_luggage/state_machine.py

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -177,66 +177,53 @@ def wait_cb(ud, msg):
177177
},
178178
)
179179

180+
# TODO: ensure it doesnt get stuck here, maybe concurrenr
180181
smach.StateMachine.add(
181182
"CLEAR_COSTMAPS",
182183
smach_ros.ServiceState(
183184
"/move_base/clear_costmaps",
184185
EmptySrv,
185186
),
186187
transitions={
187-
"succeeded": "START_MAPPING",
188-
"aborted": "START_MAPPING",
189-
"preempted": "START_MAPPING",
188+
"succeeded": "GET_START_POSE",
189+
"aborted": "GET_START_POSE",
190+
"preempted": "GET_START_POSE",
190191
},
191192
)
192193

194+
def start_pose_cb(ud):
195+
try:
196+
ud.start_pose = rospy.wait_for_message("/robot_pose", PoseWithCovarianceStamped, timeout=rospy.Duration(5.0)).pose.pose
197+
except rospy.ROSException:
198+
rospy.logerr("Failed to get robot pose")
199+
ud.start_pose = Pose(position=Point(0., 0., 0.0), orientation=Quaternion(0., 0., 0., 1.))
200+
return "succeeded"
193201
smach.StateMachine.add(
194-
"START_MAPPING",
195-
smach_ros.ServiceState(
196-
"/pal_navigation_sm",
197-
Acknowledgment,
198-
request=AcknowledgmentRequest("MAP"),
202+
"GET_START_LOCATION",
203+
smach.CBState(
204+
start_pose_cb,
205+
outcomes=["succeeded"],
206+
output_keys=["start_pose"],
199207
),
200-
transitions={
201-
"succeeded": "SAY_FOLLOW",
202-
"aborted": "SAY_FOLLOW",
203-
"preempted": "SAY_FOLLOW",
204-
},
208+
transitions={"succeeded": "SAY_STEP"}
205209
)
206210

207-
smach.StateMachine.add(
208-
"SAY_FOLLOW",
209-
Say(text="I will follow you now."),
210-
transitions={
211-
"succeeded": "SAY_STEP",
212-
# "succeeded": "INITIALISE_PERSON_TRACK",
213-
"aborted": "failed",
214-
"preempted": "failed",
215-
},
216-
)
217211
smach.StateMachine.add(
218212
"SAY_STEP",
219213
Say(text="First walk slowly towards me and then I will follow you."),
220214
transitions={
221-
"succeeded": "FOLLOW",
215+
"succeeded": "SAY_FOLLOW",
222216
"aborted": "failed",
223217
"preempted": "failed",
224218
},
225219
)
226220
smach.StateMachine.add(
227-
"INITIALISE_PERSON_TRACK",
228-
smach_ros.ServiceState(
229-
"/cml/initialise_person_with_vision",
230-
InitialisePersonWithVision,
231-
request_cb=lambda ud, req: InitialisePersonWithVisionRequest(
232-
point=ud.person_point,
233-
),
234-
input_keys=["person_point"],
235-
),
221+
"SAY_FOLLOW",
222+
Say(text="I will follow you now."),
236223
transitions={
237224
"succeeded": "FOLLOW",
238-
"aborted": "FOLLOW",
239-
"preempted": "FOLLOW",
225+
"aborted": "failed",
226+
"preempted": "failed",
240227
},
241228
)
242229

@@ -283,12 +270,8 @@ def wait_cb(ud, msg):
283270
)
284271

285272
smach.StateMachine.add(
286-
"GO_TO_START",
287-
GoToLocation(
288-
location=Pose(
289-
position=Point(0.0, 0.0, 0.0),
290-
orientation=Quaternion(0.0, 0.0, 0.0, 1.0),
291-
)
292-
),
273+
"GO_TO_START", # todo: instead, get the start position within the state machine, and return to it at the end
274+
GoToLocation(),
275+
remapping={"location" : "start_pose"},
293276
transitions={"succeeded": "succeeded", "failed": "succeeded"},
294277
)

0 commit comments

Comments
 (0)