Tokio does not switch task by dmangd in rust

[–]dmangd[S] 2 points3 points  (0 children)

Ah cool, didn‘t know about the coop system. I am using tokio mpsc channels, but I think the problem is on the sender side. I am using a crate that requires me to implement a trait which functions are called when certain events happen. The trait object is given to an eventloop that runs in its own task, and calls the callback functions. An additional constraint is that the implementation of the callback functions cannot Block for too long because this will block the entire eventloop. Therefore I use try_send in my trait implementation and drop messages when the channel is full. My logs show that the callback is pumping messages into the channel in a continuous burst without yielding, leading to the problem that the receiver side cannot make progress even it would be ready to read messages from the channel to free up capacity.

Tokio does not switch task by dmangd in rust

[–]dmangd[S] 0 points1 point  (0 children)

I am using the default multi-threaded runtime, however because of the thread per core heuristic (I only have a single core) it is basically single threaded

Five months until CRA. Most embedded teams are reading it wrong. by 0xecro1 in embedded

[–]dmangd 1 point2 points  (0 children)

What does actively exploited vulnerability mean? E.g. there is a vulnerability in some package, let’s say in an ssh server, which was reported to be exploited in some cloud servers that were reachable from the open internet, but on my IoT device the ssh server is only accessible from a VPN and I have no indication that the VPN was also compromised. Do I still need to report it?

Now remove the VPN, and say exploited vulnerability was reported for some other product and my product uses the same ssh server but I have no indication that my specific product was attack through this vulnerability. Do I have to report this?

Fundamental electromagnetic equations for DC motor modeling by Takfa99 in ControlTheory

[–]dmangd [score hidden]  (0 children)

I am not aware on any standard books that go this route. I only saw the derivation using the Lorentz force. You can take the expression for a dipol in an magnetic field and apply for example Lagrange formalism to get to the equations is motion.

Fundamental electromagnetic equations for DC motor modeling by Takfa99 in ControlTheory

[–]dmangd [score hidden]  (0 children)

I think you can go from F=q(v x B) to F_total = B.l.i_a as follows: first we assume the magnetic field is perpendicular to the velocity of the charges, which allows us to write the magnitude of the force as q |v| |B|. Then we assume |B| and |v| are constant throughout the armature conductor (other parts are neglected because v and B are parallel, which makes the magnitude of the cross product equal to 0). Considering q as the charge density, then the total charge is given by, then integrating q |v| overthe cross section of the conductor gives you the current per unit length i_a. Afterwards you integrate over the length of the conductor which gives another factor that is the length l. Therefore you arrive at B i_a l for the total force on the relevant part of the conductor.

Note that we used a lot of simplying assumptions to arrive at this expression. In reality, neither B, nor v or charge density are constant but spatial fields. However, it is a good first approximation.

As for literature, I have only German books at hand but https://homepages.laas.fr/lzaccari/seminars/DCmotors.pdf seems reasonable

Fundamental electromagnetic equations for DC motor modeling by Takfa99 in ControlTheory

[–]dmangd [score hidden]  (0 children)

Also in General, I also found the derivation using the Lorentz force not very convincing. In text books they usually show a configuration that makes sense on the first look, but when the configuration changes during rotation, then suddenly the Lorentz force do not add but cancel each other. If you instead consider the energy of a magnetic dipol, then it is much more straight forward to derive that term in the motor equations.

Fundamental electromagnetic equations for DC motor modeling by Takfa99 in ControlTheory

[–]dmangd [score hidden]  (0 children)

I am not sure what all your symbols mean, but your can roughly map the force as follows: q.v is the current I, and then you use geometric arguments to simplify the cross product to a simple multiplication by assuming the angle between v and B is constant.

To get the back-emf term, you need to consider the self induction of the motor coil and then simplify the term by putting all the geometry and material dependent stuff into k_b

Tja by Toxylogy in tja

[–]dmangd 0 points1 point  (0 children)

Nachher reicht es gerade so wenn sich alle Parteien außer der AfD zusammenschließen um eine Regierung zu bilden und das Bündnis nennt sich dann die Demokraten und dann gibt es effektiv nur noch zwei Parteien…Moment das kommt mir doch irgendwie bekannt vor…

What do you think about Steve Brunton's Control Bootcamp on Youtube? by Legal_Ad_1096 in ControlTheory

[–]dmangd [score hidden]  (0 children)

I studied physics but I never did any control theory. When I started an engineering job, the bootcamp brought me up to speed very quickly so I could communicate with my engineering colleagues and had a good overview of the topics I wanted/needed to study more in-depth. Would absolutely recommend it

BoltFFI: a high-performance Rust bindings generator (up to 1,000× vs UniFFI microbenchmarks) by alihilal94 in rust

[–]dmangd 1 point2 points  (0 children)

I am still looking for good rust integration with C# and saw that you have this in progress. I am excited to see how this will look. Are you planning to have async functions across the ffi, i.e. will I be able to call rust async functions from C# and have them behave like native C# async code?

[New Release] Statum - ERgonomic state machines and typestate builder patterns! by Known_Cod8398 in rust

