Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
refactor: big renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Tropix126 committed Mar 27, 2024
1 parent 817158a commit 14da947
Show file tree
Hide file tree
Showing 63 changed files with 81 additions and 81 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ Before releasing:
- Renamed IMU_RESET_TIMEOUT to `InertialSensor::CALIBRATION_TIMEOUT` (**Breaking Change**) (#98).
- Repurposed the `pros` crate as a metapackage without any code of its own. (**Breaking Change**) (#86)
- Split the pros-rs into several small subcrates. (**Breaking Change**) (#86)
- `pros-async` with the async executor and robot trait.
- `vex-async` with the async executor and robot trait.
- `vex-devices` for device bindings.
- `pros-sync` for the sync robot trait.
- `pros-core` with basic abstractions over `pros-sys` needed to compile a program to the brain.
- `pros-math` with commonly used controllers and other mathematical models.
- `pros-panic` for the panic handler implementation.
- `vex-sync` for the sync robot trait.
- `vex-core` with basic abstractions over `pros-sys` needed to compile a program to the brain.
- `vex-math` with commonly used controllers and other mathematical models.
- `vex-panic` for the panic handler implementation.

### Removed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "pros-async"
name = "vex-async"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "A simple async executor for pros-rs"
description = "A simple async executor for vex-rs"
keywords = ["PROS", "Robotics", "bindings", "async", "vex", "v5"]
categories = [
"no-std",
"science::robotics",
"Asynchronous"
]
repository = "https://github.com/gavin-niederman/pros-rs"
repository = "https://github.com/pros-rs/vex-rs"
authors = [
"pros-rs",
"Gavin Niederman <gavinniederman@gmail.com>",
Expand All @@ -21,7 +21,7 @@ authors = [

[dependencies]
async-task = { version = "4.5.0", default-features = false }
pros-core = { version = "0.1.0", path = "../pros-core" }
vex-core = { version = "0.1.0", path = "../vex-core" }
waker-fn = "1.1.1"
pros-sys = { version = "0.7.0", path = "../pros-sys" }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pros-async
# vex-async

Tiny async runtime and robot traits for `pros-rs`.
The async executor supports spawning tasks and blocking on futures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::{
};

use async_task::{Runnable, Task};
use pros_core::{os_task_local, task::delay};
use vex_core::{os_task_local, task::delay};
use waker_fn::waker_fn;

use super::reactor::Reactor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use core::{future::Future, task::Poll};

use async_task::Task;
use executor::EXECUTOR;
use pros_core::error::Result;
use vex_core::error::Result;

mod executor;
mod reactor;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pros-core"
name = "vex-core"
version = "0.1.0"
edition = "2021"
license = "MIT"
Expand All @@ -10,7 +10,7 @@ categories = [
"no-std",
"science::robotics",
]
repository = "https://github.com/gavin-niederman/pros-rs"
repository = "https://github.com/pros-rs/vex-rs"
authors = [
"pros-rs",
"Gavin Niederman <gavinniederman@gmail.com>",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pros-core
# vex-core
Low level core functionality for [`pros-rs`](https://crates.io/crates/pros).
The core crate is used in all other crates in the pros-rs ecosystem.
Included in this crate:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ map_errno! {
///
/// This function will block the entire task, preventing concurrent
/// execution of async code. When in an async context, it is recommended
/// to use the `sleep` function in [`pros_async`](https://crates.io/crates/pros-async) instead.
/// to use the `sleep` function in [`pros_async`](https://crates.io/crates/vex-async) instead.
pub fn delay(duration: Duration) {
unsafe { pros_sys::delay(duration.as_millis() as u32) }
}
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/vex-devices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name = "vex-devices"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "High level device for pros-rs"
description = "High level device for vex-rs"
keywords = ["PROS", "Robotics", "bindings", "vex", "v5"]
categories = [
"api-bindings",
"no-std",
"science::robotics",
]
repository = "https://github.com/gavin-niederman/pros-rs"
repository = "https://github.com/pros-rs/vex-rs"
authors = [
"pros-rs",
"Gavin Niederman <gavinniederman@gmail.com>",
Expand All @@ -20,7 +20,7 @@ authors = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pros-core = { version = "0.1.0", path = "../pros-core" }
vex-core = { version = "0.1.0", path = "../vex-core" }
pros-sys = { path = "../pros-sys", version = "0.7.0", features = ["xapi"] }
vex-sdk = { version = "0.1.0" }
snafu = { version = "0.8.0", default-features = false, features = [
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/analog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! Analog-to-Digital Converter (ADC) in the V5 brain. The brain measures analog input
//! using 12-bit values ranging from 0 (0V) to 4095 (5V).

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/digital.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Digital input and output ADI devices

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/encoder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI encoder device.

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::{ext_adi_encoder_t, PROS_ERR};

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/gyro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use core::time::Duration;

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::{ext_adi_gyro_t, PROS_ERR, PROS_ERR_F};

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/linetracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! between 1/8 and 1/4 of an inch away from the surface it is measuring. It is also important
//! to keep lighting in the room consistent, so sensors' readings remain accurate.

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI (Triport) devices on the Vex V5.

use pros_core::{bail_on, error::PortError, map_errno};
use vex_core::{bail_on, error::PortError, map_errno};
use pros_sys::{adi_port_config_e_t, E_ADI_ERR, PROS_ERR};
use snafu::Snafu;

Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/motor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI motor device.

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/potentiometer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI Potentiometer device.

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::{adi_potentiometer_type_e_t, ext_adi_potentiometer_t, PROS_ERR, PROS_ERR_F};

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/pwm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI Pulse-width modulation (PWM).

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/solenoid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI Solenoid Pneumatic Control

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{digital::LogicLevel, AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/switch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI Digital Switch

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::PROS_ERR;

use super::{digital::LogicLevel, AdiDevice, AdiDeviceType, AdiDigitalIn, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/adi/ultrasonic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ADI ultrasonic sensor.

use pros_core::bail_on;
use vex_core::bail_on;
use pros_sys::{ext_adi_ultrasonic_t, PROS_ERR};

use super::{AdiDevice, AdiDeviceType, AdiError, AdiPort};
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use alloc::{ffi::CString, vec::Vec};

use pros_core::{bail_on, map_errno};
use vex_core::{bail_on, map_errno};
use pros_sys::{controller_id_e_t, PROS_ERR};
use snafu::Snafu;

Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use alloc::{ffi::CString, string::String, vec::Vec};

use pros_core::{bail_on, map_errno};
use vex_core::{bail_on, map_errno};
use pros_sys::PROS_ERR;
use snafu::Snafu;

Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/smart/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Pretty much one to one with the PROS C and CPP API, except Result is used instead of ERRNO values.

use pros_core::error::PortError;
use vex_core::error::PortError;
use snafu::Snafu;
use vex_sdk::{
vexDeviceDistanceConfidenceGet, vexDeviceDistanceDistanceGet, vexDeviceDistanceObjectSizeGet,
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/smart/imu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
};

use bitflags::bitflags;
use pros_core::{error::PortError, time::Instant};
use vex_core::{error::PortError, time::Instant};
use snafu::Snafu;
use vex_sdk::{
vexDeviceGetByIndex, vexDeviceImuAttitudeGet, vexDeviceImuDataRateSet, vexDeviceImuDegreesGet,
Expand Down
4 changes: 2 additions & 2 deletions packages/vex-devices/src/smart/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alloc::{ffi::CString, string::String};
use core::ffi::CStr;

use no_std_io::io;
use pros_core::{
use vex_core::{
bail_errno, bail_on,
error::{FromErrno, PortError},
map_errno,
Expand Down Expand Up @@ -152,7 +152,7 @@ impl TxLink {

match unsafe { link_transmit(self.port.index(), buf.as_ptr().cast(), buf.len() as _) } {
PROS_ERR_U32 => {
let errno = pros_core::error::take_errno();
let errno = vex_core::error::take_errno();
Err(FromErrno::from_errno(errno)
.unwrap_or_else(|| panic!("Unknown errno code {errno}")))
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vex-devices/src/smart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub use imu::InertialSensor;
pub use link::{Link, RxLink, TxLink};
pub use motor::Motor;
pub use optical::OpticalSensor;
use pros_core::error::PortError;
use vex_core::error::PortError;
pub use rotation::RotationSensor;
use vex_sdk::{vexDeviceGetByIndex, vexDeviceGetTimestamp, V5_DeviceT, V5_DeviceType};
pub use vision::VisionSensor;
Expand Down Expand Up @@ -295,7 +295,7 @@ impl From<SmartDeviceType> for V5_DeviceType {

/// Represents a timestamp on a smart device's internal clock. This type offers
/// no guarantees that the device's clock is in sync with the internal clock of
/// the brain, and thus cannot be safely compared with [`pros_core::time::Instant`]s.
/// the brain, and thus cannot be safely compared with [`vex_core::time::Instant`]s.
///
/// There is additionally no guarantee that this is in sync with other smart devices,
/// or even the same device if a disconnect occurred causing the clock to reset. As such,
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/smart/motor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use core::time::Duration;

use bitflags::bitflags;
use pros_core::error::PortError;
use vex_core::error::PortError;
use snafu::Snafu;
use vex_sdk::{
vexDeviceMotorAbsoluteTargetSet, vexDeviceMotorBrakeModeSet, vexDeviceMotorCurrentGet,
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/smart/optical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use core::time::Duration;

use pros_core::error::PortError;
use vex_core::error::PortError;
use snafu::Snafu;
use vex_sdk::{
vexDeviceOpticalBrightnessGet, vexDeviceOpticalGestureDisable, vexDeviceOpticalGestureEnable,
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/smart/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Rotation sensors operate on the same [`Position`] type as motors to measure rotation.

use pros_core::error::PortError;
use vex_core::error::PortError;
use vex_sdk::{
vexDeviceAbsEncAngleGet, vexDeviceAbsEncPositionGet, vexDeviceAbsEncPositionSet,
vexDeviceAbsEncReset, vexDeviceAbsEncReverseFlagGet, vexDeviceAbsEncReverseFlagSet,
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-devices/src/smart/vision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern crate alloc;
use alloc::vec::Vec;

use pros_core::{bail_errno, bail_on, error::PortError, map_errno};
use vex_core::{bail_errno, bail_on, error::PortError, map_errno};
use pros_sys::{PROS_ERR, VISION_OBJECT_ERR_SIG};
use snafu::Snafu;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "pros-math"
name = "vex-math"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Commonly used mathematical formulas for pros-rs"
description = "Commonly used mathematical formulas for vex-rs"
keywords = ["PROS", "Robotics", "vex", "v5"]
categories = [
"no-std",
"science::robotics",
"Mathematics",
]
repository = "https://github.com/gavin-niederman/pros-rs"
repository = "https://github.com/pros-rs/vex-rs"
authors = [
"pros-rs",
"Gavin Niederman <gavinniederman@gmail.com>",
Expand All @@ -19,7 +19,7 @@ authors = [

[dependencies]
num = { version = "0.4.1", default-features = false }
pros-core = { version = "0.1.0", path = "../pros-core" }
vex-core = { version = "0.1.0", path = "../vex-core" }

[lints]
workspace = true
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# pros-math
# vex-math

Common mathematical formulas and models implemented for [`pros-rs`](https://crates.io/crates/pros).
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct PidController {
/// based on the rate of change of the error (predicting future values).
pub kd: f32,

last_time: pros_core::time::Instant,
last_time: vex_core::time::Instant,
last_position: f32,
i: f32,
}
Expand All @@ -34,7 +34,7 @@ impl PidController {
kp,
ki,
kd,
last_time: pros_core::time::Instant::now(),
last_time: vex_core::time::Instant::now(),
last_position: 0.0,
i: 0.0,
}
Expand All @@ -61,7 +61,7 @@ impl PidController {
let output = p + i + d;

self.last_position = position;
self.last_time = pros_core::time::Instant::now();
self.last_time = vex_core::time::Instant::now();

output
}
Expand Down
Loading

0 comments on commit 14da947

Please sign in to comment.