Skip to content

Commit 32da91c

Browse files
merged
1 parent 65df967 commit 32da91c

5 files changed

Lines changed: 94 additions & 48 deletions

File tree

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,11 @@ cython_debug/
165165
# and can be added to the global gitignore or merged into this file. For a more nuclear
166166
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
167167
#.idea/
168+
169+
.vscode/
170+
ZED_SDK_Ubuntu20_cuda11.8_v4.0.8.zstd.run
171+
onedrive_config.json
172+
ros.asc
173+
scenes/gazebo.yaml
174+
zed_sdk.run
175+
Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,55 @@
1+
0.0 , 0.0
2+
-0.010000000000000009 , 0.0
3+
-0.020000000000000018 , 0.0
14
-0.030000000000000027 , 0.0
2-
-0.1499999999999999 , 0.010000000000001563
3-
-0.45999999999999996 , 0.010000000000001563
4-
-0.9300000000000002 , 0.019999999999999574
5-
-1.7200000000000002 , 0.030000000000001137
6-
-3.7699999999999996 , 0.05000000000000071
7-
-4.98 , 0.05999999999999872
8-
-7.029999999999999 , 0.0799999999999983
9-
-8.33 , 0.08999999999999986
10-
-9.84 , 0.10999999999999943
11-
-12.61 , 0.14000000000000057
12-
-14.14 , 0.14999999999999858
13-
-15.510000000000002 , 0.1700000000000017
14-
-18.48 , 0.21000000000000085
15-
-19.85 , 0.23000000000000043
16-
-21.07 , 0.23999999999999844
17-
-22.54 , 0.26000000000000156
18-
-24.29 , 0.23000000000000043
19-
-26.47 , -0.05000000000000071
20-
-28.84 , -0.8399999999999999
21-
-31.049999999999997 , -2.34
22-
-32.37 , -4.870000000000001
23-
-32.12 , -7.75
24-
-30.13 , -9.96
25-
-27.68 , -10.510000000000002
26-
-25.19 , -9.71
27-
-23.15 , -7.629999999999999
28-
-21.85 , -4.699999999999999
29-
-21.25 , -0.9699999999999989
30-
-21.86 , 0.7800000000000011
31-
-21.94 , 1.0700000000000003
32-
-21.91 , 0.8500000000000014
5+
-0.050000000000000044 , 0.0
6+
-0.09000000000000008 , 0.0
7+
-0.15999999999999992 , 0.0
8+
-0.26 , 0.0
9+
-0.3999999999999999 , 0.0
10+
-0.6100000000000001 , 0.0
11+
-0.9099999999999999 , 0.0
12+
-1.2899999999999998 , 0.0
13+
-1.7 , 0.0
14+
-2.1100000000000003 , 0.0
15+
-2.49 , 0.0
16+
-2.8900000000000006 , 0.0
17+
-3.38 , 0.0
18+
-3.96 , 0.0
19+
-4.63 , 0.0
20+
-5.4 , 0.0
21+
-6.21 , 0.0
22+
-6.98 , 0.0
23+
-7.790000000000001 , 0.0
24+
-8.67 , 0.0
25+
-9.61 , 0.0
26+
-10.63 , 0.0
27+
-11.69 , 0.0
28+
-12.700000000000001 , 0.0
29+
-13.78 , 0.0
30+
-14.9 , 0.0
31+
-16.049999999999997 , 0.010000000000001563
32+
-17.209999999999997 , 0.010000000000001563
33+
-18.34 , 0.010000000000001563
34+
-19.459999999999997 , 0.010000000000001563
35+
-20.56 , 0.010000000000001563
36+
-21.599999999999998 , 0.010000000000001563
37+
-22.599999999999998 , 0.019999999999999574
38+
-23.56 , 0.019999999999999574
39+
-24.47 , 0.019999999999999574
40+
-25.36 , 0.019999999999999574
41+
-26.24 , 0.019999999999999574
42+
-27.029999999999998 , 0.010000000000001563
43+
-27.799999999999997 , -0.030000000000001137
44+
-28.529999999999998 , -0.10999999999999943
45+
-29.18 , -0.25
46+
-29.779999999999998 , -0.4800000000000004
47+
-31.529999999999998 , -0.17999999999999972
48+
-33.82 , -1.2399999999999984
49+
-35.03 , -3.0799999999999983
50+
-35.34 , -5.609999999999999
51+
-33.6 , -8.440000000000001
52+
-30.55 , -9.5
53+
-28.25 , -8.219999999999999
54+
-26.439999999999998 , -4.300000000000001
55+
-24.47 , -1.1499999999999986

