jrl-umi3218 / mc_openrtm

Interface between OpenRTM and mc_rtc
BSD 2-Clause "Simplified" License
3 stars 10 forks source link

sim_mc.py fails to be executed because rtm.findRTC cannot find JVRC1Controller(Robot)0 #36

Closed orikuma closed 1 year ago

orikuma commented 1 year ago

I want to run dynamics simulation for JVRC1 on choreonoid in Ubuntu 20.04. I installed mc_openrtm and chorenoid from mc-rtc-superbuild and start choreonoid by following commands.

cd /usr/local/share/hrpsys/samples/JVRC1
choreonoid sim_mc.cnoid --start-simulation

Then, sim_mc.py failed to be executed with following message in choreonoid.

Eigenライブラリバージョン3.3.7が使用されています.( 使用されているSIMD命令セット: SSE, SSE2 )
Labo1用のボディカスタマイザ "/usr/local/lib/choreonoid-1.8/customizer/Labo1Customizer.so" がロードされました.
RHPS1用のボディカスタマイザ "/usr/local/lib/choreonoid-1.8/customizer/RHPS1Customizer.so" がロードされました.
HRP5P用のボディカスタマイザ "/usr/local/lib/choreonoid-1.8/customizer/HRP5PCustomizer.so" がロードされました.
HRP2, HRP2NF1, HRP2TIG, HRP2D, HRP2JRL, HRP2A, HRP2JSK, HRP2JSKNT, HRP2W, HRP2K, HRP2SH, HRP2DRC, HRP2JVRC, HRP2KAI, HRP3, HRP4L, HRP4, HRP4Cg, HRP4R, HRP4J用のボディカスタマイザ "/usr/local/lib/choreonoid-1.8/customizer/HRP2Customizer.so" がロードされました.
CustomizedSpringModel用のボディカスタマイザ "/usr/local/lib/choreonoid-1.8/customizer/SpringModelCustomizer.so" がロードされました.
Bodyプラグインが読み込まれました.
Assimpプラグインが読み込まれました.
"SimulationExecutionContext" を登録しました.
"SimulationPeriodicExecutionContext" を登録しました.
"ChoreonoidExecutionContext" を登録しました.
"ChoreonoidPeriodicExecutionContext" を登録しました.
OpenRTMプラグインが読み込まれました.
PCLプラグインが読み込まれました.
Pythonプラグインが読み込まれました.
PythonSimScriptプラグインが読み込まれました.
RobotAccessプラグインが読み込まれました.
URDFプラグインが読み込まれました.
Corbaプラグインが読み込まれました.
GrxUIプラグインが読み込まれました.
Hrpsys31プラグインが読み込まれました.
OpenHRP3.1プラグインが読み込まれました.
プロジェクトファイル "sim_mc.cnoid" を読み込み中…
タスクシーケンサ '' が非活性化されました.
PythonPlugin: "/usr/local/lib/python2.7/dist-packages/hrpsys" がPythonのモジュールパスに追加されました.
OpenGL 3.3 (GLSL 3.30 NVIDIA via Cg compiler) が "シーン" ビューで利用可能です.
ドライバプロファイル: NVIDIA Corporation NVIDIA GeForce RTX 3050 Ti Laptop GPU/PCIe/SSE2 3.3.0 NVIDIA 525.105.17.
ExtCommandItem "ModelLoader" を読み出し中
外部コマンド "openhrp-model-loader" がアイテム "ModelLoader" によって実行されました.
WorldItem "World" を読み出し中
ready
BodyItem "JVRC1" を読み出し中
ボディ "/usr/local/share/OpenHRP-3.1/robot/JVRC1/main.wrl" を読み込み中
 -> 完了!
