-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2eb02d
commit 4a63a92
Showing
4 changed files
with
9 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
use kscaleos::hello_world; | ||
use kscaleos::main as kscaleos_main; | ||
|
||
fn main() { | ||
hello_world(); | ||
kscaleos_main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,10 @@ | ||
use robstride::{MotorType, MotorsSupervisor}; | ||
use std::collections::HashMap; | ||
use std::sync::{Arc, RwLock}; | ||
|
||
mod config; | ||
mod runner; | ||
mod state; | ||
|
||
fn main() { | ||
let config = config::Config::new("config.yaml"); | ||
let state = Arc::new(RwLock::new(State::new())); | ||
|
||
// Four motor supervisors, one for each limb. | ||
let mut motor_supervisors = vec![]; | ||
for i in 0..4 { | ||
let port_name = format!("/dev/ttyCH341USB{}", i); | ||
|
||
let motor_infos = match i { | ||
// Left arm. | ||
0 => HashMap::from([ | ||
(1, MotorType::Type03), | ||
(2, MotorType::Type03), | ||
(3, MotorType::Type02), | ||
(4, MotorType::Type02), | ||
(5, MotorType::Type01), | ||
]), | ||
// Right arm. | ||
1 => HashMap::from([ | ||
(1, MotorType::Type03), | ||
(2, MotorType::Type03), | ||
(3, MotorType::Type02), | ||
(4, MotorType::Type02), | ||
(5, MotorType::Type01), | ||
]), | ||
// Left leg. | ||
2 => HashMap::from([ | ||
(1, MotorType::Type04), | ||
(2, MotorType::Type03), | ||
(3, MotorType::Type03), | ||
(4, MotorType::Type03), | ||
(5, MotorType::Type01), | ||
]), | ||
// Right leg. | ||
3 => HashMap::from([ | ||
(1, MotorType::Type04), | ||
(2, MotorType::Type03), | ||
(3, MotorType::Type03), | ||
(4, MotorType::Type03), | ||
(5, MotorType::Type01), | ||
]), | ||
_ => { | ||
panic!("Invalid limb index: {}", i); | ||
} | ||
}; | ||
|
||
let motor_supervisor = | ||
MotorsSupervisor::new(port_name.as_str(), &motor_infos, false, 1000.0, true).unwrap(); | ||
motor_supervisors.push(motor_supervisor); | ||
} | ||
} | ||
|
||
struct State {} | ||
|
||
impl State { | ||
fn new() -> Self {} | ||
|
||
fn update(&mut self, _input: SensorData, _commands: Commands) { | ||
// Update state logic | ||
} | ||
} | ||
|
||
fn read_sensors() -> SensorData { | ||
// Read from camera and motors | ||
SensorData { /* fields */ } | ||
} | ||
use runner::run; | ||
use std::sync::{Arc, RwLock}; | ||
|
||
fn send_commands(_commands: Commands) { | ||
// Interface with motor drivers | ||
pub fn main() { | ||
run(Arc::new(RwLock::new(state::State::new()))); | ||
} | ||
|
||
struct SensorData {/* fields */} | ||
|
||
struct Commands {/* fields */} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters