From a215ead89e9935b44238dac788e0de9f7bbaf113 Mon Sep 17 00:00:00 2001 From: jcrm1 <52137472+jcrm1@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:23:18 +0000 Subject: [PATCH 1/6] Import errors: Empty_Response and Empty_Request --- src/rktl_autonomy/test/test_step_node | 4 ++-- src/rktl_game/rktl_game/nodes/game_manager | 8 ++++---- src/rktl_planner/rktl_planner/nodes/path_planner.py | 4 ++-- src/rktl_sim/rktl_sim/nodes/simulator | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/rktl_autonomy/test/test_step_node b/src/rktl_autonomy/test/test_step_node index f8b89359..22711c0c 100755 --- a/src/rktl_autonomy/test/test_step_node +++ b/src/rktl_autonomy/test/test_step_node @@ -12,7 +12,7 @@ import unittest, rostest, rclpy from rclpy.duration import Duration from nav_msgs.msg import Odometry from rktl_msgs.msg import MatchStatus -from std_srvs.srv import Empty, EmptyResponse +from std_srvs.srv import Empty, Empty_Response from rosgraph_msgs.msg import Clock import numpy as np from rktl_autonomy.rocket_league_interface import RocketLeagueInterface @@ -164,7 +164,7 @@ class TestStep(unittest.TestCase): def reset(self, __): """Do nothing.""" self.assertTrue(self.want_reset, msg='env reset called when unexpected') - return EmptyResponse() + return Empty_Response() if __name__ == '__main__': rostest.rosrun('rktl_autonomy', 'test_rktl_rewards', TestStep) \ No newline at end of file diff --git a/src/rktl_game/rktl_game/nodes/game_manager b/src/rktl_game/rktl_game/nodes/game_manager index 6cb07e10..d83c37fb 100755 --- a/src/rktl_game/rktl_game/nodes/game_manager +++ b/src/rktl_game/rktl_game/nodes/game_manager @@ -13,7 +13,7 @@ import rclpy from std_msgs.msg import Bool, Header from nav_msgs.msg import Odometry from rktl_msgs.msg import Score, MatchStatus -from std_srvs.srv import Empty, EmptyResponse +from std_srvs.srv import Empty, Empty_Response class ScoreKeeper(): def __init__(self): @@ -71,7 +71,7 @@ class ScoreKeeper(): self.enabled = False self.match_status = 0 self.active_pub.publish(False) - return EmptyResponse() + return Empty_Response() def reset(self, _): self.orange_score = 0 @@ -83,13 +83,13 @@ class ScoreKeeper(): header = Header() header.stamp = node.get_clock().now() self.match_status_pub.publish(MatchStatus(header, 0, self.game_clock, Score(0, 0))) - return EmptyResponse() + return Empty_Response() def unpause(self, _): self.enabled = True self.match_status = 1 self.active_pub.publish(True) - return EmptyResponse() + return Empty_Response() def check_goal(self, ball_pose: Odometry): if self.enabled: diff --git a/src/rktl_planner/rktl_planner/nodes/path_planner.py b/src/rktl_planner/rktl_planner/nodes/path_planner.py index 28c6772e..96242a69 100755 --- a/src/rktl_planner/rktl_planner/nodes/path_planner.py +++ b/src/rktl_planner/rktl_planner/nodes/path_planner.py @@ -137,7 +137,7 @@ def car_odom_cb(self, data: Odometry): def ball_odom_cb(self, data: Odometry): self.ball_odom = data - def reset(self, _: EmptyRequest): + def reset(self, _: Empty_Request): req = self.path_req(self.car_odom, self.ball_odom, self.goal_pos) res = self.path_client(req) if self.linear_path_pub: @@ -146,7 +146,7 @@ def reset(self, _: EmptyRequest): bezier_path_list = BezierPathList() bezier_path_list.paths = res.bezier_paths self.bezier_path_pub.publish(bezier_path_list) - return EmptyResponse() + return Empty_Response() if __name__ == '__main__': PathPlanner() diff --git a/src/rktl_sim/rktl_sim/nodes/simulator b/src/rktl_sim/rktl_sim/nodes/simulator index eca0d8b0..cac5f39d 100755 --- a/src/rktl_sim/rktl_sim/nodes/simulator +++ b/src/rktl_sim/rktl_sim/nodes/simulator @@ -17,7 +17,7 @@ import time #import rospy -from std_srvs.srv import Empty, EmptyResponse +from std_srvs.srv import Empty, Empty_Response from threading import Lock from enum import Enum @@ -171,7 +171,7 @@ class Simulator(object): self.last_time = None self.reset_lock.release() - return EmptyResponse() + return Empty_Response() def reset_ball_cb(self, _): """Resets the ball sensor noise and pose WITHOUT resetting the whole sim.""" @@ -183,7 +183,7 @@ class Simulator(object): self.ball_init_speed = self.get_sim_param('/ball/init_speed') self.sim.reset_ball() - return EmptyResponse() + return Empty_Response() def loop_once(self): """Step the simulation once step, updating match status, moving and publishing new car and ball positions.""" From c79f64799d1964345f1b62451f8b03629ddc05fa Mon Sep 17 00:00:00 2001 From: sixfootsix50 Date: Sat, 2 Mar 2024 21:23:54 +0000 Subject: [PATCH 2/6] Updated entry point --- src/rktl_game/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rktl_game/setup.py b/src/rktl_game/setup.py index a4b5f218..650be4b0 100644 --- a/src/rktl_game/setup.py +++ b/src/rktl_game/setup.py @@ -24,6 +24,7 @@ tests_require=['pytest'], entry_points={ 'console_scripts': [ + 'game_manager = rktl_game.node.game_manager:main' ], }, ) From e13b3ca1f32ef69373ca951d634833426c9f69e7 Mon Sep 17 00:00:00 2001 From: Ryan Jordan Date: Sat, 2 Mar 2024 21:34:27 +0000 Subject: [PATCH 3/6] fixed parameter values --- src/rktl_sim/rktl_sim/vis_visualizer.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/rktl_sim/rktl_sim/vis_visualizer.py b/src/rktl_sim/rktl_sim/vis_visualizer.py index 41c7cb19..05320ef9 100755 --- a/src/rktl_sim/rktl_sim/vis_visualizer.py +++ b/src/rktl_sim/rktl_sim/vis_visualizer.py @@ -42,11 +42,11 @@ def __init__(self): # goal_width = rospy.get_param('/field/goal/width') # wall_thickness = rospy.get_param('/field/wall_thickness') # ball_radius = rospy.get_param("/ball/radius") - field_width = node.declare_parameter('/field/width').value - field_length = node.declare_parameter('/field/length').value - goal_width = node.declare_parameter('/field/goal/width').value - wall_thickness = node.declare_parameter('/field/wall_thickness').value - ball_radius = node.declare_parameter("/ball/radius").value + field_width = node.declare_parameter('/field/width').get_parameter_value().double_value + field_length = node.declare_parameter('/field/length').get_parameter_value().double_value + goal_width = node.declare_parameter('/field/goal/width').get_parameter_value().double_value + wall_thickness = node.declare_parameter('/field/wall_thickness').get_parameter_value().double_value + ball_radius = node.declare_parameter("/ball/radius").get_parameter_value().double_value @@ -54,7 +54,6 @@ def __init__(self): self.window = visualizer.Window( field_width, field_length, wall_thickness, - # rospy.get_param('~window_name', 'Rocket League Visualizer')) node.declare_parameter('~window_name', 'Rocket League Visualizer').value) # Collecting private parameters @@ -169,11 +168,11 @@ def __init__(self): # rospy.Subscriber("/cars/car0/lookahead_pnt", Float32, self.lookahead_cb) # rospy.Subscriber("/agents/agent0/bezier_path", BezierPathList, self.bezier_path_cb) - node.create_subscription(Odometry, "/ball/odom", self.ball_odom_cb) - node.create_subscription(Odometry, "/cars/car0/odom", self.car_odom_cb) - node.create_subscription(Path, "/cars/car0/path", self.path_arr_cb) - node.create_subscription(Float32, "/cars/car0/lookahead_pnt", self.lookahead_cb) - node.create_subscription(BezierPathList, "/agents/agent0/bezier_path", self.bezier_path_cb) + node.create_subscription(Odometry, "/ball/odom", self.ball_odom_cb, qos_profile=1) + node.create_subscription(Odometry, "/cars/car0/odom", self.car_odom_cb, qos_profile=1) + node.create_subscription(Path, "/cars/car0/path", self.path_arr_cb, qos_profile=1) + node.create_subscription(Float32, "/cars/car0/lookahead_pnt", self.lookahead_cb, qos_profile=1) + node.create_subscription(BezierPathList, "/agents/agent0/bezier_path", self.bezier_path_cb, qos_profile=1) while not rclpy.ok(): From 9b340a558d78dfddc890577d298d99ad286a085a Mon Sep 17 00:00:00 2001 From: Ryan Jordan Date: Sat, 2 Mar 2024 21:39:58 +0000 Subject: [PATCH 4/6] fixed exception import --- src/rktl_sim/rktl_sim/vis_visualizer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rktl_sim/rktl_sim/vis_visualizer.py b/src/rktl_sim/rktl_sim/vis_visualizer.py index 05320ef9..9a8b39a9 100755 --- a/src/rktl_sim/rktl_sim/vis_visualizer.py +++ b/src/rktl_sim/rktl_sim/vis_visualizer.py @@ -15,6 +15,7 @@ from nav_msgs.msg import Odometry import rclpy import sys +from rclpy.exceptions import ROSInterruptException from rktl_dependencies.transformations import euler_from_quaternion @@ -34,7 +35,7 @@ def __init__(self): #rospy.init_node("visualizer") rclpy.init(args=sys.argv) global node - node = rclpy.create_node("visualizer") + node = rclpy.create_node("visualizer", parameter_overrides=[]) # Collecting global parameters # field_width = node.get_param('/field/width') @@ -64,7 +65,7 @@ def __init__(self): # car_length = rospy.get_param("~cars/body_length") self.frame_id = node.declare_parameter("~frame_id", "map").value self.timeout = node.declare_parameter("~timeout", 10).value - rate = rclpy.create_node('simple_node').create_rate((node.declare_parameter("~rate", 20).value)) + rate = rclpy.create_node('simple_node').create_rate((node.declare_parameter("~rate", 20).get_parameter_value().double_value)) car_width = node.declare_parameter("~cars/body_width").value car_length = node.declare_parameter("~cars/body_length").value @@ -182,7 +183,7 @@ def __init__(self): exit() try: rate.sleep() - except rclpy.ROSInterruptException: + except ROSInterruptException: pass From 475a98d5a95e00498161a46a8972e71b26cfe1ed Mon Sep 17 00:00:00 2001 From: Ryan Jordan Date: Sat, 2 Mar 2024 21:40:24 +0000 Subject: [PATCH 5/6] fixed exception import --- src/rktl_sim/rktl_sim/vis_visualizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rktl_sim/rktl_sim/vis_visualizer.py b/src/rktl_sim/rktl_sim/vis_visualizer.py index 9a8b39a9..84188f17 100755 --- a/src/rktl_sim/rktl_sim/vis_visualizer.py +++ b/src/rktl_sim/rktl_sim/vis_visualizer.py @@ -35,7 +35,7 @@ def __init__(self): #rospy.init_node("visualizer") rclpy.init(args=sys.argv) global node - node = rclpy.create_node("visualizer", parameter_overrides=[]) + node = rclpy.create_node("visualizer") # Collecting global parameters # field_width = node.get_param('/field/width') From 449abab32f2b350c54f5f355b1b76b26d46b3eee Mon Sep 17 00:00:00 2001 From: sixfootsix50 Date: Sat, 2 Mar 2024 21:40:57 +0000 Subject: [PATCH 6/6] Removed Entry point --- src/rktl_game/setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rktl_game/setup.py b/src/rktl_game/setup.py index 650be4b0..a4b5f218 100644 --- a/src/rktl_game/setup.py +++ b/src/rktl_game/setup.py @@ -24,7 +24,6 @@ tests_require=['pytest'], entry_points={ 'console_scripts': [ - 'game_manager = rktl_game.node.game_manager:main' ], }, )