GEMstack/onboard/interface/gem_gazebo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,12 @@ def quaternion_to_euler(x, y, z, w):
620620
msg = AckermannDrive()
621621
msg.acceleration = acceleration
622622
msg.speed = float('inf') if acceleration >0 else 0 #acceleration * self.dt
623-
msg.steering_angle = -phides
624-
msg.steering_angle_velocity = -steering_angle_rate
623+
msg.steering_angle = phides
624+
msg.steering_angle_velocity = steering_angle_rate
625625

626626

627-
self.ackermann_pub.publish(msg)
628-
rospy.loginfo(f"Published AckermannDrive: {msg}")
627+
#self.ackermann_pub.publish(msg)
628+
#rospy.loginfo(f"Published AckermannDrive: {msg}")
629629
self.last_command = command
630630

631631

GEMstack/onboard/planning/pure_pursuit.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
from ..interface.gem import GEMVehicleCommand
99
from ..component import Component
1010
import numpy as np
11+
import rospy
12+
from ackermann_msgs.msg import AckermannDrive
13+
1114

1215
class PurePursuit(object):
1316
"""Implements a pure pursuit controller on a second-order Dubins vehicle."""
@@ -39,6 +42,7 @@ def __init__(self, lookahead = None, lookahead_scale = None, crosstrack_gain = N
3942
self.current_traj_parameter = 0.0
4043
self.t_last = None
4144

45+
4246
def set_path(self, path : Path):
4347
if path == self.path_arg:
4448
return
@@ -91,8 +95,8 @@ def compute(self, state : VehicleState, component : Component = None):
9195
#(rather than just advancing the parameter)
9296
des_parameter = closest_parameter + self.look_ahead + self.look_ahead_scale * speed
9397
print("Closest parameter: " + str(closest_parameter),"distance to path",closest_dist)
94-
if closest_dist > 0.1:
95-
print("Closest point",self.path.eval(closest_parameter),"vs",(curr_x,curr_y))
98+
#if closest_dist > 0.1:
99+
rospy.loginfo(f"Closest point {self.path.eval(closest_parameter)} vs ,{(curr_x,curr_y)}")
96100
if des_parameter >= self.path.domain()[1]:
97101
#we're at the end of the path, calculate desired point by extrapolating from the end of the path
98102
end_pt = self.path.points[-1]
@@ -106,7 +110,7 @@ def compute(self, state : VehicleState, component : Component = None):
106110
desired_x,desired_y = self.path.eval(des_parameter)
107111
desired_yaw = np.arctan2(desired_y-curr_y,desired_x-curr_x)
108112
#print("Desired point",(desired_x,desired_y)," with lookahead distance",self.look_ahead + self.look_ahead_scale * speed)
109-
#print("Current yaw",curr_yaw,"desired yaw",desired_yaw)
113+
print("Current yaw",curr_yaw,"desired yaw",desired_yaw)
110114

111115
# distance between the desired point and the vehicle
112116
L = transforms.vector2_dist((desired_x,desired_y),(curr_x,curr_y))
@@ -127,8 +131,8 @@ def compute(self, state : VehicleState, component : Component = None):
127131
#print("Closest point distance: " + str(L))
128132
print("Forward velocity: " + str(speed))
129133
ct_error = np.sin(alpha) * L
130-
print("Crosstrack Error: " + str(round(ct_error,3)))
131-
print("Front wheel angle: " + str(round(np.degrees(f_delta),2)) + " degrees")
134+
#print("Crosstrack Error: " + str(round(ct_error,3)))
135+
#print("Front wheel angle: " + str(round(np.degrees(f_delta),2)) + " degrees")
132136
steering_angle = np.clip(front2steer(f_delta), self.steering_angle_range[0], self.steering_angle_range[1])
133137
print("Steering wheel angle: " + str(round(np.degrees(steering_angle),2)) + " degrees" )
134138

@@ -194,6 +198,7 @@ class PurePursuitTrajectoryTracker(Component):
194198
def __init__(self,vehicle_interface=None, **args):
195199
self.pure_pursuit = PurePursuit(**args)
196200
self.vehicle_interface = vehicle_interface
201+
self.ackermann_pub = rospy.Publisher("ackermann_cmd", AckermannDrive, queue_size=1)
197202

198203
def rate(self):
199204
return 50.0
@@ -207,10 +212,20 @@ def state_outputs(self):
207212
def update(self, vehicle : VehicleState, trajectory: Trajectory):
208213
self.pure_pursuit.set_path(trajectory)
209214
accel,wheel_angle = self.pure_pursuit.compute(vehicle, self)
210-
#print("Desired wheel angle",wheel_angle)
215+
print("Desired wheel angle",wheel_angle)
211216
steering_angle = np.clip(front2steer(wheel_angle), self.pure_pursuit.steering_angle_range[0], self.pure_pursuit.steering_angle_range[1])
212217
#print("Desired steering angle",steering_angle)
213-
self.vehicle_interface.send_command(self.vehicle_interface.simple_command(accel,steering_angle, vehicle))
218+
#rospy.loginfo(f"accel from pure pursuit {wheel_angle}")
219+
220+
msg = AckermannDrive()
221+
msg.acceleration = accel
222+
msg.speed = 3#float('inf') if accel >0 else 0 #acceleration * self.dt
223+
msg.steering_angle = wheel_angle
224+
#msg.steering_angle_velocity = steering_angle_rate
225+
226+
self.ackermann_pub.publish(msg)
227+
228+
#self.vehicle_interface.send_command(self.vehicle_interface.simple_command(accel,steering_angle, vehicle))
214229

215230
def healthy(self):
216231
return self.pure_pursuit.path is not None

launch/gazebo_simulation.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ recovery:
1313
drive:
1414
perception:
1515
state_estimation : GNSSStateEstimator
16-
agent_detection : object_detection.ObjectDetection
16+
#agent_detection : object_detection.ObjectDetection
1717
planning:
1818
# relations_estimation: pedestrian_yield_logic.PedestrianYielder
1919
# route_planning:
@@ -74,14 +74,14 @@ variants:
7474

7575
planning:
7676
route_planning:
77-
# type: StaticRoutePlanner
78-
# args: [!relative_path '../GEMstack/knowledge/routes/gazebo.csv']
77+
type: StaticRoutePlanner
78+
args: [!relative_path '../GEMstack/knowledge/routes/gazebo.csv']
7979
motion_planning:
80-
# type: RouteToTrajectoryPlanner
80+
type: RouteToTrajectoryPlanner
8181
# args: [null] #desired speed in m/s. If null, this will keep the route untimed for the trajectory tracker
8282
trajectory_tracking:
83-
# type: pure_pursuit.PurePursuitTrajectoryTracker
84-
# args: {desired_speed: 2.5} #approximately 5mph
83+
type: pure_pursuit.PurePursuitTrajectoryTracker
84+
args: {desired_speed: 2.5} #approximately 5mph
8585
# print: False
8686
# visualization: !include "klampt_visualization.yaml"
8787
# visualization: !include "mpl_visualization.yaml"

0 commit comments

Comments
 (0)