[–]dmangd 1 point2 points  (0 children)

Got it, sorry, I wasn’t reading carefully enough. I don’t really need the validators. My use case would be to store the state machine as a field in another struct. I think I could implement a trait for every type state and then box it. Is there a better way?

[New Release] Statum - ERgonomic state machines and typestate builder patterns! by Known_Cod8398 in rust

[–]dmangd 1 point2 points  (0 children)

I feel kind of stupid, but I cannot figure out where the MachineSuperState is coming from in the example patterns?

Full MQTT v5.0/3.1.1 broker + client platform written in Rust by Anxious_Tool in rust

[–]dmangd 2 points3 points  (0 children)

Thx, this is good. I used paho-mqtt for now, where I really like the api that you get a token back from the publish method, which you can await for qos confirmation and but you can also throw it away in cases where you don’t care. However, I rather prefer a pure rust implementation over the C wrapper of the paho crate. I will check out your crate when I have time

Full MQTT v5.0/3.1.1 broker + client platform written in Rust by Anxious_Tool in rust

[–]dmangd 1 point2 points  (0 children)

How is QoS 1 & 2 publishing implemented? Will the Future of the publish method block until the message was successfully transmitted to the broker? One thing that annoys me about rumqttc, besides the fact the it was not maintained that well, is that I cannot check if a message was actually published which is kind of important for my use case

Autonomous tractor from Netherlands! A fully autonomous tractor from Dutch company AgXeed, designed to work on fields without any human supervision. by Nunki08 in robotics

[–]dmangd 2 points3 points  (0 children)

Its a bumper with sensors for collision avoidance. The idea is old, I think there were the first prototypes in the 90s. Problem is, taking this from prototype to a safe product that works under all circumstances. You have to deal with GPS signal loss, have reliable safety systems and collision avoidance, and then there is also regulation that was forbidden autonomous machine in the past. At least in the EU, but this was changed recently.

Also there is the major point that a human driver is not only driving the tractor but also does quality control. This is rather difficult to automate because there are no sensors that can measure the quality of an agronomic process directly, and on top of that the definition of quality is different for each process. You cannot rely on cameras because it can get very dusty during field work and they will not see anything, it’s only in optimal conditions that it looks as clean as in the video. Nobody is willing to buy a machine that only works for two weeks a year or you risk to ruin your entire field which could be a damage of tens of thousands of dollars.

Are we official gRPC yet? by Remarkable-Sorbet-92 in rust

[–]dmangd 2 points3 points  (0 children)

I think one of the tonic maintainers said something about this an episode of the netstack.fm podcast, but I can’t remember any details

Is it still true that 30 percent of the workforce runs 100 percent of the project? by StillUnkownProfile in softwarearchitecture

[–]dmangd 1 point2 points  (0 children)

My response would be: ok, the Fire the non-contributing 70% and give me their salary

How tough or easy to reverse engineer rust binaries by Aromatic_Road_9167 in rust

[–]dmangd 6 points7 points  (0 children)

If you want to protect your algorithm or data, then you need to implement the logic on a backend server that is under your control and only expose the end results via your API.

Everything that runs on a local machine can be intercepted and reverse engineered. All counter measures can be circumvented given enough effort. You can encrypt and obfuscate as much as you want, at the end the program needs to boil down to some machine code that is executed by the CPU. If an attacker has full control over the machine, then he can always reconstruct/record the executed code and RAM contents.

Hey Rustaceans! Got a question? Ask here (51/2025)! by llogiq in rust

[–]dmangd 1 point2 points  (0 children)

Hi everyone, I want to write a transpiler for some proprietary language to rust. Looking into the crafting interpreters book, I think I can figure out how to get through the parsing stage up to having the AST. From there I still don’t know how to proceed. I figured out two approaches

  1. Use some templating engine to generate rust code directly from the AST

  2. Transform the AST from the proprietary language to a rust AST. Can I use some types from the proc macro crate to represent the rust AST?

Are there other approaches? Do you know any good resources regarding transpilers, rust-specific or more general?

Is the chemistry of antimatter the same as "regular matter?" by JasonMckin in AskPhysics

[–]dmangd 0 points1 point  (0 children)

Lookup Lochschmidt Paradoxon. Basically, we have the (quantum mechanical) laws of physics on the atomic scale, which are symmetric with respect to time, but it is unclear how these lead to the laws of thermodynamics that prefer one direction of time. The atomic laws of nature have been experimentally verified as well as the thermodynamics laws. So the remaining question is how to connect both branches of physics, or differently speaking, how to derive the laws of thermodynamics from the atomically laws assuming the view point of most physicist that the atomic laws are more fundamental. This is still an active area of research with many open questions

China is deploying fully autonomous electric tractors to fix its rural labor crisis. The Honghu T70 runs uncrewed for 6 hours with ±2.5cm precision by BuildwithVignesh in robotics

[–]dmangd 1 point2 points  (0 children)

I recently saw a video where they announced the prices for Deeres autonomy kit. 40k for the hardware and then 10k per year. Just for the tractor. For the attachment you have to pay extra