diff --git a/.lil/rpanion.local/.DS_Store b/.lil/rpanion.local/.DS_Store new file mode 100644 index 000000000..118ae06dc Binary files /dev/null and b/.lil/rpanion.local/.DS_Store differ diff --git a/.lil/rpanion.local/logs/.DS_Store b/.lil/rpanion.local/logs/.DS_Store new file mode 100644 index 000000000..21ea0323c Binary files /dev/null and b/.lil/rpanion.local/logs/.DS_Store differ diff --git a/ansible/playbooks/collect_lil_logs.yml b/ansible/playbooks/collect_lil_logs.yml new file mode 100644 index 000000000..7b7e1ea88 --- /dev/null +++ b/ansible/playbooks/collect_lil_logs.yml @@ -0,0 +1,35 @@ +--- +- name: Collect and clear .lil log folders from remote hosts + hosts: myhosts + become: yes + + tasks: + - name: Create local .lil directory if it doesn't exist + become: no + delegate_to: localhost + file: + path: "{{ lookup('env','PWD') }}/.lil" + state: directory + mode: '0755' + + - name: Copy remote .lil log folder to local machine + become: no + delegate_to: localhost + synchronize: + src: /lil-hopps/.lil/ + dest: "{{ lookup('env','PWD') }}/.lil/{{ inventory_hostname }}/" + mode: pull + recursive: yes + + - name: Remove contents of remote .lil log folder + file: + path: /lil-hopps/.lil/ + state: absent + + - name: Recreate remote .lil log folder + file: + path: /lil-hopps/.lil/ + state: directory + mode: '0777' + owner: pi + group: pi \ No newline at end of file diff --git a/ansible/playbooks/deploy_quad_idle.yml b/ansible/playbooks/deploy_quad_idle.yml index cafd2a331..0c5bf4811 100644 --- a/ansible/playbooks/deploy_quad_idle.yml +++ b/ansible/playbooks/deploy_quad_idle.yml @@ -44,8 +44,10 @@ [Service] Type=simple - ExecStart=/lil-hopps/quad_idle - Restart=on-failure + Environment="LIL_DIR=." + WorkingDirectory=/lil-hopps + ExecStart=/lil-hopps/quad_idle -c serial:/dev/serial0:115200 --hz 15 -s 0.0.0.0:7777 + Restart=always User=root [Install] @@ -57,7 +59,7 @@ systemd: name: quad_idle enabled: yes - state: stopped + state: started daemon_reload: yes handlers: - name: Reload systemd diff --git a/lil-gcs/src/main.rs b/lil-gcs/src/main.rs index 0e46ab360..fe81cea20 100644 --- a/lil-gcs/src/main.rs +++ b/lil-gcs/src/main.rs @@ -106,8 +106,8 @@ fn parse_message(message: &str) -> (String, Vec) { #[tokio::main] async fn main() { - let (tcp_tx, _) = broadcast::channel(4); - let (ws_tx, mut ws_rx) = mpsc::channel(32); + let (tcp_tx, _) = broadcast::channel(512); + let (ws_tx, mut ws_rx) = mpsc::channel(512); // Spawn WebSocket server task tokio::spawn(webserver::websocket_server_task(tcp_tx.clone(), ws_tx)); @@ -303,13 +303,14 @@ async fn main() { tokio::spawn(async move { loop { // thread::sleep(Duration::from_secs_f32(2.0)); - tokio::time::sleep(Duration::from_millis(200)).await; + tokio::time::sleep(Duration::from_millis(250)).await; { let mut map = subscriber_handle_clone.lock().unwrap(); - - if !map.update.is_empty() { - let data = map - .update + let updates= map.update.clone(); + map.update.clear(); + drop(map); + if !updates.is_empty() { + let data = updates .iter() .map(|(topic, datapoint)| DataLine { topic: topic.to_string(), @@ -317,8 +318,7 @@ async fn main() { }) .collect::>(); - map.update.clear(); - + let message = WebMessage { timestamp: get_current_timestamp(), data, @@ -330,12 +330,14 @@ async fn main() { warn!("Failed to MsgPack the DataStore Map") } } + + } } }); let datastore = datastore.clone(); loop { - tokio::time::sleep(Duration::from_millis(100)).await; + tokio::time::sleep(Duration::from_millis(50)).await; datastore.lock().unwrap().run_sync(); } } diff --git a/lil-launcher/bin_tests/quad_idle.rs b/lil-launcher/bin_tests/quad_idle.rs index 4f381d730..284262fc9 100644 --- a/lil-launcher/bin_tests/quad_idle.rs +++ b/lil-launcher/bin_tests/quad_idle.rs @@ -26,6 +26,7 @@ use clap::Parser; use victory_broker::adapters::tcp::TCPServerAdapter; use victory_broker::adapters::tcp::TCPServerOptions; use victory_commander::system::runner::BasherSysRunner; +use victory_data_store::database::retention::RetentionPolicy; use victory_data_store::primitives::Primitives; use victory_data_store::sync::adapters::tcp::tcp_server::TcpSyncServer; use victory_data_store::sync::config::SyncConfig; @@ -51,7 +52,6 @@ struct SILArgs { )] duration: f32, - #[clap(short, long, value_parser, help = "TCP Sync Server address")] sync_server_address: String, @@ -75,7 +75,7 @@ async fn main() { .with_line_number(false) .without_time() .init(); - + let args = SILArgs::parse(); info!("Running 'quad_sil' with args: {:#?}", args); @@ -84,17 +84,26 @@ async fn main() { let server_handle = Arc::new(Mutex::new(server)); let topic_filter = TopicKey::from_str("cmd"); - + let sync_config = SyncConfig { client_name: "Quad Idle".to_string(), subscriptions: vec![topic_filter.display_name()], }; - runner.data_store + runner + .data_store .lock() .unwrap() .setup_sync(sync_config, server_handle); + let retention_policy = RetentionPolicy { + max_age: Some(Timespan::new_secs(30.0)), + max_rows: Some(64), + }; + runner.data_store.lock().unwrap().set_retention(retention_policy); + runner.dt = Timespan::new_hz(args.hz as f64); + runner.set_end_time(Timepoint::new_secs(60. * 15.)); + runner.add_system(Arc::new(Mutex::new( QuadlinkSystem::new_from_connection_string(args.connection_string.as_str()).unwrap(), @@ -104,11 +113,10 @@ async fn main() { check_ekf: Some(true), })))); - /* - runner.add_system(Arc::new(Mutex::new(RerunSystem::new( - "quad_arm".to_string(), - )))); - */ + runner.add_system(Arc::new(Mutex::new(RerunSystem::new( + "quad_idle".to_string(), + )))); + runner.set_real_time(true); runner.run(); } diff --git a/lil-launcher/bin_tests/quad_sil.rs b/lil-launcher/bin_tests/quad_sil.rs index 4019bfcd6..e8260db42 100644 --- a/lil-launcher/bin_tests/quad_sil.rs +++ b/lil-launcher/bin_tests/quad_sil.rs @@ -63,7 +63,7 @@ struct SILArgs { #[tokio::main] async fn main() { fmt() - .with_max_level(Level::INFO) + .with_max_level(Level::DEBUG) .with_target(true) .pretty() .compact() diff --git a/lil-rerun/src/system.rs b/lil-rerun/src/system.rs index 05a0ced90..2d2b65b44 100644 --- a/lil-rerun/src/system.rs +++ b/lil-rerun/src/system.rs @@ -118,13 +118,7 @@ impl System for RerunSystem { if let (Primitives::Float(roll), Primitives::Float(pitch), Primitives::Float(yaw)) = (roll, pitch, yaw) { - let (roll, pitch, yaw) = ( - roll * 180.0 / std::f64::consts::PI, - pitch * 180.0 / std::f64::consts::PI, - yaw * 180.0 / std::f64::consts::PI, - ); - let quat = UnitQuaternion::from_euler_angles(roll, pitch, yaw); - let quat = quat.quaternion(); + let quat = UnitQuaternion::from_euler_angles(*roll, *pitch, *yaw); rerun .log( "attitude", @@ -152,7 +146,9 @@ impl System for RerunSystem { fn get_subscribed_topics(&self) -> std::collections::BTreeSet { let mut topics = BTreeSet::new(); - topics.insert(TopicKey::empty()); + topics.insert(TopicKey::from_str("status")); + topics.insert(TopicKey::from_str("cmd")); + topics.insert(TopicKey::from_str("pose")); topics } } diff --git a/scripts/offload.sh b/scripts/offload.sh new file mode 100755 index 000000000..102e25c6a --- /dev/null +++ b/scripts/offload.sh @@ -0,0 +1,2 @@ +#!/bin/bash + ansible-playbook -i ansible/inventory.ini ansible/playbooks/collect_lil_logs.yml \ No newline at end of file diff --git a/victory-suite b/victory-suite index 0ed1b586b..42d08b42c 160000 --- a/victory-suite +++ b/victory-suite @@ -1 +1 @@ -Subproject commit 0ed1b586bacb531473d2fd4470976eee00e9e0a3 +Subproject commit 42d08b42c4c853a5732bddb587110784528b929c