BodyRTCItem "BodyRTC" を読み出し中
設定ファイル "/usr/local/lib/choreonoid-1.8/rtc/Virtual-JVRC1-RTC.conf" が読み込まれました.
RTC "PDcontroller" を "/usr/local/lib/choreonoid-1.8/rtc/PDcontroller.so" から生成しました.
RTC "JVRC1Controller(Robot)0" を生成しました.
SensorVisualizer "SensorVisualizer" を読み出し中
loading file:////usr/local/share/OpenHRP-3.1/robot/JVRC1/main.wrl
Humanoid node
Joint node PELVIS
  Segment node PELVIS_S
    AccelerationSensorgsensor
    Gyrogyrometer
  Joint node R_HIP_P
    Segment node R_HIP_P_S
    Joint node R_HIP_R
      Segment node R_HIP_R_S
      Joint node R_HIP_Y
        Segment node R_HIP_Y_S
        Joint node R_KNEE
          Segment node R_KNEE_S
          Joint node R_ANKLE_R
            Segment node R_ANKLE_R_S
            Joint node R_ANKLE_P
              Segment node R_ANKLE_P_S
              ForceSensorrfsensor
  Joint node L_HIP_P
    Segment node L_HIP_P_S
    Joint node L_HIP_R
      Segment node L_HIP_R_S
      Joint node L_HIP_Y
        Segment node L_HIP_Y_S
        Joint node L_KNEE
          Segment node L_KNEE_S
          Joint node L_ANKLE_R
            Segment node L_ANKLE_R_S
            Joint node L_ANKLE_P
              Segment node L_ANKLE_P_S
              ForceSensorlfsensor
  Joint node WAIST_Y
    Segment node WAIST_Y_S
    Joint node WAIST_P
      Segment node WAIST_P_S
      Joint node WAIST_R
        Segment node WAIST_R_S
        Joint node NECK_Y
          Segment node NECK_Y_S
          Joint node NECK_R
            Segment node NECK_R_S
            Joint node NECK_P
              Segment node NECK_P_S
              VisionSensorrcamera
              VisionSensorlcamera
              VisionSensordcamera
              RangeSensorranger
        Joint node R_SHOULDER_P
          Segment node R_SHOULDER_P_S
          Joint node R_SHOULDER_R
            Segment node R_SHOULDER_R_S
            Joint node R_SHOULDER_Y
              Segment node R_SHOULDER_Y_S
              Joint node R_ELBOW_P
                Segment node R_ELBOW_P_S
                Joint node R_ELBOW_Y
                  Segment node R_ELBOW_Y_S
                  Joint node R_WRIST_R
                    Segment node R_WRIST_R_S
                    Joint node R_WRIST_Y
                      ForceSensorrhsensor
                      Segment node R_WRIST_Y_S
                      Joint node R_UTHUMB
                        Segment node R_UTHUMB_S
                        Joint node R_LTHUMB
                          Segment node R_LTHUMB_S
                      Joint node R_UINDEX
                        Segment node R_UINDEX_S
                        Joint node R_LINDEX
                          Segment node R_LINDEX_S
                      Joint node R_ULITTLE
                        Segment node R_ULITTLE_S
                        Joint node R_LLITTLE
                          Segment node R_LLITTLE_S
        Joint node L_SHOULDER_P
          Segment node L_SHOULDER_P_S
          Joint node L_SHOULDER_R
            Segment node L_SHOULDER_R_S
            Joint node L_SHOULDER_Y
              Segment node L_SHOULDER_Y_S
              Joint node L_ELBOW_P
                Segment node L_ELBOW_P_S
                Joint node L_ELBOW_Y
                  Segment node L_ELBOW_Y_S
                  Joint node L_WRIST_R
                    Segment node L_WRIST_R_S
                    Joint node L_WRIST_Y
                      ForceSensorlhsensor
                      Segment node L_WRIST_Y_S
                      Joint node L_UTHUMB
                        Segment node L_UTHUMB_S
                        Joint node L_LTHUMB
                          Segment node L_LTHUMB_S
                      Joint node L_UINDEX
                        Segment node L_UINDEX_S
                        Joint node L_LINDEX
                          Segment node L_LINDEX_S
                      Joint node L_ULITTLE
                        Segment node L_ULITTLE_S
                        Joint node L_LLITTLE
                          Segment node L_LLITTLE_S
The model was successfully loaded ! 
BodyItem "longfloor" を読み出し中
ボディ "/usr/local/share/OpenHRP-3.1/sample/model/longfloor.wrl" を読み込み中
 -> 完了!
AISTSimulatorItem "AISTSimulator" を読み出し中
PythonSimScriptItem "sim_mc.py" を読み出し中
シミュレーション用Pythonスクリプト "/usr/local/share/hrpsys/samples/JVRC1/sim_mc.py" を読み込み中
 -> 完了!
