Copper v0.4.0: Copper takes the blue pill!
We finished the simulation APIs ie. a way for Copper to enjoy a pure virtual bliss.
We quickly hooked up a game engine and a physics engine to this API, some blender twiddling and voilà!
First highlight of this release
Note: This is exactly the code we brought with us at Robobusiness for our little real life demo at our stand, not a byte changed.
You can also see the monitoring UI in action at the bottom of the screen.
This simulator is just the first of many we will eventually interface with Copper. But this little demonstrator has a nice touch, it is entirely Rust based!
It means, yes, install rust if you don’t have it yet, and then 1 command line to install, 1 command line to try it! Don’t be shy you can copy paste without the $ :)
$ cargo install cu-rp-balancebot
$ balancebot-sim
Who said cats cannot get along with birds?
The interfacing is super natural as you just need to give a callback to Copper and through a big enum of every single stages of you task tree you can filter the ones interesting to intercept for the simulation (SimOverride::ExecutedBySim) and leave the other ones alone (SimOverride::ExecuteByRuntime):
let mut sim_callback = move |step: SimStep<'_>| -> SimOverride {
match step {
SimStep::ExampleSensor(CuTaskCallbackState::Process(_, output)) => {
// Copper asks you what your sensor driver should measure
// You fill up output from the simulation state
// You can inform Copper to not try to execute any real driver code
SimOverride::ExecutedBySim
}
// any other stage for this ExampleSensor? just ignore them
SimStep::ExampleSensor(_) => SimOverride::ExecutedBySim,
// Don't execute any actuation neither
SimStep::Motor(_) => SimOverride::ExecutedBySim,
// Anything you did not want to intercept, let Copper execute it normally.
_ => SimOverride::ExecuteByRuntime,
}
};
This is just a toy example see the full example for the balancebot demo: https://github.com/copper-project/copper-rs/blob/master/examples/cu_rp_balancebot/src/sim.rs#L102
As you can guess this is already close to a log replay API!
Second improvement
We now embed the configuration (copperconfig.ron) in the executable! It allows 2 things:
Less deployments: If you don’t need any config tweaks after the compilation, then just don’t deploy the configuration, Copper will pick up the one you use to compile.
More insights: Copper logs the entire configuration at startup. So in doubt you can always check which configuration this Copper ran with on your robot!
As always your feedback is really important, feel free to join us on the chat room if you have any question!