Ubuntu20.04でRviz2が起動しない

Parallel desktopのUbuntu20.04でRviz2が起動しない

$ rviz2

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
[ERROR] [1605944184.798295285] [rviz2]: rviz::RenderSystem: error creating render window: basic_string::_M_construct null not valid
[ERROR] [1605944184.798411642] [rviz2]: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at /home/shohei/ros2_foxy/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
[ERROR] [1605944184.798448152] [rviz2]: rviz::RenderSystem: error creating render window: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at /home/shohei/ros2_foxy/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
(中略)
[ERROR] [1605944639.406623273] [rviz2]: Unable to create the rendering window after 100 tries
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to create the rendering window after 100 tries
Aborted (core dumped)

LIBGL_ALWAYS_INDIRECT=1をつけると最初のエラーが消えた

$ LIBGL_ALWAYS_INDIRECT=1 rviz2 
rviz2: /tmp/binarydeb/ros-foxy-rviz-ogre-vendor-8.2.0/obj-x86_64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp:3468: void Ogre::GLRenderSystem::initialiseExtensions(): Assertion `pcVer && "Problems getting GL version string using glGetString"' failed.
Aborted (core dumped)

もしかしたらrviz2だけでなくrvizも問題か?と思って試したらrvizも起動しなかった。(rviz2はrvizと同一プログラムっぽい)

以下でVirtual macihneの3D Accelerationをオフにしろとあったので、Parallel desktopの設定でオフにしたらrviz2(とrviz)が起動した。
github.com

f:id:seinzumtode:20201122071536j:plain

f:id:seinzumtode:20201122073421p:plain

appifyでFreecadの実行バイナリを.appに変換する

appify
github.com

FreecadはHomebrewで0.19preをインストールした前提

launchFreeCAD

#!/bin/sh
cd /usr/local/Cellar/freecad/0.19pre/bin/
./FreeCAD

(※上記はシェルスクリプトだが、ダブルクリックで開けるように拡張子はつけない)


appifyで.appに変換

$ appify -name "FreeCAD" -icon ./freecad.icns ./launchFreeCAD

javapackagerでjarをappにする

OpenRocket-15.03.jarをappにした。
openrocket.info

javapackager \
  -deploy \
  -Bruntime=/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home \
  -srcfiles OpenRocket-15.03.jar \
  -native image \
  -srcdir . \
  -outfile OpenRocket.app \
  -name "OpenRocket" \
  -title "OpenRocket" \
  -outdir ./ \
  -appclass net.sf.openrocket.startup.OpenRocket \
  -nosign \
  -v 

Blender2.8でSolidWorksの3DモデルをAC3D形式(.ac)に変換する

手順

1)SolidWorksからVRML形式(.wrl)でエクスポートする
このとき、OptionからVRML97を選択する(デフォルトはVRML1.0。BlenderではVRML1.0を読み込めなかった)
f:id:seinzumtode:20201118221142p:plain

2)Blender2.8でVRMLファイル(.wrl)をインポート
f:id:seinzumtode:20201118221206p:plain

3)AC3Dアドオンを使って.ac形式でエクスポート
f:id:seinzumtode:20201118221327j:plain

変換した.acファイルはAC3Dで問題なく表示できた。
f:id:seinzumtode:20201118221243p:plain