lucasw's Avatar

lucasw

@lucasw0.bsky.social

https://github.com/lucasw Interested in rust programming & robotics

22 Followers  |  78 Following  |  41 Posts  |  Joined: 20.11.2024  |  1.9061

Latest posts by lucasw0.bsky.social on Bluesky

sntpc - Rust Rust SNTP client

docs.rs/sntpc/latest... - example sent message and response:

SendRequestResult { originate_timestamp: 9487534988237733888, version: 35 }

NtpResult { seconds: 1754523286, seconds_fraction: 2473636652, roundtrip: 955, offset: 1754523208575415, stratum: 3, precision: -26 }

08.08.2025 14:31 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

My stm32 rust project has sntpc integration github.com/lucasw/misc_... - sntp_send_request() + sntp_process_response(), results are reported over udp in postcard packets. The systick clock drifts by about 0.3%, it was 50 seconds fast after letting it run for nearly five hours- good enough.

08.08.2025 14:29 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
to run without openocd + gdb 'run' need to disable semihosting Β· lucasw/misc_rust@7d81e0b

```
// need to disable semihosting to run outside of openocd + gdb
// use cortex_m_semihosting::hprintln;
// dummy hprintln
#[macro_export]
macro_rules! hprintln {
( $( $x:expr ),* ) => {
}
}
```

github.com/lucasw/misc_...

02.08.2025 15:06 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Flashing via OpenOCD does not allow the embedded program to run, however running using GDB with an OpenOCD bridge works fine I am running into an issue with using Rust for embedded purposes where I can run and debug programs just fine, but if I try to flash programs such that they can run without being connected to my co...

Just needed to disable semihosting and now it runs fine without gdb- I'm sure the rust embedded book probably mentioned that.

stackoverflow.com/a/70492258/6...

02.08.2025 15:06 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Something isn't configured right, or I'm missing some steps- it runs only through openocd + gdb `run`, I can't power cycle it and receive packets from it otherwise.

02.08.2025 14:48 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Starting to trade udp postcard encoded messages with an stm32 nucleo 144 dev board (stm32h753 in particular) github.com/lucasw/misc_... There are some issues with broadcasting, maybe I need a newer smoltcp? I could try updating it in github.com/lucasw/nucle...

02.08.2025 14:37 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Had a gig wrap up a little earlier than expected, I should have availability starting July or so.

As always: if you need help with Embedded, Rust, or similar things, shoot me a message!

If you're a user of postcard, p-rpc, or are interested in the more experimental new ergot: shoot me a message!

17.06.2025 19:29 β€” πŸ‘ 36    πŸ” 21    πŸ’¬ 2    πŸ“Œ 1
misc_rust/net_loopback at main Β· lucasw/misc_rust rust projects. Contribute to lucasw/misc_rust development by creating an account on GitHub.

Serialize and deserialize multiple struct types and transmit with udp in rust with postcard- the example isn't no_std but I'm going to try something similar no-std next: github.com/lucasw/misc_... - there's more boilerplate around the use of the enum than I'd prefer though

31.07.2025 15:10 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
August, 2025 SRUG (Seattle Rust User Group) Meetup, Thu, Aug 14, 2025, 6:00 PM | Meetup **August, 2025 SRUG Meeting** **\*\*NB: New date and location\*\*** This event is no longer taking place at Microsoft Reactor, it has been moved to **Amazon Oscar in Seatt

www.meetup.com/seattle-rust... - the next SRUG (Seattle Rust User Group) meetup: "This event is no longer taking place at Microsoft Reactor, it has been moved to Amazon Oscar in Seattle. It is also now taking place on Thursday August 14."

30.07.2025 18:56 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I've tried out postcard for a single struct type and it works well but for multiple I need my own match on a type tag and then decode the payload after the type with postcard? Does there happen to be an example of that? I can figure it out but I feel likely to re-implement what is already done.

29.07.2025 21:45 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I'm looking for a no_std bytes go in, decoded messages of any of several struct types come out, and also do the reverse operation but I'll take care of the transport- can I use ergot for that, or postcard by itself is for that?

29.07.2025 19:34 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
Many implementations missing when default-features disabled Β· Issue #804 Β· dimforge/nalgebra Hi, when using nalgebra with default-features = false many implementations are missing that should still be available, if I understand the documentation correctly. For example: use nalgebra::{Vecto...

github.com/dimforge/nal...

12.07.2025 18:35 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

nalgebra with no_std got me the error "the trait `RealField` is not implemented for `f32`
... required for `f32` to implement `SimdRealField`" when trying to make a Rotation2 with an angle. Solution: use libm:

nalgebra = { version = "0.33.2", default-features = false, features = ["libm"] }

12.07.2025 18:34 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Bezier-rs Interactive Documentation

I was using the graphite bezier library which is more fully featured and has nice interactive documentation graphite.rs/libraries/be... - but really it should be a a standalone repository outside of graphite, and it isn't no_std (not sure how hard to fix that, found 'stroke' above anyhow)

