Skip to content

Commit

Permalink
feat: Make the voraus.core OPC UA endpoint configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-caspers committed Oct 14, 2024
1 parent 8a6c163 commit 98ead6d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ fn main() -> Result<(), RclrsError> {
let ros_node_copy_spin = Arc::clone(&ros_node);
let ros_node_copy_service = Arc::clone(&ros_node);

let opc_ua_client = Arc::new(Mutex::new(OPCUAClient::new("opc.tcp://127.0.0.1:48401")));
let env_var_name = "VORAUS_CORE_OPC_UA_ENDPOINT";
let voraus_core_opc_ua_endpoint = match env::var(env_var_name) {
Ok(val) => val,
Err(_) => "opc.tcp://127.0.0.1:48401".to_string(),
};
let opc_ua_client = Arc::new(Mutex::new(OPCUAClient::new(voraus_core_opc_ua_endpoint)));
let Ok(_connection_result) = opc_ua_client.lock().unwrap().connect() else {
panic!("Connection could not be established, but is required.");
};
Expand Down

0 comments on commit 98ead6d

Please sign in to comment.