fix: change pid_config.json default path to data/ directory
This commit is contained in:
@@ -25,7 +25,7 @@ class WebNode(Node):
|
|||||||
String, '/web/pid_config', 10
|
String, '/web/pid_config', 10
|
||||||
)
|
)
|
||||||
|
|
||||||
self.declare_parameter('pid_config_file', 'pid_config.json')
|
self.declare_parameter('pid_config_file', 'data/pid_config.json')
|
||||||
self._pid_config_file = self.get_parameter('pid_config_file').value
|
self._pid_config_file = self.get_parameter('pid_config_file').value
|
||||||
self._pid_config = self._load_pid_config()
|
self._pid_config = self._load_pid_config()
|
||||||
|
|
||||||
@@ -131,6 +131,7 @@ class WebNode(Node):
|
|||||||
|
|
||||||
def _save_pid_config(self):
|
def _save_pid_config(self):
|
||||||
try:
|
try:
|
||||||
|
os.makedirs(os.path.dirname(self._pid_config_file), exist_ok=True)
|
||||||
with open(self._pid_config_file, 'w') as f:
|
with open(self._pid_config_file, 'w') as f:
|
||||||
json.dump(self._pid_config, f, indent=2)
|
json.dump(self._pid_config, f, indent=2)
|
||||||
self.get_logger().info(
|
self.get_logger().info(
|
||||||
|
|||||||
Reference in New Issue
Block a user