example packages
This commit is contained in:
@@ -1,82 +0,0 @@
|
||||
-- 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
|
||||
}
|
||||
}
|
@@ -3,19 +3,19 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
class Example_package {
|
||||
class Example_cpp {
|
||||
public:
|
||||
void run() {
|
||||
while (true) {
|
||||
// TODO: Implement node logic
|
||||
std::cout << "Running example_package" << std::endl;
|
||||
std::cout << "Running example_cpp" << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Example_package node;
|
||||
Example_cpp node;
|
||||
node.run();
|
||||
return 0;
|
||||
}
|
4
example/example_cpp/package.bellande
Normal file
4
example/example_cpp/package.bellande
Normal file
@@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- common_msgs
|
||||
language: cpp
|
||||
name: ../exampleexample_cpp
|
@@ -6,17 +6,17 @@ import (
|
||||
"common_msgs"
|
||||
)
|
||||
|
||||
type Example_package struct{}
|
||||
type Example_go struct{}
|
||||
|
||||
func (n *Example_package) Run() {
|
||||
func (n *Example_go) Run() {
|
||||
for {
|
||||
// TODO: Implement node logic
|
||||
fmt.Println("Running example_package")
|
||||
fmt.Println("Running example_go")
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
node := &Example_package{}
|
||||
node := &Example_go{}
|
||||
node.Run()
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
dependencies:
|
||||
- common_msgs
|
||||
language: go
|
||||
name: example_package
|
||||
name: ../exampleexample_go
|
@@ -1,10 +1,10 @@
|
||||
import common_msgs.Messages.*;
|
||||
|
||||
public class Example_package {
|
||||
public class Example_java {
|
||||
public void run() {
|
||||
while (true) {
|
||||
// TODO: Implement node logic
|
||||
System.out.println("Running example_package");
|
||||
System.out.println("Running example_java");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -14,7 +14,7 @@ public class Example_package {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Example_package node = new Example_package();
|
||||
Example_java node = new Example_java();
|
||||
node.run();
|
||||
}
|
||||
}
|
4
example/example_java/package.bellande
Normal file
4
example/example_java/package.bellande
Normal file
@@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- common_msgs
|
||||
language: java
|
||||
name: ../exampleexample_java
|
@@ -1,13 +1,13 @@
|
||||
from common_msgs import *
|
||||
import time
|
||||
|
||||
class Example_package:
|
||||
class Example_python:
|
||||
def run(self):
|
||||
while True:
|
||||
# TODO: Implement node logic
|
||||
print(f"Running example_package")
|
||||
print(f"Running example_python")
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
node = Example_package()
|
||||
node = Example_python()
|
||||
node.run()
|
4
example/example_python/package.bellande
Normal file
4
example/example_python/package.bellande
Normal file
@@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- common_msgs
|
||||
language: python
|
||||
name: ../exampleexample_python
|
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "example_package"
|
||||
name = "example_rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
@@ -1,19 +1,19 @@
|
||||
use common_msgs::*;
|
||||
use std::{thread, time};
|
||||
|
||||
struct Example_package;
|
||||
struct Example_rust;
|
||||
|
||||
impl Example_package {
|
||||
impl Example_rust {
|
||||
fn run(&self) {
|
||||
loop {
|
||||
// TODO: Implement node logic
|
||||
println!("Running example_package");
|
||||
println!("Running example_rust");
|
||||
thread::sleep(time::Duration::from_secs(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let node = Example_package{};
|
||||
let node = Example_rust{};
|
||||
node.run();
|
||||
}
|
4
example/example_rust/package.bellande
Normal file
4
example/example_rust/package.bellande
Normal file
@@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- common_msgs
|
||||
language: rust
|
||||
name: ../exampleexample_rust
|
@@ -1,14 +1,14 @@
|
||||
# Example Package for CPP
|
||||
python3 ../src/brsoa_create_package.py ../example example_package cpp
|
||||
# Example Package for Cpp
|
||||
python3 ../src/brsoa_create_package.py ../example example_cpp cpp
|
||||
|
||||
# Example Package for Python
|
||||
python3 ../src/brsoa_create_package.py ../example example_package python
|
||||
python3 ../src/brsoa_create_package.py ../example example_python python
|
||||
|
||||
# Example Package for Java
|
||||
python3 ../src/brsoa_create_package.py ../example example_package java
|
||||
python3 ../src/brsoa_create_package.py ../example example_java java
|
||||
|
||||
# Example Package for Rust
|
||||
python3 ../src/brsoa_create_package.py ../example example_package rust
|
||||
python3 ../src/brsoa_create_package.py ../example example_rust rust
|
||||
|
||||
# Example Package for Go
|
||||
python3 ../src/brsoa_create_package.py ../example example_package go
|
||||
python3 ../src/brsoa_create_package.py ../example example_go go
|
||||
|
@@ -147,7 +147,7 @@ def create_package(directory, package_name, language):
|
||||
|
||||
# Create package.bellande
|
||||
with open(os.path.join(package_dir, "package.bellande"), "w") as f:
|
||||
f.write(create_package_bellande(package_name, language, ["common_msgs"]))
|
||||
f.write(create_package_bellande(directory+package_name, language, ["common_msgs"]))
|
||||
|
||||
# Create source file
|
||||
source_creators = {
|
||||
@@ -169,9 +169,10 @@ def create_package(directory, package_name, language):
|
||||
source_filename = f"{package_name.capitalize()}.java"
|
||||
elif language == "rust":
|
||||
source_filename = f"{package_name}.rust"
|
||||
os.makedirs(os.path.join(package_dir, "src"), exist_ok=True)
|
||||
|
||||
with open(os.path.join(package_dir, "Cargo.toml"), "w") as f:
|
||||
f.write(f"[package]\nname = \"{package_name}\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\ncommon_msgs = {{ path = \"../../build/common_msgs\" }}\n")
|
||||
|
||||
elif language == "go":
|
||||
source_filename = f"{package_name}.go"
|
||||
|
||||
|
Reference in New Issue
Block a user