Skip to content

Commit 52f25b1

Browse files
committed
Fixed Python Linting checks
1 parent fc8534a commit 52f25b1

49 files changed

Lines changed: 209 additions & 200 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CustomRobots/car_junction/launch/car_junction.launch.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,26 @@ def generate_launch_description():
2222

2323
# Set the path to the SDF model files.
2424
gazebo_models_path = os.path.join(pkg_share, "models")
25-
os.environ[
26-
"GAZEBO_MODEL_PATH"
27-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28-
29-
start_ros_gazebo_bridge = Node(
30-
package="ros_gz_bridge",
31-
executable="parameter_bridge",
32-
arguments=[
33-
"/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock",
34-
"/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist",
35-
"/odom@nav_msgs/msg/Odometry]gz.msgs.Odometry",
36-
"/waymo/lidar/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked",
37-
"/waymo/camera_info@sensor_msgs/msg/CameraInfo[gz.msgs.CameraInfo",
38-
],
39-
parameters=[{'use_sim_time': True}],
40-
output="screen"
41-
),
42-
25+
os.environ["GAZEBO_MODEL_PATH"] = (
26+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
27+
)
28+
29+
start_ros_gazebo_bridge = (
30+
Node(
31+
package="ros_gz_bridge",
32+
executable="parameter_bridge",
33+
arguments=[
34+
"/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock",
35+
"/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist",
36+
"/odom@nav_msgs/msg/Odometry]gz.msgs.Odometry",
37+
"/waymo/lidar/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked",
38+
"/waymo/camera_info@sensor_msgs/msg/CameraInfo[gz.msgs.CameraInfo",
39+
],
40+
parameters=[{"use_sim_time": True}],
41+
output="screen",
42+
),
43+
)
44+
4345
start_ros_gazebo_image_bridge = Node(
4446
package="ros_gz_image",
4547
executable="image_bridge",

CustomRobots/car_junction/scripts/TrafficSystem.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import numpy as np
1111

1212

13-
1413
class CarSpawner(object):
1514
def __init__(self):
1615
self.node = Node()
@@ -23,22 +22,23 @@ def __init__(self):
2322
self.spawn_positions = [
2423
(2, -20.0, 1.5, 1.57),
2524
(-2, 20.0, 1.5, -1.57),
26-
(20.0, 2, 1.5, 3.14)
25+
(20.0, 2, 1.5, 3.14),
2726
]
27+
2828
def update(self, info, _ecm):
2929
current_time = time.time()
30-
30+
3131
# Spawn new car
3232
if current_time - self.last_spawn > self.spawn_interval:
3333
coords = random.choice(self.spawn_positions)
3434
model_name = f"car_{random.randint(1000,9999)}"
35-
36-
yaw=coords[3]
35+
36+
yaw = coords[3]
3737
qx, qy, qz, qw = etoq(yaw, 0, 0)
38-
38+
3939
req = EntityFactory()
40-
41-
req.relative_to = ''
40+
41+
req.relative_to = ""
4242
req.sdf_filename = self.sdf_path
4343
req.name = model_name
4444
req.pose.position.x = coords[0]
@@ -48,11 +48,11 @@ def update(self, info, _ecm):
4848
req.pose.orientation.x = qx
4949
req.pose.orientation.y = qy
5050
req.pose.orientation.z = qz
51-
51+
5252
self.node.request(
53-
f"/world/{self.world}/create",
54-
req, EntityFactory, Boolean, 1000)
55-
53+
f"/world/{self.world}/create", req, EntityFactory, Boolean, 1000
54+
)
55+
5656
self.active_models[model_name] = current_time
5757
self.last_spawn = current_time
5858
print(f"Spawned {model_name}")
@@ -63,25 +63,30 @@ def update(self, info, _ecm):
6363
self.node.request(
6464
f"/world/{self.world}/remove",
6565
Entity(name=name, type=Entity.MODEL),
66-
Entity, Boolean, 1000)
66+
Entity,
67+
Boolean,
68+
1000,
69+
)
6770
del self.active_models[name]
6871
print(f"Removed {name}")
6972

73+
7074
def etoq(yaw, pitch, roll):
71-
72-
cy = np.cos(yaw * 0.5)
73-
sy = np.sin(yaw * 0.5)
74-
cp = np.cos(pitch * 0.5)
75-
sp = np.sin(pitch * 0.5)
76-
cr = np.cos(roll * 0.5)
77-
sr = np.sin(roll * 0.5)
7875

79-
qw = cr * cp * cy + sr * sp * sy
80-
qx = sr * cp * cy - cr * sp * sy
81-
qy = cr * sp * cy + sr * cp * sy
82-
qz = cr * cp * sy - sr * sp * cy
76+
cy = np.cos(yaw * 0.5)
77+
sy = np.sin(yaw * 0.5)
78+
cp = np.cos(pitch * 0.5)
79+
sp = np.sin(pitch * 0.5)
80+
cr = np.cos(roll * 0.5)
81+
sr = np.sin(roll * 0.5)
82+
83+
qw = cr * cp * cy + sr * sp * sy
84+
qx = sr * cp * cy - cr * sp * sy
85+
qy = cr * sp * cy + sr * cp * sy
86+
qz = cr * cp * sy - sr * sp * cy
87+
88+
return qx, qy, qz, qw
8389

