Skip to content

Commit

Permalink
[planning] remove an unnecessary flag called self.if_init_pub_object
Browse files Browse the repository at this point in the history
  • Loading branch information
Li-Jinjie committed Jan 20, 2025
1 parent b912523 commit c387579
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions aerial_robot_planning/scripts/mpc_smach_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
for name, cls in inspect.getmembers(trajs, inspect.isclass)
# optionally ensure the class is defined in trajs and not an imported library
if cls.__module__ == "trajs"
# (Optional) filter by name if you only want classes that end with "Traj"
and name != "BaseTraj"
# (Optional) filter by name if you only want classes that end with "Traj"
and name != "BaseTraj"
]
print(f"Found {len(traj_cls_list)} trajectory classes in trajs module.")

Expand Down Expand Up @@ -356,31 +356,27 @@ def __init__(self) -> None:

self.start_time = rospy.Time.now().to_sec()

self.if_init_pub_object = True

self.pub_object = None

self.rate = rospy.Rate(20)

def execute(self, userdata):

if self.if_init_pub_object:

if self.pub_object is None:
self.pub_object = OneToOnePubJointTraj(
userdata.robot_name,
hand=shared_data["hand"],
arm=shared_data["arm"],
control_mode=shared_data["control_mode"],
)
self.if_init_pub_object = False

while not rospy.is_shutdown():
if self.pub_object.check_finished():
break
self.rate.sleep()

del self.pub_object
self.if_init_pub_object = True
self.pub_object = None

return "done_track"

Expand Down

0 comments on commit c387579

Please sign in to comment.