From f40bd23e7df85e6321816991efe10f72e648bb35 Mon Sep 17 00:00:00 2001 From: kugurofu Date: Fri, 8 Aug 2025 08:31:02 +0000 Subject: [PATCH 01/25] add odom_combine --- .../orange_gnss/gnss_odom_publisher_ttyUSB.py | 11 +- orange_gnss/orange_gnss/odom_combination.py | 203 ++++++++++++++++++ orange_gnss/setup.py | 3 +- 3 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 orange_gnss/orange_gnss/odom_combination.py diff --git a/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py b/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py index 7e2973d..64d0429 100644 --- a/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py +++ b/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py @@ -26,6 +26,7 @@ def __init__(self): self.country_id = self.get_parameter('country_id').get_parameter_value().integer_value self.Position_magnification = self.get_parameter('Position_magnification').get_parameter_value().double_value #self.theta = self.get_parameter('heading').get_parameter_value().double_value + self.tsukuba_theta=90 self.initial_coordinate = None self.fix_data = None @@ -62,7 +63,11 @@ def send_request(self): request = Avglatlon.Request() request.avg_lat = self.initial_coordinate[0] # ← average lat request.avg_lon = self.initial_coordinate[1] # ← average lon - request.theta = self.theta + request.current_lat = self.current_coordinate[0] # ← current lat + request.current_lon = self.current_coordinate[1] # ← current lon + #request.theta = self.theta + request.theta = self.tsukuba_theta # tsukuba start theta + request.current_theta = self.theta # for tsukuba future = self.client.call_async(request) future.add_done_callback(self.response_callback) @@ -104,7 +109,9 @@ def acquire_gps_data(self): time.sleep(0.1) # Slight delay to avoid overwhelming the GPS device if count > 0: - self.initial_coordinate = [lat_sum / count, lon_sum / count] + #self.initial_coordinate = [lat_sum / count, lon_sum / count] # calculate average + self.initial_coordinate = [36.0497502, 140.0459234] # tsukuba start point + self.current_coordinate = [lat_sum / count, lon_sum / count] # for tsukuba self.theta = (heading_sum / count) - 90 self.initialized = True self.get_logger().info(f"Initial coordinate set to: {self.initial_coordinate}") diff --git a/orange_gnss/orange_gnss/odom_combination.py b/orange_gnss/orange_gnss/odom_combination.py new file mode 100644 index 0000000..b2c2ec8 --- /dev/null +++ b/orange_gnss/orange_gnss/odom_combination.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +import rclpy +import math +import numpy as np +from rclpy.qos import QoSProfile, QoSDurabilityPolicy, QoSHistoryPolicy, QoSReliabilityPolicy +from nav_msgs.msg import Odometry +from rclpy.node import Node +from std_msgs.msg import Header +import threading +import time +from my_msgs.srv import Avglatlon + +class Odom_Combination(Node): + def __init__(self): + super().__init__('odom_combination') + + qos_profile = QoSProfile( + history=QoSHistoryPolicy.KEEP_LAST, + reliability=QoSReliabilityPolicy.RELIABLE, + durability=QoSDurabilityPolicy.VOLATILE, + depth = 1 + ) + + # subscription + self.odom_sub = self.create_subscription(Odometry, '/odom', self.get_odom, qos_profile) + + # publisher + self.odom_pub = self.create_publisher(Odometry, '/odom/combine', qos_profile) + + # service + self.avg_gps_service = self.create_service(Avglatlon, 'send_avg_gps', self.receive_avg_gps_callback) + + self.position_x = 0.0 + self.position_y = 0.0 + self.theta_z = 0.0 + self.theta = 0.0 + self.initial_xy = (0.0, 0.0) + self.Position_magnification = 1.0 # 必要なら調整 + + self.timer = self.create_timer(0.1, self.combine) + + def get_odom(self, msg): + ''' + self.position_x = msg.pose.pose.position.x + self.position_y = msg.pose.pose.position.y + self.position_z = msg.pose.pose.position.z + x, y, z, w = msg.pose.pose.orientation.x, msg.pose.pose.orientation.y, msg.pose.pose.orientation.z, msg.pose.pose.orientation.w + roll, pitch, yaw = quaternion_to_euler(x, y, z, w) + self.theta_x, self.theta_y, self.theta_z = 0, 0, yaw * 180 / math.pi + ''' + self.position_x = msg.pose.pose.position.x + self.position_y = msg.pose.pose.position.y + x, y, z, w = msg.pose.pose.orientation.x, msg.pose.pose.orientation.y, msg.pose.pose.orientation.z, msg.pose.pose.orientation.w + roll, pitch, yaw = quaternion_to_euler(x, y, z, w) + self.theta_z = yaw # 単位はラジアンのままでOK + + def conversion(self, coordinate, origin, theta): + ido = coordinate[0] + keido = coordinate[1] + ido0 = origin[0] + keido0 = origin[1] + + # self.get_logger().info(f"theta: {theta}") + + a = 6378137 + f = 35/10439 + e1 = 734/8971 + e2 = 127/1547 + n = 35/20843 + a0 = 1 + a2 = 102/40495 + a4 = 1/378280 + a6 = 1/289634371 + a8 = 1/204422462123 + pi180 = 71/4068 + # %math.pi/180 + d_ido = ido - ido0 + d_keido = keido - keido0 + rd_ido = d_ido * pi180 + rd_keido = d_keido * pi180 + r_ido = ido * pi180 + r_keido = keido * pi180 + r_ido0 = ido0 * pi180 + W = math.sqrt(1-(e1**2)*(math.sin(r_ido)**2)) + N = a / W + t = math.tan(r_ido) + ai = e2*math.cos(r_ido) + + # %===Y===% + S = a*(a0*r_ido - a2*math.sin(2*r_ido)+a4*math.sin(4*r_ido) - + a6*math.sin(6*r_ido)+a8*math.sin(8*r_ido))/(1+n) + S0 = a*(a0*r_ido0-a2*math.sin(2*r_ido0)+a4*math.sin(4*r_ido0) - + a6*math.sin(6*r_ido0)+a8*math.sin(8*r_ido0))/(1+n) + m0 = S/S0 + B = S-S0 + y1 = (rd_keido**2)*N*math.sin(r_ido)*math.cos(r_ido)/2 + y2 = (rd_keido**4)*N*math.sin(r_ido) * \ + (math.cos(r_ido)**3)*(5-(t**2)+9*(ai**2)+4*(ai**4))/24 + y3 = (rd_keido**6)*N*math.sin(r_ido)*(math.cos(r_ido)**5) * \ + (61-58*(t**2)+(t**4)+270*(ai**2)-330*(ai**2)*(t**2))/720 + gps_y = self.Position_magnification * m0 * (B + y1 + y2 + y3) + + # %===X===% + x1 = rd_keido*N*math.cos(r_ido) + x2 = (rd_keido**3)*N*(math.cos(r_ido)**3)*(1-(t**2)+(ai**2))/6 + x3 = (rd_keido**5)*N*(math.cos(r_ido)**5) * \ + (5-18*(t**2)+(t**4)+14*(ai**2)-58*(ai**2)*(t**2))/120 + gps_x = self.Position_magnification * m0 * (x1 + x2 + x3) + + # point = (gps_x, gps_y)Not match + + degree_to_radian = math.pi / 180 + r_theta = theta * degree_to_radian + h_x = math.cos(r_theta) * gps_x - math.sin(r_theta) * gps_y + h_y = math.sin(r_theta) * gps_x + math.cos(r_theta) * gps_y + #point = (-h_y, h_x) + point = (h_y, -h_x) + + return point + + def receive_avg_gps_callback(self, request, response): + avg_lat, avg_lon, current_lat, current_lon, theta = request.avg_lat, request.avg_lon, request.current_lat, request.current_lon, request.current_theta + if theta == 0.0: + self.get_logger().warn("GPSからのthetaがまだ取得されていません。") + response.success = False + return response + + self.theta = theta + current_coordinate = [current_lat, current_lon] + initial_coordinate = [avg_lat, avg_lon] + self.initial_xy = self.conversion(current_coordinate, initial_coordinate, theta) + xy_np = np.array(self.initial_xy) + + def yaw_to_orientation(self, yaw): + orientation_z = np.sin(yaw / 2.0) + orientation_w = np.cos(yaw / 2.0) + return orientation_z, orientation_w + + def combine(self): + pos_x = self.position_x + pos_y = self.position_y + degree_to_radian = math.pi / 180 + pos_theta = self.theta * degree_to_radian # maybe -self.theta * degree_to_radian + + # conversionによるxy変換結果(初期座標) + #delta_x, delta_y = self.initial_xy + + # theta_z(現在の向き)で回転 + cos_theta = math.cos(pos_theta) + sin_theta = math.sin(pos_theta) + + #rotated_x = cos_theta * delta_x - sin_theta * delta_y + #rotated_y = sin_theta * delta_x + cos_theta * delta_y + rotated_x = cos_theta * pos_x - sin_theta * pos_y + rotated_y = sin_theta * pos_x + cos_theta * pos_y + + # 加算して新しい位置 + #combined_x = self.position_x + rotated_x + #combined_y = self.position_y + rotated_y + combined_x = self.initial_xy[0] + rotated_x + combined_y = self.initial_xy[1] + rotated_y + + # quartanion z,w + odom_orientation = self.yaw_to_orientation(pos_theta) + + # Odometryメッセージ作成 + odom_msg = Odometry() + odom_msg.header.stamp = self.get_clock().now().to_msg() + odom_msg.header.frame_id = "odom" + odom_msg.pose.pose.position.x = combined_x + odom_msg.pose.pose.position.y = combined_y + odom_msg.pose.pose.position.z = 0.0 + odom_msg.pose.pose.orientation.x = 0.0 + odom_msg.pose.pose.orientation.y = 0.0 + odom_msg.pose.pose.orientation.z = float(odom_orientation[0]) + odom_msg.pose.pose.orientation.w = float(odom_orientation[1]) + + # publish + self.odom_pub.publish(odom_msg) + +def quaternion_to_euler(x, y, z, w): + t0 = +2.0 * (w * x + y * z) + t1 = +1.0 - 2.0 * (x * x + y * y) + roll = math.atan2(t0, t1) + + t2 = +2.0 * (w * y - z * x) + t2 = +1.0 if t2 > +1.0 else t2 + t2 = -1.0 if t2 < -1.0 else t2 + pitch = math.asin(t2) + + t3 = +2.0 * (w * z + x * y) + t4 = +1.0 - 2.0 * (y * y + z * z) + yaw = math.atan2(t3, t4) + + return roll, pitch, yaw + +def main(args=None): + rclpy.init(args=args) + odom_combination = Odom_Combination() + rclpy.spin(odom_combination) + +if __name__ == '__main__': + main() diff --git a/orange_gnss/setup.py b/orange_gnss/setup.py index 891b69e..3ef7c4e 100644 --- a/orange_gnss/setup.py +++ b/orange_gnss/setup.py @@ -36,7 +36,8 @@ "gnss_odom_publisher_ttyUSB = orange_gnss.gnss_odom_publisher_ttyUSB:main", "GPSodom_correction = orange_gnss.GPSodom_correction:main", "lonlat_to_odom = orange_gnss.lonlat_to_odom:main", - "ekf_myself_noGPS = orange_gnss.ekf_myself_noGPS:main" + "ekf_myself_noGPS = orange_gnss.ekf_myself_noGPS:main", + "odom_combination = orange_gnss.odom_combination:main", ], }, ) From 97a042d53e4a239a700bdfad4e4c631c32e96d01 Mon Sep 17 00:00:00 2001 From: kugurofu Date: Fri, 22 Aug 2025 08:01:51 +0000 Subject: [PATCH 02/25] change param --- orange_gnss/orange_gnss/GPSodom_correction.py | 2 +- .../orange_gnss/gnss_odom_movingbase_fix_publisher_ttyUSB.py | 4 ++-- orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/orange_gnss/orange_gnss/GPSodom_correction.py b/orange_gnss/orange_gnss/GPSodom_correction.py index 1ea3652..f397382 100644 --- a/orange_gnss/orange_gnss/GPSodom_correction.py +++ b/orange_gnss/orange_gnss/GPSodom_correction.py @@ -14,7 +14,7 @@ def __init__(self): super().__init__('GPSodom_correction') self.create_subscription( - Odometry, "/odom/gps", self.odomgps_callback, 1) + Odometry, "/odom/UM982", self.odomgps_callback, 1) self.create_subscription( Imu, "/livox/imu", self.imu_callback, 1) diff --git a/orange_gnss/orange_gnss/gnss_odom_movingbase_fix_publisher_ttyUSB.py b/orange_gnss/orange_gnss/gnss_odom_movingbase_fix_publisher_ttyUSB.py index 9f8810c..5582a10 100644 --- a/orange_gnss/orange_gnss/gnss_odom_movingbase_fix_publisher_ttyUSB.py +++ b/orange_gnss/orange_gnss/gnss_odom_movingbase_fix_publisher_ttyUSB.py @@ -250,7 +250,7 @@ def quaternion_from_euler(self, roll, pitch, yaw): def heading_to_quat(self ,real_heading): - robotheading = real_heading + 90 + robotheading = real_heading - 90 if robotheading >= 360: robotheading -= 360 @@ -366,7 +366,7 @@ def publish_fix(self, gps): def publish_movingbase(self, heading): if heading is not None and heading != 0.0: - robotheading = heading + 90.0 + robotheading = heading - 90.0 if robotheading >= 360.0: robotheading -= 360.0 diff --git a/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py b/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py index 64d0429..a141d80 100644 --- a/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py +++ b/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py @@ -26,7 +26,7 @@ def __init__(self): self.country_id = self.get_parameter('country_id').get_parameter_value().integer_value self.Position_magnification = self.get_parameter('Position_magnification').get_parameter_value().double_value #self.theta = self.get_parameter('heading').get_parameter_value().double_value - self.tsukuba_theta=90 + self.tsukuba_theta=180.0 # nakaniwa 180 self.initial_coordinate = None self.fix_data = None @@ -110,11 +110,12 @@ def acquire_gps_data(self): if count > 0: #self.initial_coordinate = [lat_sum / count, lon_sum / count] # calculate average - self.initial_coordinate = [36.0497502, 140.0459234] # tsukuba start point + self.initial_coordinate = [35.425952230280004, 139.31380123427] # tsukuba start point 36.0497502, 140.0459234 /nakaniwa 35.4257898377487,139.313807281254 self.current_coordinate = [lat_sum / count, lon_sum / count] # for tsukuba self.theta = (heading_sum / count) - 90 self.initialized = True self.get_logger().info(f"Initial coordinate set to: {self.initial_coordinate}") + self.get_logger().info(f"current coordinate set to: {self.current_coordinate}") self.get_logger().info(f"Initial theta set to: {self.theta}") self.send_request() self.is_acquiring = False From f9e1f2a5d4ba51f1cdc24dbb61bc6f774f9bf1d1 Mon Sep 17 00:00:00 2001 From: kugurofu Date: Mon, 22 Sep 2025 04:41:46 +0000 Subject: [PATCH 03/25] add spresense imu --- .../config/motor_driver_params.yaml | 2 +- orange_bringup/launch/orange_robot.launch.xml | 37 ++- orange_description/xacro/orange_robot.xacro | 2 +- ...ss_odom_movingbase_fix_publisher_ttyUSB.py | 2 +- .../orange_gnss/gnss_odom_publisher_ttyUSB.py | 6 +- .../pcd_convert/pcd_height_segmentation.py | 4 +- .../pcd_convert/pcd_rotation_lidar2.py | 232 ++++++++++++++++++ pcd_convert/setup.py | 3 +- .../launch/try_navigation.launch.py | 12 +- .../try_navigation/ekf_myself_gps.py | 9 +- .../try_navigation/path_follower.py | 6 +- .../try_navigation/potential_astar.py | 2 +- 12 files changed, 290 insertions(+), 27 deletions(-) create mode 100644 pcd_convert/pcd_convert/pcd_rotation_lidar2.py diff --git a/orange_bringup/config/motor_driver_params.yaml b/orange_bringup/config/motor_driver_params.yaml index 3796ddb..e799121 100644 --- a/orange_bringup/config/motor_driver_params.yaml +++ b/orange_bringup/config/motor_driver_params.yaml @@ -7,7 +7,7 @@ motor_driver_node: left_wheel_radius: 0.09767 # meter right_wheel_radius: 0.09767 # meter # For odometry computation - computation_left_wheel_radius: 0.0970 # meter + computation_left_wheel_radius: 0.09755 # meter computation_right_wheel_radius: 0.0973 # meter # Encoder CPR(counts per revolution) cpr: 16385 diff --git a/orange_bringup/launch/orange_robot.launch.xml b/orange_bringup/launch/orange_robot.launch.xml index 4824862..c072026 100644 --- a/orange_bringup/launch/orange_robot.launch.xml +++ b/orange_bringup/launch/orange_robot.launch.xml @@ -65,6 +65,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -83,12 +112,12 @@ - + - + - + diff --git a/orange_description/xacro/orange_robot.xacro b/orange_description/xacro/orange_robot.xacro index 9e7afe4..df1006f 100644 --- a/orange_description/xacro/orange_robot.xacro +++ b/orange_description/xacro/orange_robot.xacro @@ -11,7 +11,7 @@ - + + + + + + + From 4bd815fd0359d9fe0eae5348859501ea075a233d Mon Sep 17 00:00:00 2001 From: kugurofu Date: Tue, 7 Oct 2025 06:00:51 +0000 Subject: [PATCH 09/25] add map obs --- orange_bringup/launch/orange_robot.launch.xml | 2 +- .../orange_gnss/gnss_odom_publisher_ttyUSB.py | 2 +- .../try_navigation/potential_astar.py | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/orange_bringup/launch/orange_robot.launch.xml b/orange_bringup/launch/orange_robot.launch.xml index c072026..341a8cc 100644 --- a/orange_bringup/launch/orange_robot.launch.xml +++ b/orange_bringup/launch/orange_robot.launch.xml @@ -117,7 +117,7 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py b/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py index af1e6bc..e204fe6 100644 --- a/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py +++ b/orange_gnss/orange_gnss/gnss_odom_publisher_ttyUSB.py @@ -110,7 +110,7 @@ def acquire_gps_data(self): if count > 0: #self.initial_coordinate = [lat_sum / count, lon_sum / count] # calculate average - self.initial_coordinate = [36.04974095972727, 140.04593633886364 ] # tsukuba start point 36.0497502, 140.0459234 36.04972947264545, 140.04590687627274 36.04974095972727, 140.04593633886364 , left 36.04976195993636, 140.04593755179093/nakaniwa 35.4257898377487,139.313807281254 /35.425952230280004, 139.31380123427 + self.initial_coordinate = [36.04974095972727, 140.04593633886364 ] # tsukuba start point right 36.04974095972727, 140.04593633886364 , left 36.04976195993636, 140.04593755179093/nakaniwa 35.4257898377487,139.313807281254 /35.425952230280004, 139.31380123427 self.current_coordinate = [lat_sum / count, lon_sum / count] # for tsukuba self.theta = (heading_sum / count) - 90 self.initialized = True diff --git a/try_navigation/try_navigation/path_follower.py b/try_navigation/try_navigation/path_follower.py index 4344c39..1445612 100644 --- a/try_navigation/try_navigation/path_follower.py +++ b/try_navigation/try_navigation/path_follower.py @@ -134,7 +134,7 @@ def __init__(self): #[-69.5, -62, -47.5, -27.5, 1.0], #tyokusen4 ||| [-67.5, -62, -47.5, -27.5, 1.0]before:[-67.0, -62, -47.5, -27.5, 1.0], #[-55, -35, 41, 46, 1.0], #Goal - [63.0, 65.0, 19.0, 39.0, 1.0], #shiyakusyo + [63.5, 65.0, 19.0, 39.0, 1.0], #shiyakusyo [ 999, 999, 999, 999, 0.0] ]) # self.stop_num = 0; @@ -170,12 +170,12 @@ def __init__(self): ################################################################################# ################# IGVC SelfDrive Full #20250601# ################# - self.sd_full_flag = 1 #root flag + self.sd_full_flag = 0 #root flag self.waypoint_number = 0 - self.sd_full_human_stop = 1 #sub flag + self.sd_full_human_stop = 0 #sub flag if self.sd_full_human_stop == 1: self.sd_c_obs_stop_dist = self.sd_human_stop_dist - self.sd_full_sign_stop = 1 #sub flag + self.sd_full_sign_stop = 0 #sub flag if self.sd_full_sign_stop == 1: dist = 0.5 + 0.4 + 0.5# eria +top +delay sd_full_stop_xy = [-32.37441428909107, -16.465277566213718, 0.0] @@ -375,7 +375,7 @@ def robot_ctrl(self): if ~np.any(ch_obs) : if np.any(rh_obs) and np.any(lh_obs): target_theta = (target_rad) * (180 / math.pi) - print("--- Center --- Befor target_theta[deg]:",target_theta) + #print("--- Center --- Befor target_theta[deg]:",target_theta) speed = 0.25 lh_obs_close = min(lh_obs[1,:]) # y0 lh min rh_obs_close = max(rh_obs[1,:]) # y0 rh min @@ -384,20 +384,20 @@ def robot_ctrl(self): #c_point = (cx, cy) target_rad = math.atan2(cx, cf) target_theta = (target_rad) * (180 / math.pi) - print("--- Center --- After target_theta[deg]:",target_theta) + #print("--- Center --- After target_theta[deg]:",target_theta) elif np.any(rh_obs) and ~np.any(lh_obs): speed = 0.25 if 0 <= self.waypoint_number and self.waypoint_number <= 9: target_theta = (target_rad) * (180 / math.pi) - print("!!!RH!!!! Befor target_theta[deg]:",target_theta) + #print("!!!RH!!!! Befor target_theta[deg]:",target_theta) rh_obs_close = max(rh_obs[1,:]) # y0 rh min rh_dist = 0.65 cy = cf cx = rh_obs_close + rh_dist target_rad = math.atan2(cx, cf) target_theta = (target_rad) * (180 / math.pi) - print("!!!RH!!!! After target_theta[deg]:",target_theta) + #print("!!!RH!!!! After target_theta[deg]:",target_theta) elif ~np.any(rh_obs) and np.any(lh_obs): @@ -618,7 +618,6 @@ def get_odom_ref(self, msg): self.ref_theta_y = 0 #pitch /math.pi*180 self.ref_theta_z = yaw /math.pi*180 - if ((self.stop_xy[self.stop_num,0] < self.ref_position_x) and (self.ref_position_x < self.stop_xy[self.stop_num,1]) and (self.stop_xy[self.stop_num,2] < self.ref_position_y) and (self.ref_position_y < self.stop_xy[self.stop_num,3]) ) or ((self.stop_xy[self.stop_num,0] < self.position_x) and (self.position_x < self.stop_xy[self.stop_num,1]) and (self.stop_xy[self.stop_num,2] < self.position_y) and (self.position_y < self.stop_xy[self.stop_num,3]) ): if self.stop_xy[self.stop_num,4] > 0: self.get_logger().info('####### stop flag on %f #######' % (self.stop_num)) @@ -626,7 +625,6 @@ def get_odom_ref(self, msg): else: self.get_logger().info('####### through flag on %f #######' % (self.stop_num)) self.stop_num = self.stop_num + 1; - def pointcloud2_to_array(self, cloud_msg): # Extract point cloud data diff --git a/try_navigation/try_navigation/potential_astar.py b/try_navigation/try_navigation/potential_astar.py index 70370c4..61ce66d 100644 --- a/try_navigation/try_navigation/potential_astar.py +++ b/try_navigation/try_navigation/potential_astar.py @@ -143,6 +143,11 @@ def __init__(self): self.left_obs_points = np.array([[],[],[]]) self.dot_obs_points = np.array([[],[],[]]) + # behind robot obs + self.self_radius = 0.8 + self.angle_min = -60 + 180 + self.angle_max = 60 + 180 + #DRIVE MODE self.functions_test = 0 #autonav:1 selfdrive:0 @@ -425,9 +430,9 @@ def potential_astar(self, msg): elif self.obs_info[self.waypoint_number][self.dotline_info] == 1: dot_line_local = localization_xyz(self.dot_obs_points, position_x, position_y, theta_x, theta_y, theta_z) - self_radius = 0.8 - angle_min = -60 + 180 - angle_max = 60 + 180 + self_radius = self.self_radius + angle_min = self.angle_min + angle_max = self.angle_max angles = np.linspace(np.radians(angle_min),np.radians(angle_max),100) x_radius = self_radius * np.cos(angles) y_radius = self_radius * np.sin(angles) From 1d79f096b610b8aa13a73302b8370cbff11ba019 Mon Sep 17 00:00:00 2001 From: kugurofu Date: Tue, 21 Oct 2025 06:47:10 +0000 Subject: [PATCH 16/25] add stop point in pathfollower and add some map_obs --- try_navigation/config/config.rviz | 588 +++++++++++++++++- .../try_navigation/path_follower.py | 19 +- .../try_navigation/potential_astar.py | 37 +- 3 files changed, 612 insertions(+), 32 deletions(-) diff --git a/try_navigation/config/config.rviz b/try_navigation/config/config.rviz index 0079548..d1c2869 100644 --- a/try_navigation/config/config.rviz +++ b/try_navigation/config/config.rviz @@ -6,8 +6,16 @@ Panels: Expanded: - /Global Options1 - /Status1 + - /fusion/odom1/Shape1 + - /fusion/odom1/Covariance1 + - /GPSodom1/Shape1 + - /imu_odom1/Shape1 + - /PointCloud21 + - /Odometry2/Shape1 + - /Odometry3/Shape1 + - /PointCloud22 Splitter Ratio: 0.5 - Tree Height: 549 + Tree Height: 580 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties @@ -25,7 +33,7 @@ Panels: Experimental: false Name: Time SyncMode: 0 - SyncSource: "" + SyncSource: pcd_obs_global Visualization Manager: Class: "" Displays: @@ -47,10 +55,558 @@ Visualization Manager: Plane Cell Count: 10 Reference Frame: Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 0 + Name: Odometry + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 255; 25; 0 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /odom + Value: true + - Alpha: 1 + Autocompute Intensity Bounds: true + Autocompute Value Bounds: + Max Value: 10 + Min Value: -10 + Value: true + Axis: Z + Channel Name: intensity + Class: rviz_default_plugins/PointCloud2 + Color: 249; 240; 107 + Color Transformer: FlatColor + Decay Time: 0 + Enabled: true + Invert Rainbow: false + Max Color: 255; 255; 255 + Max Intensity: 4 + Min Color: 0; 0; 0 + Min Intensity: 0 + Name: pcd_obs_global + Position Transformer: XYZ + Selectable: true + Size (Pixels): 3 + Size (m): 0.05000000074505806 + Style: Flat Squares + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /pcd_obs_global + Use Fixed Frame: true + Use rainbow: true + Value: true + - Alpha: 1 + Autocompute Intensity Bounds: true + Autocompute Value Bounds: + Max Value: 10 + Min Value: -10 + Value: true + Axis: Z + Channel Name: intensity + Class: rviz_default_plugins/PointCloud2 + Color: 255; 255; 255 + Color Transformer: Intensity + Decay Time: 0 + Enabled: true + Invert Rainbow: false + Max Color: 255; 255; 255 + Max Intensity: 0 + Min Color: 0; 0; 0 + Min Intensity: 0 + Name: white_buff + Position Transformer: XYZ + Selectable: true + Size (Pixels): 3 + Size (m): 0.10000000149011612 + Style: Flat Squares + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /white_buff + Use Fixed Frame: true + Use rainbow: true + Value: true + - Alpha: 1 + Buffer Length: 1 + Class: rviz_default_plugins/Path + Color: 25; 255; 0 + Enabled: true + Head Diameter: 0.30000001192092896 + Head Length: 0.20000000298023224 + Length: 0.30000001192092896 + Line Style: Lines + Line Width: 0.029999999329447746 + Name: Path + Offset: + X: 0 + Y: 0 + Z: 0 + Pose Color: 255; 85; 255 + Pose Style: None + Radius: 0.029999999329447746 + Shaft Diameter: 0.10000000149011612 + Shaft Length: 0.10000000149011612 + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /potential_astar_path + Value: true + - Alpha: 1 + Autocompute Intensity Bounds: true + Autocompute Value Bounds: + Max Value: 10 + Min Value: -10 + Value: true + Axis: Z + Channel Name: intensity + Class: rviz_default_plugins/PointCloud2 + Color: 255; 255; 255 + Color Transformer: "" + Decay Time: 0 + Enabled: false + Invert Rainbow: false + Max Color: 255; 255; 255 + Max Intensity: 4096 + Min Color: 0; 0; 0 + Min Intensity: 0 + Name: pothole + Position Transformer: "" + Selectable: true + Size (Pixels): 3 + Size (m): 0.009999999776482582 + Style: Flat Squares + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /pothole_points + Use Fixed Frame: true + Use rainbow: true + Value: false + - Alpha: 0.699999988079071 + Class: rviz_default_plugins/Map + Color Scheme: map + Draw Behind: false + Enabled: true + Name: globalmap + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /reflect_map_global + Update Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /reflect_map_global_updates + Use Timestamp: false + Value: true + - Alpha: 0.699999988079071 + Class: rviz_default_plugins/Map + Color Scheme: map + Draw Behind: false + Enabled: true + Name: localmap + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /reflect_map_local + Update Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /reflect_map_local_updates + Use Timestamp: false + Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 0 + Name: fusion/odom + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 220; 138; 221 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /fusion/odom + Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 0 + Name: GPSodom + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 98; 160; 234 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /odom/UM982 + Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 0 + Name: imu_odom + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 249; 240; 107 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /odom/wheel_imu + Value: true + - Alpha: 1 + Buffer Length: 1 + Class: rviz_default_plugins/Path + Color: 153; 193; 241 + Enabled: true + Head Diameter: 0.30000001192092896 + Head Length: 0.20000000298023224 + Length: 0.30000001192092896 + Line Style: Lines + Line Width: 0.029999999329447746 + Name: waypoint_path + Offset: + X: 0 + Y: 0 + Z: 0 + Pose Color: 255; 85; 255 + Pose Style: None + Radius: 0.029999999329447746 + Shaft Diameter: 0.10000000149011612 + Shaft Length: 0.10000000149011612 + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /waypoint_path + Value: true + - Alpha: 1 + Autocompute Intensity Bounds: true + Autocompute Value Bounds: + Max Value: 10 + Min Value: -10 + Value: true + Axis: Z + Channel Name: intensity + Class: rviz_default_plugins/PointCloud2 + Color: 255; 255; 255 + Color Transformer: "" + Decay Time: 0 + Enabled: false + Invert Rainbow: false + Max Color: 255; 255; 255 + Max Intensity: 4096 + Min Color: 0; 0; 0 + Min Intensity: 0 + Name: tire + Position Transformer: "" + Selectable: true + Size (Pixels): 3 + Size (m): 0.009999999776482582 + Style: Flat Squares + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /tire_points + Use Fixed Frame: true + Use rainbow: true + Value: false + - Alpha: 1 + Autocompute Intensity Bounds: true + Autocompute Value Bounds: + Max Value: 10 + Min Value: -10 + Value: true + Axis: Z + Channel Name: intensity + Class: rviz_default_plugins/PointCloud2 + Color: 255; 255; 255 + Color Transformer: Intensity + Decay Time: 0 + Enabled: true + Invert Rainbow: false + Max Color: 255; 255; 255 + Max Intensity: 3.704611301422119 + Min Color: 0; 0; 0 + Min Intensity: 0 + Name: PointCloud2 + Position Transformer: XYZ + Selectable: true + Size (Pixels): 3 + Size (m): 0.009999999776482582 + Style: Flat Squares + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /pcd_obs_global + Use Fixed Frame: true + Use rainbow: true + Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 0 + Name: Odometry + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 255; 190; 111 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /odom/wheel_spimu + Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 0 + Name: Odometry + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 51; 209; 122 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /odom/combine + Value: true + - Class: rviz_default_plugins/MarkerArray + Enabled: true + Name: MarkerArray + Namespaces: + {} + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /wall_follow_markers + Value: true + - Alpha: 1 + Autocompute Intensity Bounds: true + Autocompute Value Bounds: + Max Value: 10 + Min Value: -10 + Value: true + Axis: Z + Channel Name: intensity + Class: rviz_default_plugins/PointCloud2 + Color: 255; 255; 255 + Color Transformer: FlatColor + Decay Time: 0 + Enabled: true + Invert Rainbow: false + Max Color: 255; 255; 255 + Max Intensity: -999999 + Min Color: 0; 0; 0 + Min Intensity: 999999 + Name: PointCloud2 + Position Transformer: XYZ + Selectable: true + Size (Pixels): 3 + Size (m): 0.20000000298023224 + Style: Flat Squares + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /pcd_test_global + Use Fixed Frame: true + Use rainbow: true + Value: true Enabled: true Global Options: Background Color: 48; 48; 48 - Fixed Frame: map + Fixed Frame: odom Frame Rate: 30 Name: root Tools: @@ -93,33 +649,33 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 10 + Distance: 21.29517364501953 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false Focal Point: - X: 0 - Y: 0 - Z: 0 + X: 5.204740047454834 + Y: 6.645839214324951 + Z: 0.015708111226558685 Focal Shape Fixed Size: true Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 0.785398006439209 + Pitch: 1.5647963285446167 Target Frame: Value: Orbit (rviz) - Yaw: 0.785398006439209 + Yaw: 3.1453959941864014 Saved: ~ Window Geometry: Displays: collapsed: false - Height: 846 + Height: 877 Hide Left Dock: false - Hide Right Dock: false - QMainWindow State: 000000ff00000000fd000000040000000000000156000002b0fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002b0000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002b0fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000002b0000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b0000002fb00fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + Hide Right Dock: true + QMainWindow State: 000000ff00000000fd000000040000000000000156000002cffc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002cf000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000251fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000251000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007380000003efc0100000002fb0000000800540069006d0065010000000000000738000002fb00fffffffb0000000800540069006d00650100000000000004500000000000000000000005dc000002cf00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Time: @@ -127,7 +683,7 @@ Window Geometry: Tool Properties: collapsed: false Views: - collapsed: false - Width: 1200 - X: 60 - Y: 57 + collapsed: true + Width: 1848 + X: 0 + Y: 28 diff --git a/try_navigation/try_navigation/path_follower.py b/try_navigation/try_navigation/path_follower.py index 1445612..cd2625b 100644 --- a/try_navigation/try_navigation/path_follower.py +++ b/try_navigation/try_navigation/path_follower.py @@ -134,8 +134,23 @@ def __init__(self): #[-69.5, -62, -47.5, -27.5, 1.0], #tyokusen4 ||| [-67.5, -62, -47.5, -27.5, 1.0]before:[-67.0, -62, -47.5, -27.5, 1.0], #[-55, -35, 41, 46, 1.0], #Goal - [63.5, 65.0, 19.0, 39.0, 1.0], #shiyakusyo - [ 999, 999, 999, 999, 0.0] ]) # + [ 63.5, 65.0, 19.0, 39.0, 1.0], #shiyakusyo + [ 99.5, 101.0, 25.0, 45.0, 1.0], #dourotan1 + [177.0, 178.5, 25.0, 45.0, 1.0], #dourotan2 + [257.5, 277.5, -60.0, -58.5, 1.0], #singoumaeteisisen1 + [257.5, 277.5, -67.0, -65.5, 1.0], #singoumae1 + [256.5, 276.5, -87.5, -86.0, 1.0], #singoumaeteisisen2 + [270.0, 271.0, -99.0, -79.5, 1.0], #singoumae2 + [405.0, 425.0, -80.5, -79.5, 1.0], #ekimae oudanhodou1 + [405.0, 425.0, -71.0, -70.0, 1.0], #ekimae oudanhodou2 + [289.0, 290.0, -98.0, -78.0, 1.0], #singoumaeteisisen3 + [284.0, 285.0, -98.0, -78.0, 1.0], #singoumae3 + [259.5, 279.5, -83.0, -82.0, 1.0], #singoumaeteisisen4 + [259.5, 279.5, -80.0, -79.0, 1.0], #singoumae4 + [184.5, 186.0, 25.0, 45.0, 1.0], #dourotan3 + [107.0, 108.5, 25.0, 45.0, 1.0], #dourotan4 + [ 74.0, 94.0, -27.0, -26.0, 1.0], #GOAL!!!! + [ 999, 999, 999, 999, 0.0] ]) # self.stop_num = 0; #obs diff --git a/try_navigation/try_navigation/potential_astar.py b/try_navigation/try_navigation/potential_astar.py index 61ce66d..ace4fde 100644 --- a/try_navigation/try_navigation/potential_astar.py +++ b/try_navigation/try_navigation/potential_astar.py @@ -143,11 +143,6 @@ def __init__(self): self.left_obs_points = np.array([[],[],[]]) self.dot_obs_points = np.array([[],[],[]]) - # behind robot obs - self.self_radius = 0.8 - self.angle_min = -60 + 180 - self.angle_max = 60 + 180 - #DRIVE MODE self.functions_test = 0 #autonav:1 selfdrive:0 @@ -187,11 +182,12 @@ def __init__(self): [ 0, 0, 0, 0, 1, 0, 0, 0] # waypoint 21 GOAL!!!!!! ] - tukuba_obs_x =np.linspace(-45,25,860); - tukuba_obs_y =np.linspace(97,94,860); - tukuba_obs_z =np.linspace(0,0,860); - self.tsukuba_obs = np.array([tukuba_obs_x, tukuba_obs_y, tukuba_obs_z]); - + #tukuba_obs_x =np.linspace(-45,25,860); + #tukuba_obs_y =np.linspace(97,94,860); + #tukuba_obs_z =np.linspace(0,0,860); + #self.tsukuba_obs = np.array([tukuba_obs_x, tukuba_obs_y, tukuba_obs_z]); + self.tsukuba_obs = np.array([[],[],[]]) + ################# IGVC SelfDrive Quolification line stop test #20250530# ################# self.sd_line_stop_test = 0 @@ -362,7 +358,7 @@ def get_dot_obs(self, msg): #print(f"points ={points.shape}") self.dot_obs_points = np.vstack((points[0,:], points[1,:], points[2,:])) - + def potential_astar(self, msg): #print stamp message @@ -430,9 +426,9 @@ def potential_astar(self, msg): elif self.obs_info[self.waypoint_number][self.dotline_info] == 1: dot_line_local = localization_xyz(self.dot_obs_points, position_x, position_y, theta_x, theta_y, theta_z) - self_radius = self.self_radius - angle_min = self.angle_min - angle_max = self.angle_max + self_radius = 0.8 + angle_min = -60 + 180 + angle_max = 60 + 180 angles = np.linspace(np.radians(angle_min),np.radians(angle_max),100) x_radius = self_radius * np.cos(angles) y_radius = self_radius * np.sin(angles) @@ -449,6 +445,14 @@ def potential_astar(self, msg): else: relative_point_rot = np.array([[],[],[]]) """ + + # make map_obs x1 x2 y1 y2 + obs1 = make_obs(-45, 25, 97, 94) # siyakusyoura minami + obs2 = make_obs( 5, 21, 100, 101) # siyakusyoura kita + obs3 = make_obs(-73,-75, 105, 29) # siyakusyo nisi + + self.tsukuba_obs = np.hstack((obs1, obs2, obs3)) + #map_obs add if len(self.tsukuba_obs[0,:])>0: relative_point_x = self.tsukuba_obs[0,:] - self.position_x @@ -748,6 +752,11 @@ def path_msg(waypoints, stamp, parent_frame): wp_msg.poses.append(waypoint) return wp_msg +def make_obs(x1, x2, y1, y2, n=860, z=0): + x = np.linspace(x1, x2, n) + y = np.linspace(y1, y2, n) + z = np.full(n, z) + return np.array([x, y, z]) # mainという名前の関数です。C++のmain関数とは異なり、これは処理の開始地点ではありません。 def main(args=None): From 3e460abb0d6b305d076c5ab8aca5e21ea5c78dc6 Mon Sep 17 00:00:00 2001 From: kugurofu Date: Fri, 24 Oct 2025 08:41:41 +0000 Subject: [PATCH 17/25] add launch parameter --- orange_bringup/launch/orange_robot.launch.xml | 6 ++- .../orange_gnss/gnss_odom_publisher_ttyUSB.py | 9 ++++- pcd_convert/pcd_convert/pcd_rotation.py | 9 +++-- .../launch/try_navigation.launch.py | 20 ++++++++-- .../try_navigation/ekf_myself_gps.py | 40 +++++++++++++++++-- 5 files changed, 71 insertions(+), 13 deletions(-) diff --git a/orange_bringup/launch/orange_robot.launch.xml b/orange_bringup/launch/orange_robot.launch.xml index 37f5ec7..0c66fcc 100644 --- a/orange_bringup/launch/orange_robot.launch.xml +++ b/orange_bringup/launch/orange_robot.launch.xml @@ -110,14 +110,18 @@ --> - + + + + + - + @@ -119,9 +119,9 @@ - - - + + + - + - - - + + +