84-
return qx, qy, qz, qw
8590

8691
def get_system():
87-
return CarSpawner()
92+
return CarSpawner()

Launchers/3d_reconstruction.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def generate_launch_description():
2323

2424
# Set the path to the SDF model files.
2525
gazebo_models_path = os.path.join(pkg_share, "models")
26-
os.environ[
27-
"GAZEBO_MODEL_PATH"
28-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
26+
os.environ["GAZEBO_MODEL_PATH"] = (
27+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28+
)
2929

3030
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
3131
# Launch configuration variables specific to simulation

Launchers/amazon_robot.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def generate_launch_description():
2323

2424
# Set the path to the SDF model files.
2525
gazebo_models_path = os.path.join(pkg_share, "models")
26-
os.environ[
27-
"GAZEBO_MODEL_PATH"
28-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
26+
os.environ["GAZEBO_MODEL_PATH"] = (
27+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28+
)
2929

3030
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
3131
# Launch configuration variables specific to simulation

Launchers/car_junction.launch.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,26 @@ def generate_launch_description():
2222

2323
# Set the path to the SDF model files.
2424
gazebo_models_path = os.path.join(pkg_share, "models")
25-
os.environ[
26-
"GAZEBO_MODEL_PATH"
27-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28-
29-
start_ros_gazebo_bridge = Node(
30-
package="ros_gz_bridge",
31-
executable="parameter_bridge",
32-
arguments=[
33-
"/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock",
34-
"/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist",
35-
"/odom@nav_msgs/msg/Odometry]gz.msgs.Odometry",
36-
"/waymo/lidar/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked",
37-
"/waymo/camera_info@sensor_msgs/msg/CameraInfo[gz.msgs.CameraInfo",
38-
],
39-
parameters=[{'use_sim_time': True}],
40-
output="screen"
41-
),
42-
25+
os.environ["GAZEBO_MODEL_PATH"] = (
26+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
27+
)
28+
29+
start_ros_gazebo_bridge = (
30+
Node(
31+
package="ros_gz_bridge",
32+
executable="parameter_bridge",
33+
arguments=[
34+
"/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock",
35+
"/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist",
36+
"/odom@nav_msgs/msg/Odometry]gz.msgs.Odometry",
37+
"/waymo/lidar/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked",
38+
"/waymo/camera_info@sensor_msgs/msg/CameraInfo[gz.msgs.CameraInfo",
39+
],
40+
parameters=[{"use_sim_time": True}],
41+
output="screen",
42+
),
43+
)
44+
4345
start_ros_gazebo_image_bridge = Node(
4446
package="ros_gz_image",
4547
executable="image_bridge",

Launchers/follow_person.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def generate_launch_description():
4343

4444
# Set the path to the SDF model files
4545
gazebo_models_path = os.path.join(pkg_share_dir, "models")
46-
os.environ[
47-
"GAZEBO_MODEL_PATH"
48-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
46+
os.environ["GAZEBO_MODEL_PATH"] = (
47+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
48+
)
4949

5050
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
5151
# Launch configuration variables specific to simulation

Launchers/follow_person_followingcam.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def generate_launch_description():
4343

4444
# Set the path to the SDF model files
4545
gazebo_models_path = os.path.join(pkg_share_dir, "models")
46-
os.environ[
47-
"GAZEBO_MODEL_PATH"
48-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
46+
os.environ["GAZEBO_MODEL_PATH"] = (
47+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
48+
)
4949

5050
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
5151
# Launch configuration variables specific to simulation

Launchers/follow_person_teleop.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def generate_launch_description():
4343

4444
# Set the path to the SDF model files
4545
gazebo_models_path = os.path.join(pkg_share_dir, "models")
46-
os.environ[
47-
"GAZEBO_MODEL_PATH"
48-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
46+
os.environ["GAZEBO_MODEL_PATH"] = (
47+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
48+
)
4949

5050
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
5151
# Launch configuration variables specific to simulation

Launchers/gas_station_battery.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def generate_launch_description():
2323

2424
# Set the path to the SDF model files.
2525
gazebo_models_path = os.path.join(pkg_share, "models")
26-
os.environ[
27-
"GAZEBO_MODEL_PATH"
28-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
26+
os.environ["GAZEBO_MODEL_PATH"] = (
27+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28+
)
2929

3030
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
3131
# Launch configuration variables specific to simulation

Launchers/gas_station_battery_ackermann.launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def generate_launch_description():
2323

2424
# Set the path to the SDF model files.
2525
gazebo_models_path = os.path.join(pkg_share, "models")
26-
os.environ[
27-
"GAZEBO_MODEL_PATH"
28-
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
26+
os.environ["GAZEBO_MODEL_PATH"] = (
27+
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28+
)
2929

3030
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
3131
# Launch configuration variables specific to simulation

0 commit comments

Comments
 (0)