Skip to content

Commit

Permalink
refactor: apply black formatting, again
Browse files Browse the repository at this point in the history
  • Loading branch information
jws-1 committed Apr 25, 2024
1 parent d1662f1 commit 1140a2f
Show file tree
Hide file tree
Showing 48 changed files with 24 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


def make_plan(current_pose, x, y, tol=0.01, max_dist=None):

if "/move_base/NavfnROS/make_plan" in rosservice.get_service_list():
make_plan_service = "/move_base/NavfnROS/make_plan"
elif "/move_base/GlobalPlanner/make_plan" in rosservice.get_service_list():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class LookAt:

def __init__(
self,
head_controller: HeadController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def detect_face(cv_im: Mat) -> Mat | None:


def create_image_collage(images, output_size=(640, 480)):

# Calculate grid dimensions
num_images = len(images)
rows = int(np.sqrt(num_images))
Expand Down
24 changes: 12 additions & 12 deletions documentation/src/document_lasr/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,18 @@ def split_depend(input: str) -> (str, str):
data["dependencies"] = DEPENDENCIES

# Load additional markdown files
data["prerequisites"] = (
"Ask the package maintainer to write or create a blank `doc/PREREQUISITES.md` for their package!"
)
data["usage"] = (
"Ask the package maintainer to write a `doc/USAGE.md` for their package!"
)
data["example"] = (
"Ask the package maintainer to write a `doc/EXAMPLE.md` for their package!"
)
data["technical"] = (
"Ask the package maintainer to write a `doc/TECHNICAL.md` for their package!"
)
data[
"prerequisites"
] = "Ask the package maintainer to write or create a blank `doc/PREREQUISITES.md` for their package!"
data[
"usage"
] = "Ask the package maintainer to write a `doc/USAGE.md` for their package!"
data[
"example"
] = "Ask the package maintainer to write a `doc/EXAMPLE.md` for their package!"
data[
"technical"
] = "Ask the package maintainer to write a `doc/TECHNICAL.md` for their package!"

for key, file in [
("prerequisites", "PREREQUISITES"),
Expand Down
4 changes: 0 additions & 4 deletions legacy/aruco_service/scripts/GenerateTableCuboid.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ def generate_cuboid(msg):
)

if latest_pose is not None and (seconds - latest_pose.header.stamp.secs < 1.0):

tr = get_transform_to_marker("aruco_marker_frame", "map")

if is_rect:

# THESE POINTS ARE IN MARKER COORDINATE FRAME [LOCATION OF ARUCO MARKER IS (0,0) IN THIS FRAME]
local_corner_1 = [0, 0]
local_corner_2 = [long_side, 0]
Expand All @@ -101,7 +99,6 @@ def generate_cuboid(msg):
objects_marker_pub.publish(create_marker_msg(corner_4, 3))

if table >= 0:

local_padded_corner_1 = [
local_corner_1[0] - padding,
local_corner_1[1] - padding,
Expand Down Expand Up @@ -258,7 +255,6 @@ def get_latest_pose(msg):


if __name__ == "__main__":

rospy.init_node("generate_table_cuboid")
sub = rospy.Subscriber("/aruco_single/pose", PoseStamped, get_latest_pose)
s = rospy.Service("generate_table_cuboid", GenerateTableCuboid, generate_cuboid)
Expand Down
5 changes: 0 additions & 5 deletions legacy/aruco_service/scripts/publish_points_of_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,17 @@ def publish_points(number):
persons_marker_pub = rospy.Publisher("/table/persons_cuboid", Marker, queue_size=8)

if table >= 0:

obj = rospy.get_param("/tables/table" + str(table) + "/objects_cuboid")

for i, p in enumerate(obj):

objects_marker_pub.publish(create_marker_msg(p, i))

per = rospy.get_param("/tables/table" + str(table) + "/persons_cuboid")

for i, p in enumerate(per):

persons_marker_pub.publish(create_marker_msg(p, i))

elif table == -1:

cuboid = rospy.get_param("/counter/cuboid")

objects_marker_pub.publish(create_marker_msg(cuboid[0], 0))
Expand All @@ -66,7 +62,6 @@ def publish_points(number):


if __name__ == "__main__":

rospy.init_node("point_publisher")
s = rospy.Service("publish_table_points", PublishTablePoints, publish_points)

Expand Down
1 change: 0 additions & 1 deletion legacy/aruco_service/scripts/save_navigation_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def get_latest_pose(msg):


if __name__ == "__main__":

rospy.init_node("save_navigation_points")
sub = rospy.Subscriber("/amcl_pose", PoseWithCovarianceStamped, get_latest_pose)
rospy.Service("save_navigation_points", SaveNavigationPoint, save_navigation_points)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def visualize(


def get_model(num_keypoints, weights_path=None):

anchor_generator = AnchorGenerator(
sizes=(32, 64, 128, 256, 512),
aspect_ratios=(0.25, 0.5, 0.75, 1.0, 2.0, 3.0, 4.0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ def __len__(self):


def get_model(num_keypoints, weights_path=None):

anchor_generator = AnchorGenerator(
sizes=(32, 64, 128, 256, 512),
aspect_ratios=(0.25, 0.5, 0.75, 1.0, 2.0, 3.0, 4.0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
voice = Voice()

for p1, p2 in zip(plan.points[0::2], plan.points[1::2]):

result = False
tries = 0
while not result:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Room:

def __init__(self, name, corners):
self.name = name
self.corners = corners
Expand All @@ -22,9 +21,7 @@ def __str__(self):


class Graph:

def __init__(self):

self.size = 0
self.adjLists = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class GraphNavigationServer:

def __init__(self, path=""):
self.graph = Graph()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def get_black_pxl(pixels, threshold=60):
return np.where(pixels <= threshold)

def has_enough_free_space(self, window):

num_labels, labels, stats, _ = cv2.connectedComponentsWithStats(
window, connectivity=4, ltype=cv2.CV_32S
)
Expand Down Expand Up @@ -878,7 +877,6 @@ def min_dist_contours(self, filtered_contours, window=None):
return Pcenter

def find_multiple_cnp(self, window, threshold=60):

window = np.where(window <= threshold, 0, 255).astype(np.uint8)
# plt.imshow(window, cmap='gray')
# plt.title('dilation in find multiple cnp')
Expand Down
6 changes: 3 additions & 3 deletions legacy/read_pcl_info/src/read_pcl_info/pcl_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def filter_laser_scan(laser_scan):
len(laser_scan.ranges) // 3 : 2 * len(laser_scan.ranges) // 3
]
filtered_ranges = [np.nan] * len(laser_scan.ranges)
filtered_ranges[len(laser_scan.ranges) // 3 : 2 * len(laser_scan.ranges) // 3] = (
middle_part
)
filtered_ranges[
len(laser_scan.ranges) // 3 : 2 * len(laser_scan.ranges) // 3
] = middle_part
mean_distance = np.nanmean(filtered_ranges)

return mean_distance, filtered_ranges
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/ask_and_listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def __init__(
tts_phrase: Union[str, None] = None,
tts_phrase_format_str: Union[str, None] = None,
):

if tts_phrase is not None:
smach.StateMachine.__init__(
self,
Expand Down
2 changes: 0 additions & 2 deletions skills/src/lasr_skills/clip_vqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@


class QueryImage(smach_ros.ServiceState):

def __init__(self, possible_answers: Union[None, List[str]] = None):

if possible_answers is not None:
super(QueryImage, self).__init__(
"/clip_vqa/query_service",
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/describe_people.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class DescribePeople(smach.StateMachine):

def __init__(self):
smach.StateMachine.__init__(
self,
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class Detect(smach.State):

def __init__(
self,
image_topic: str = "/xtion/rgb/image_raw",
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/detect_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Detect3D(smach.State):

def __init__(
self,
depth_topic: str = "/xtion/depth_registered/points",
Expand Down
3 changes: 0 additions & 3 deletions skills/src/lasr_skills/detect_3d_in_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@


class Detect3DInArea(smach.StateMachine):

class FilterDetections(smach.State):

def __init__(self, area_polygon: Polygon):
smach.State.__init__(
self,
Expand Down Expand Up @@ -53,7 +51,6 @@ def __init__(
)

with self:

smach.StateMachine.add(
"DETECT_OBJECTS_3D",
Detect3D(
Expand Down
4 changes: 0 additions & 4 deletions skills/src/lasr_skills/find_named_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class FindNamedPerson(smach.StateMachine):

class GetLocation(smach.State):
def __init__(self):
smach.State.__init__(
Expand Down Expand Up @@ -115,7 +114,6 @@ def __init__(
waypoints_to_iterate: List[Pose] = waypoints

with self:

smach.StateMachine.add(
"GET_POSE",
self.GetPose(),
Expand All @@ -138,15 +136,13 @@ def __init__(
)

with waypoint_iterator:

container_sm = smach.StateMachine(
outcomes=["succeeded", "failed", "continue"],
input_keys=["location_index", "waypoints"],
output_keys=["person_point"],
)

with container_sm:

smach.StateMachine.add(
"GET_LOCATION",
self.GetLocation(),
Expand Down
4 changes: 0 additions & 4 deletions skills/src/lasr_skills/find_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class FindPerson(smach.StateMachine):

class GetLocation(smach.State):
def __init__(self):
smach.State.__init__(
Expand Down Expand Up @@ -76,7 +75,6 @@ def __init__(self, waypoints: List[Pose]):
)

with self:

smach.StateMachine.add(
"GET_POSE",
self.GetPose(),
Expand All @@ -99,15 +97,13 @@ def __init__(self, waypoints: List[Pose]):
)

with waypoint_iterator:

container_sm = smach.StateMachine(
outcomes=["succeeded", "failed", "continue"],
input_keys=["location_index", "waypoints"],
output_keys=["person_point"],
)

with container_sm:

smach.StateMachine.add(
"GET_LOCATION",
self.GetLocation(),
Expand Down
4 changes: 0 additions & 4 deletions skills/src/lasr_skills/go_to_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@


class GoToLocation(smach.StateMachine):

def __init__(
self,
location: Union[Pose, None] = None,
location_param: Union[str, None] = None,
):

if location is not None or location_param is not None:
super(GoToLocation, self).__init__(outcomes=["succeeded", "failed"])
else:
Expand All @@ -56,7 +54,6 @@ def __init__(
)

if not IS_SIMULATION:

if PUBLIC_CONTAINER:
rospy.logwarn(
"You are using a public container. The head manager will not be stopped during navigation."
Expand Down Expand Up @@ -155,7 +152,6 @@ def __init__(
)

if not IS_SIMULATION:

if PUBLIC_CONTAINER:
rospy.logwarn(
"You are using a public container. The head manager will not be start following navigation."
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/handover_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class HandoverObject(smach.StateMachine):

def __init__(self):
smach.StateMachine.__init__(
self, outcomes=["succeeded", "failed"], input_keys=["object_name"]
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/listen_for.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class ListenFor(smach_ros.SimpleActionState):
def __init__(self, wake_word: str):

def speech_result_cb(userdata, status, result):
if status == GoalStatus.SUCCEEDED:
if wake_word in result.sequence.lower():
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/play_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class PlayMotion(smach_ros.SimpleActionState):

def _needs_planning(self, motion_name: str) -> bool:
joints: List[str] = rospy.get_param(
f"/play_motion/motions/{motion_name}/joints"
Expand Down
1 change: 0 additions & 1 deletion skills/src/lasr_skills/receive_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class ReceiveObject(smach.StateMachine):

def __init__(self):
smach.StateMachine.__init__(
self, outcomes=["succeeded", "failed"], input_keys=["object_name"]
Expand Down
Loading

0 comments on commit 1140a2f

Please sign in to comment.