Repository navigation
Fix rotor_vel control_freq, quat2euler degrees and CasADi names - #151
malikdurmus wants to merge 1 commit into
Conversation
- Return the sim frequency from Sim.control_freq in rotor_vel mode instead of raising - Convert radians to degrees in cs_quat2euler(degrees=True) instead of the inverse - Give the CasADi derivative conversion functions unique names
|
Hi, thanks a lot for the contribution! Looks good on a first glance. Can you please split these up into two separate PRs, one for casadi and one for the frequency? Also, out of interest, how did you come across the sim? Are you using it in your projects? |
|
Hi!, sure, I will split it into two PR's. I came across it when I was looking for a JAX native simulation where I can train drone policies with DeepRL. My bachelors thesis at LMU extended a recent UED method, and I wanted to try those ideas on drone control, and I saw your repository. I wanted to take a look at it before starting, then I noticed small improvements i can make which led to this PR eventually. Right now I think of it as a personal learning project, where I can implement concepts hands-on. I’m starting RCI masters at TUM next semester, so I'd be very interested in contributing more or getting involved in the lab’s work if there is an opportunity :) |
|
Nice to hear :) Yeah there probably is, and you will probably recognize the sim in our courses as well ;) |
I came across three small bugs while reading through the code. Each fix comes with a regression test that fails before and passes after.
Sim.control_freqraises inrotor_velmodecontrol_freqhas norotor_velbranch, so thesim.step(sim.freq // sim.control_freq)pattern from the README and docs raisesNotImplementedError. Rotor velocity commands are applied every sim step (controllablealready returns all True forrotor_vel, and the control docs list it as every dynamics step), so now it returnssim.freq.cs_quat2euler(degrees=True)converts the wrong wayThe degrees branch multiplied by
pi / 180instead of180 / pi(This is a silent error!). The test i added compares against scipy'sas_eulerfor extrinsic, intrinsic and symmetric sequences, in both radians and degrees.Duplicate CasADi function names in
rotation.pycs_ang_vel_deriv2rpy_rates_derivandcs_rpy_rates_deriv2ang_vel_derivwere both created with the name"cs_ang_vel2rpy_rates". I think this doesn't affect simulation results, but it gives misleading names in printouts and error messages, and generating C code for several of these functions in oneCodeGeneratorfails withredefinition of 'cs_ang_vel2rpy_rates'. I renamed them after their Python variables.