Files
bellande_robotic_system_ope…/src/brsoa_create_system_config.py
2025-05-24 14:27:46 -04:00

135 lines
3.7 KiB
Python

# Copyright (C) 2025 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
# Will later be programming bellronos
def create_lua_config_file(filename="brsoa_system_config.lua"):
"""
Creates an example Lua configuration file for a robot system with generic settings.
Args:
filename (str): The name of the file to create
Returns:
bool: True if file creation was successful
"""
# Configuration content with generic example values
config_content = """-- brsoa_system_config.lua
-- Global configuration
global_config = {
max_nodes = 50,
discovery_method = "broadcast",
system_name = "example_system",
log_level = "debug"
}
-- Define nodes to be launched
nodes = {
{
name = "example_node_cpp",
package = "example_package_cpp",
executable = "example_driver_cpp",
language = "cpp",
args = {"--fps=30"},
env = {SENSOR_TYPE = "lidar"}
},
{
name = "example_node_py",
package = "example_package_py",
executable = "example_package_py.py",
language = "python",
args = {"--algorithm=detection"},
env = {PYTHONPATH = "${WORKSPACE}/lib:${WORKSPACE}/include"}
},
{
name = "example_node_java",
package = "example_ui_package_java",
executable = "ExampleDisplayAppJava",
language = "java",
args = {"--resolution=720p"},
env = {JAVA_OPTS = "-Xmx1g"}
},
{
name = "example_node_rust",
package = "example_package_rust",
executable = "example_package_rust",
language = "rust",
args = {"--mode=manual"},
env = {RUST_BACKTRACE = "1"}
},
{
name = "example_node_bridge_go",
package = "example_package_go",
executable = "example_package_go",
language = "go",
args = {"--port=9090"},
env = {GOMAXPROCS = "2"}
}
}
-- Define communication setup
topics = {
{
name = "/example/example",
type = "Example",
queue_size = 5,
publishers = {"example_node"},
subscribers = {"example1", "example2"}
}
}
-- Define services
services = {
{
name = "/example/example",
type = "Example",
server = "example_server",
clients = {"example_client"}
}
}
-- Define parameters
parameters = {
{
name = "/example/example",
type = "string",
value = global_config.system_name
}
}"""
try:
# Write the configuration to the file
with open(filename, 'w') as file:
file.write(config_content)
print(f"Successfully created example file {filename}")
return True
except Exception as e:
print(f"Error creating file: {e}")
return False
def create_bellande_config_file():
pass
if __name__ == "__main__":
# Create the example Lua configuration file
success = create_lua_config_file()
if success:
print("Example configuration file creation completed.")
else:
print("Failed to create example configuration file.")