Skip to content

Commit 8d51fc6

Browse files
committed
improve YAML path
1 parent eb41880 commit 8d51fc6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

homework/blink.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import rospy
22
import yaml
3+
import os
34
from std_msgs.msg import String, Bool, Float32, Float64
45
from pacmod_msgs.msg import PositionWithSpeed, PacmodCmd, SystemRptInt, SystemRptFloat, VehicleSpeedRpt
56

@@ -24,7 +25,9 @@ def __init__(self):
2425
# check update file good
2526

2627
# Load settings
27-
with open("./config/settings.yaml", "r") as file:
28+
29+
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../config/settings.yaml")
30+
with open(config_path, "r") as file:
2831
self.settings = yaml.safe_load(file)
2932

3033
# Assign constants from settings

0 commit comments

Comments
 (0)