05.07.2025 14:21 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
rust stroke cubic bezier curve

rust stroke cubic bezier curve

no_std bezier curves in rust github.com/dorianprill/... and I have a branch here that visualizes tangent and curvature (1.0 / radius) github.com/lucasw/strok...,
example curve using plotters below. Next thing to do is make some adjustments to the closest point finding.

05.07.2025 14:18 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

in clothoid rs:

pub fn angle_unwrap(angle_radians: Float) -> Float {
(angle_radians + PI) % (2.0 * PI) - PI
}
...

04.07.2025 14:07 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

pub mod f32 {
pub type Float = f32;
use core::f32::consts::{FRAC_2_SQRT_PI, FRAC_PI_2, PI};
include!("clothoid.rs");
}

pub mod f64 {
pub type Float = f64;
use std::f64::consts::{FRAC_2_SQRT_PI, FRAC_PI_2, PI};
include!("clothoid.rs");
}

04.07.2025 14:05 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
compile an f32 and f64 version of clothoid curve, with the f32 aiming… Β· lucasw/clothoid_curve_rs@8d8df6d … to be no_std

Compile the same code twice, once with f32 and the other with f64, and then access it like my_package::f32::foo and my_package::f64::foo (maybe glam or others do something similar? I was going to look if I couldn't get it working but it worked)

github.com/lucasw/cloth...

04.07.2025 14:04 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

If None is passed in by itself it results in "cannot infer type of the type parameter `F` declared on the method `foo`", even though a type really isn't needed because nothing makes use of the type, it's None.

01.07.2025 21:37 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Optional function as parameter to another function

pub fn foo<F: Fn(f64) -> f64>(
...
my_fn: Option<&F>
)

call it with None like this:

foo(..., None::<fn(f64) -> f64>.as_ref())

01.07.2025 21:34 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

"2007: Scott Hassan and Steve Cousins found Willow Garage... it would create the PR2 research robot and the wildly successful ROS operating system. ROS is used to this day by enthusiastic researchers and frustrated companies who can’t figure out how to migrate off of it."

30.06.2025 17:59 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

🎀 #rustconf Session Announcement: Yang Zhou
β€œRust for Robotics: Safer, Faster Systems for Autonomous Applications”
β†’ rustconf.com/schedule/#1480
#rustlang

18.06.2025 20:13 β€” πŸ‘ 2    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

But there isn't a SeriesLine3D, instead I'm having to use LineStrips3D but send mostly the same points over and over every update... which isn't terrible but seems inefficient. I could log_static it up in segments instead, but wouldn't that clutter up the viewer with the many many instances?

17.06.2025 16:41 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
clothoid curve generated within egui, specify length and curvature and curvature rate and visualize

clothoid curve generated within egui, specify length and curvature and curvature rate and visualize

github.com/lucasw/cloth... is a rust adaptation of a subset of github.com/ebertolazzi/..., for generating clothoid curves

16.06.2025 19:00 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
a rerun.io SeriesLines

a rerun.io SeriesLines

rec.log("chart/line1", &rerun::Scalars::single(y1 as f64))?;

16.06.2025 18:01 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
SeriesLines <!-- DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/docs/website.rs -->

In rerun a stripchart is called a SeriesLines, where 1d points are appended to a plot at the current set time (like the default behavior of every plot in plotjuggler) rerun.io/docs/referen...

16.06.2025 17:38 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0
Preview
Olfactory Inertial Odometry: Methodology for Effective Robot Navigation by Scent Olfactory navigation is one of the most primitive mechanisms of exploration used by organisms. Navigation by machine olfaction (artificial smell) is a very difficult task to both simulate and solve. W...

arxiv.org/abs/2506.02373 -> uses Sensirion MICS6814 metal oxide (MOX) sensors

04.06.2025 21:09 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

There's also a tool `mcap_image_to_compressed` github.com/lucasw/mcap_... that converts Image messages to CompressedImage in a new output mcap (though leaves out all other messages, I'll add a passthrough option later to make it more like rosbag_image_compressor)

02.06.2025 15:03 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Video thumbnail

Quickly view all CompressedImage topics in an mcap using mcap_view - github.com/lucasw/mcap_... - I'll make it support regular Image next (which is more work, it's less code to decode jpg bytes that interpret raw bytes in any of several formats). The example is using a tartandrive2 figure8 excerpt.

01.06.2025 18:05 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Get a tartandrive2 file down to a reasonable size (from 18GB): `mcap filter figure_8_0.bag.mcap -o figure_8_0_excerpt.mcap --start-secs 1699993440` - but it is slow, it is iterating through 300K messages (underlying cli code is written in go, could it be faster in rust or loading 18GB is just slow?)

01.06.2025 16:59 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

@lucasw0 is following 20 prominent accounts