8 / 8 のアイテムが読みこまれました.
プロジェクト "sim_mc.cnoid" を完全に読み込みました.
RTコンポーネントの設定をしています.
実行コンテキストを取得しました.
接続 JVRC1Controller(Robot)0:q --> PDcontroller0:angle
接続に成功しました.
接続 JVRC1Controller(Robot)0:tau <-- PDcontroller0:torque
接続に成功しました.
AISTSimulatorによるシミュレーションを開始しました.
Pythonスクリプト "sim_mc.py" の実行を開始しました.
[rtm.py] nshost already set as localhost
[rtm.py] nsport already set as 2809
[rtm.py] Failed to parse corba.master_manager, use 2810
[rtm.py] configuration ORB with localhost:2809
[rtm.py] configuration RTCManager with localhost:2810
[rtm.py] trying to findRTCManager on port2810
Pythonスクリプト "sim_mc.py" の実行に失敗しました.
AttributeError: 'NoneType' object has no attribute 'port'

At:
  /usr/local/share/hrpsys/samples/JVRC1/sim_mc.py(107): init
  /usr/local/share/hrpsys/samples/JVRC1/sim_mc.py(148): <module>

The output in the terminal is as follows.

$ choreonoid sim_mc.cnoid --start-simulation
PDcontroller0: onInitialize()
Loading body customizer "/usr/local/share/OpenHRP-3.1/customizer/libSampleBushCustomizer.so" for
Loading body customizer "/usr/local/share/OpenHRP-3.1/customizer/HRP5PCustomizer.so" for HRP5P
Loading body customizer "/usr/local/share/OpenHRP-3.1/customizer/HRP2Customizer.so" for HRP2, HRP2NF1, HRP2TIG, HRP2D, HRP2JRL, HRP2A, HRP2JSK, HRP2JSKNT, HRP2W, HRP2K, HRP2SH, HRP2DRC, HRP2JVRC, HRP2KAI, HRP3, HRP4L, HRP4, HRP4Cg, HRP4R, HRP4J
Loading body customizer "/usr/local/share/OpenHRP-3.1/customizer/libSampleCustomizer.so" for springJoint
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
PDcontroller0: on Activated
[PDcontroller0] Gain file [PDgains_sim.dat] opened
[PDcontroller0] tlimit_ratio is set to 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
[PDcontroller0] loadGain
[PDcontroller0]   R_HIP_P, pgain = 5000, dgain = 30
[PDcontroller0]   R_HIP_R, pgain = 5000, dgain = 30
[PDcontroller0]   R_HIP_Y, pgain = 5000, dgain = 30
[PDcontroller0]   R_KNEE, pgain = 6000, dgain = 50
[PDcontroller0]   R_ANKLE_R, pgain = 3000, dgain = 20
[PDcontroller0]   R_ANKLE_P, pgain = 3000, dgain = 20
[PDcontroller0]   L_HIP_P, pgain = 5000, dgain = 30
[PDcontroller0]   L_HIP_R, pgain = 5000, dgain = 30
[PDcontroller0]   L_HIP_Y, pgain = 5000, dgain = 30
[PDcontroller0]   L_KNEE, pgain = 6000, dgain = 50
[PDcontroller0]   L_ANKLE_R, pgain = 3000, dgain = 20
[PDcontroller0]   L_ANKLE_P, pgain = 3000, dgain = 20
[PDcontroller0]   WAIST_Y, pgain = 5000, dgain = 32
[PDcontroller0]   WAIST_P, pgain = 5000, dgain = 32
[PDcontroller0]   WAIST_R, pgain = 5000, dgain = 32
[PDcontroller0]   NECK_Y, pgain = 1000, dgain = 21
[PDcontroller0]   NECK_R, pgain = 1000, dgain = 21
[PDcontroller0]   NECK_P, pgain = 1000, dgain = 21
[PDcontroller0]   R_SHOULDER_P, pgain = 1100, dgain = 70
[PDcontroller0]   R_SHOULDER_R, pgain = 1100, dgain = 70
[PDcontroller0]   R_SHOULDER_Y, pgain = 1100, dgain = 70
[PDcontroller0]   R_ELBOW_P, pgain = 1200, dgain = 80
[PDcontroller0]   R_ELBOW_Y, pgain = 1200, dgain = 80
[PDcontroller0]   R_WRIST_R, pgain = 500, dgain = 24
[PDcontroller0]   R_WRIST_Y, pgain = 500, dgain = 24
[PDcontroller0]   R_UTHUMB, pgain = 100, dgain = 10
[PDcontroller0]   R_LTHUMB, pgain = 100, dgain = 10
[PDcontroller0]   R_UINDEX, pgain = 100, dgain = 10
[PDcontroller0]   R_LINDEX, pgain = 100, dgain = 10
[PDcontroller0]   R_ULITTLE, pgain = 100, dgain = 10
[PDcontroller0]   R_LLITTLE, pgain = 100, dgain = 10
[PDcontroller0]   L_SHOULDER_P, pgain = 1100, dgain = 70
[PDcontroller0]   L_SHOULDER_R, pgain = 1100, dgain = 70
[PDcontroller0]   L_SHOULDER_Y, pgain = 1100, dgain = 70
[PDcontroller0]   L_ELBOW_P, pgain = 1200, dgain = 80
[PDcontroller0]   L_ELBOW_Y, pgain = 1200, dgain = 80
[PDcontroller0]   L_WRIST_R, pgain = 500, dgain = 24
[PDcontroller0]   L_WRIST_Y, pgain = 500, dgain = 24
[PDcontroller0]   L_UTHUMB, pgain = 100, dgain = 10
[PDcontroller0]   L_LTHUMB, pgain = 100, dgain = 10
[PDcontroller0]   L_UINDEX, pgain = 100, dgain = 10
[PDcontroller0]   L_LINDEX, pgain = 100, dgain = 10
[PDcontroller0]   L_ULITTLE, pgain = 100, dgain = 10
[PDcontroller0]   L_LLITTLE, pgain = 100, dgain = 10

