Closed arlk closed 3 years ago
Hi @arunlakshmanan, thanks for trying out Flashlight. There is an easy, but admittedly janky, workaround to the issue you're experiencing.
You should be able to fix that error by changing build_sympy_modules_on_import = False
to build_sympy_modules_on_import = True
on line 33 of quadrotor_2d.py. After making this change, when you import quadrotor_2d
, Flashlight will automatically build some Python modules. You only have to do this extra build step once. After you've done this extra build step once, you can set build_sympy_modules_on_import = False
again. Repeat this process for quadrotor_3d
and quadrotor_camera_3d
if you plan to use those modules.
I'll leave this issue open as a reminder to update the documentation, or make this process more automatic, in the next release. Please do let me know if this fixes your problem, because I've never tested Flashlight on Linux before.
Cheers, Mike
Here is some background on why this issue comes up in the first place, in case anyone reading this thread is curious.
Flashlight builds symbolic mathematical expressions for the quadrotor dynamics using SymPy. Having a symbolic representation of the quadrotor dynamics is advantageous, because SymPy can automatically compute various derivatives in symbolic form. These derivatives are required, e.g., to do LQR feedback control. But the derivatives can be complicated and error-prone to derive by hand, so it's a good idea to have SymPy grind them out automatically.
Evaluating SymPy expressions is slow, so we compile the expressions into C code, and wrap them in Python modules. This gives us the best of both worlds: convenient symbolic representation of the quadrotor dynamics, but automatically compiled into a form that can be evaluated as fast as C code. The compilation process itself is slow, e.g., 100 seconds for quadrotor_2d
, so we save the Python modules and reuse them when you import quadrotor_2d
. You can force a rebuild by setting build_sympy_modules_on_import = True
. In your case, since the saved Python modules are built for Mac, you need to force a rebuild.
Thanks @mikeroberts3000, rebuilding them worked! :)
@arunlakshmanan Awesome! Did you sync to the latest master today? By coincidence, I needed to rebuild all these modules today, and I encountered a couple of minor bugs. I'm assuming these bugs would have affected you too if you tried to force a rebuild. Unless you synced today and got my latest code. Either way, I'm happy you're up and running :)
And I'll leave this issue open, as a reminder to implement a more robust cross-platform solution in future.
Thanks, I did sync it before building them. Thanks for fixing those bugs!
This helped but the setup file was searching for gcc-4.9 version where as I was using higher version. So I used symbolic link since I cant go back to old version. This will solve the problem for the time being.
@supersai007 feel free to modify sympy_utils.py according to your preferred verison of gcc. That's probably a cleaner solution than creating a symlink.
Oh, yeah. I just overlooked that file. Now rectified.
invalid ELF header error happened for quadrotor_camera_3d.py import too. I followed the same strategy to build the sympy modules by turning on build_sympy_modules_on_import = True
. And next, it follows the rule.
I've decided to close this issue because the relevant workarounds are documented here, and it will be a while before I get a chance to further improve the documentation.
Hey! Thank you for uploading this, I am glad to see a good control library for quadrotors with really good looking viz. I wanted to play around with this, but I realized that the library files are
Mach-O
formats but I use Linux. I was wondering if you will be providing Linux complied versions of the libraries?Otherwise I get this ..