I confirmed that this error is occured because rh in https://github.com/jrl-umi3218/mc_openrtm/blob/master/projects/JVRC1/cnoid/sim_mc.py#L104 is None. I also confirmed that JVRCController(Robot)0 exists in the "RTC List" viewer in choreonoid. Do you have any idea to solve this problem?

gergondet commented 1 year ago

Do you have any idea to solve this problem?

Hi @orikuma

Sorry but no :(

There is no error message in the message view or in the console output so it's definitely going to be difficult to debug. Are you able to run simulations with HRP robots on the same machine? Did you run clear-omninames.sh before running the simulation?

Best,

orikuma commented 1 year ago

Thank you for your reply.

Are you able to run simulations with HRP robots on the same machine?

No. When I run choreonoid sim_mc_openrtm.cnoid --start-simulation in /usr/local/share/hrpsys/samples/MC_HRP2KAI, /usr/local/share/hrpsys/samples/MC_HRP5P, and /usr/local/share/hrpsys/samples/RHPS1, I got the same error.

Did you run clear-omninames.sh before running the simulation?

Yes. I already run clear-omninames.sh.

Can you run simulation of choreonoid in Ubuntu 20.04? Is this problem reproduced in your machine?

orikuma commented 1 year ago

I found that ros-noetic-openrtm-aist was installed in my machine (I assume that it was automatically installed by rosdep). When I purged it and rerun mc-rtc-superbuild, the above problem did not happen. I'm sorry for bothering you.

gergondet commented 1 year ago

Thanks for the update. How did you find out this was the issue?

I am not sure why this is failing because the ros-noetic-openrtm-aist package has the same version of openrtm-aist than the one we build with superbuild. We also normally explicitly pass the openrtm directory to openhrp when we build it but maybe it needs to be passed to Choreonoid as well?

I'll try to find some time to reproduce the issue locally.

orikuma commented 1 year ago

How did you find out this was the issue?

I remembered that a similar corba error was caused by the version incompatibility of openrtm-aist installed from apt before. (I'm sorry but I did not investigate its reason deeply)

I am not sure why this is failing because the ros-noetic-openrtm-aist package has the same version of openrtm-aist than the one we build with superbuild.

As far as I know, ros-noetic-openrtm-aist comes from https://github.com/tork-a/openrtm_aist-release/tree/release/noetic/openrtm_aist/1.1.2-4, which is different from isri-aist/openrtm-aist-cpp.

We also normally explicitly pass the openrtm directory to openhrp when we build it but maybe it needs to be passed to Choreonoid as well?

I think it might help us avoid this kind of version incompatibility problem.