jsk-ros-pkg / jsk_robot

jsk-ros-pkg/jsk_robot
https://github.com/jsk-ros-pkg/jsk_robot
73 stars 97 forks source link

[Unitree] Failed to load unitree-interface.l #1866

Closed sktometometo closed 1 year ago

sktometometo commented 1 year ago

I have tried following step of this tutorial

  1. Run roseus

    (load "package://unitreeeus/unitree-interface.l") ;; load modules
    (go1-init)

And I have got following error when I have tried to load modules

Unbound variable go1_description-robot in (defmethod go1_description-robot (:head-end-coords (&rest args) (forward-message-to        
  camera_optical_face_lk args)))                                                                                                       
 2                                                                                                                                     
 3                                                                                                                                     
 4Restarts:                                                                                                                            
 5 0: [QUIT] Quit to the SLIME top level                                                                                               
 6 1: [CONTINUE] Ignore the error and continue in the same stack level                                                                 
 7 2: [RESTART] Restart euslisp process                                                                                                
 8                                                                                                                                     
 9Backtrace:                                                                                                                           
10  0: (defmethod go1_description-robot (:head-end-coords (&rest args) (forward-message-to camera_optical_face_lk args)))              
11  1: (apply #'ros::load-org-for-ros ros::fullname args)                                                                              
12  2: (apply #'ros::load-org-for-ros ros::fullname args)                                                                              
13  3: (let ((ros::fullname fname)) (when (and (stringp fname) (substringp "package://" fname)) (setq ros::fullname                    
  (ros::resolve-ros-path fname)) (when ros::*compile-message* (let* ((ros::urlname (url-pathname fname)) (package-name (send           
  ros::urlname :host)) (ros::path-name (format nil "~A_~A" package-name (substitute 95 47 (concatenate string (subseq (send            
  ros::urlname :directory-string) 1) (send ros::urlname :name))))) (ros::old-module (find ros::path-name *loaded-modules* :key         
  #'lisp::load-module-file-name :test #'equal))) (unless ros::old-module (let* ((ros::ppath (unix:getenv "CMAKE_PREFIX_PATH")) (dir    
  (format nil "~A/share/roseus/ros/~A" (subseq ros::ppath 0 (position 58 ros::ppath)) package-name))) (unless (probe-file dir)         
  (unix:mkdir dir)) (compiler:compile-file-if-src-newer ros::fullname (format nil "~A/~A" dir ros::path-name)) (return-from load       
  (load (format nil "~A/~A.so" dir ros::path-name) :entry (format nil "___~A" ros::path-name)))))))) (if (null ros::fullname) (error   
  "file ~s not found" fname)) (apply #'ros::load-org-for-ros ros::fullname args))                                                      
14  4: (require "package://unitreeeus/go1-utils.l")                                                                                    
15  5: (require "package://unitreeeus/go1-utils.l")                                                                                    
16  6: (require "package://unitreeeus/go1-utils.l")                                                                                    
17  7: (apply #'ros::load-org-for-ros ros::fullname args)                                                                              
18  8: (apply #'ros::load-org-for-ros ros::fullname args)                                                                              
19  9: (let ((ros::fullname fname)) (when (and (stringp fname) (substringp "package://" fname)) (setq ros::fullname                    
  (ros::resolve-ros-path fname)) (when ros::*compile-message* (let* ((ros::urlname (url-pathname fname)) (package-name (send           
  ros::urlname :host)) (ros::path-name (format nil "~A_~A" package-name (substitute 95 47 (concatenate string (subseq (send            
  ros::urlname :directory-string) 1) (send ros::urlname :name))))) (ros::old-module (find ros::path-name *loaded-modules* :key    
sktometometo commented 1 year ago

To do this, I have prepared an environment based on https://github.com/jsk-ros-pkg/jsk_robot/blob/sktometometo-patch-2/jsk_unitree_robot/README.md#program-go1-robot

and PC is

Workspace configuration is

~/ros/ws_jsk_unitree/src $ wstool info
workspace: /home/sktometometo/ros/ws_jsk_unitree/src

 Localname             S SCM Version (Spec)                                         UID  (Spec)  URI  (Spec) [http(s)://...]
 ---------             - --- --------------                                         -----------  ---------------------------
 unitree_ros_to_real     git develop                                                36a877d87818 github.com/k-okada/unitree_ros_to_real.git
 unitree_ros             git <detached>  (5dee20c5ba1c86dfeb906e24c7870f19cc93d605) 5dee20c5ba1c github.com/unitreerobotics/unitree_ros.git
 unitree_legged_sdk      git develop                                                b4a01bf3068b github.com/k-okada/unitree_legged_sdk.git
 jsk-ros-pkg/jsk_robot   git master  (-)                                            b9acd239738a github.com/jsk-ros-pkg/jsk_robot.git
sktometometo commented 1 year ago

https://github.com/unitreerobotics/unitree_ros/pull/41 has changed robot name of urdf. So generated robot class name is changed.

It seems that I am using wrong version of unitree_ros.

sktometometo commented 1 year ago

After I have changed unitree_ros version to 50ff982. I have got following errors during catkin buld unitreeeus

~/ros/ws_jsk_unitree $ catkin build unitreeeus 
-------------------------------------------------------------------------------------
Profile:                     default
Extending:          [cached] /home/sktometometo/ros/ws_wireless/devel:/opt/ros/noetic
Workspace:                   /home/sktometometo/ros/ws_jsk_unitree
-------------------------------------------------------------------------------------
Build Space:        [exists] /home/sktometometo/ros/ws_jsk_unitree/build
Devel Space:        [exists] /home/sktometometo/ros/ws_jsk_unitree/devel
Install Space:      [unused] /home/sktometometo/ros/ws_jsk_unitree/install
Log Space:          [exists] /home/sktometometo/ros/ws_jsk_unitree/logs
Source Space:       [exists] /home/sktometometo/ros/ws_jsk_unitree/src
DESTDIR:            [unused] None
-------------------------------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------------------------------------
Buildlisted Packages:        None
Skiplisted Packages:         None
-------------------------------------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------------------------------------
[build] Found 48 packages in 0.0 seconds.                                                               
[build] Updating package table.                                                                         
Starting  >>> go1_description                                                                           
Finished  <<< go1_description                [ 0.1 seconds ]                                            
Starting  >>> unitreeeus                                                                                
________________________________________________________________________________________________________
Warnings   << unitreeeus:cmake /home/sktometometo/ros/ws_jsk_unitree/logs/unitreeeus/build.cmake.000.log
unitree_urdf:
collada2eus: /opt/ros/noetic/lib/euscollada/collada2eus
cd /home/sktometometo/ros/ws_jsk_unitree/build/unitreeeus; catkin build --get-env unitreeeus | catkin env -si  /usr/bin/cmake /home/sktometometo/ros/ws_jsk_unitree/src/jsk-ros-pkg/jsk_robot/jsk_unitree_robot/unitreeeus --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/sktometometo/ros/ws_jsk_unitree/devel/.private/unitreeeus -DCMAKE_INSTALL_PREFIX=/home/sktometometo/ros/ws_jsk_unitree/install; cd -

........................................................................................................
________________________________________________________________________________________________________
Errors     << unitreeeus:make /home/sktometometo/ros/ws_jsk_unitree/logs/unitreeeus/build.make.000.log  
make[2]: *** '/home/sktometometo/ros/ws_jsk_unitree/src/jsk-ros-pkg/jsk_robot/jsk_unitree_robot/unitreeeus/go1.l' に必要なターゲット '/home/sktometometo/ros/ws_jsk_unitree/devel/.private/go1_description/share/go1_description/urdf/go1.urdf' を make するルールがありません.  中止.
make[1]: *** [CMakeFiles/Makefile2:256: CMakeFiles/compile_go1.dir/all] エラー 2
make: *** [Makefile:141: all] エラー 2
cd /home/sktometometo/ros/ws_jsk_unitree/build/unitreeeus; catkin build --get-env unitreeeus | catkin env -si  /usr/bin/make --jobserver-auth=3,4; cd -

........................................................................................................
Failed     << unitreeeus:make                [ Exited with code 2 ]                                     
Failed    <<< unitreeeus                     [ 1.8 seconds ]                                            
[build] Summary: 1 of 2 packages succeeded.                                                             
[build]   Ignored:   46 packages were skipped or are skiplisted.                                        
[build]   Warnings:  1 packages succeeded with warnings.                                                
[build]   Abandoned: None.                                                                              
[build]   Failed:    1 packages failed.                                                                 
[build] Runtime: 2.0 seconds total.                                                                     
[build] Note: Workspace packages have changed, please re-source setup files to use them.
sktometometo commented 1 year ago

With https://github.com/jsk-ros-pkg/jsk_robot/pull/1859, go1_description version is 50ff982 . But at this version, there is no URDF in Go1_description (it has only xacro) and current code assumes that source directory has it or generates it during CMake. But it doesn't.

This is why catkin build unitreeus cannot find go1.urdf. But as mentioned above. with newer version, robot name of Go1 is different.

To solve this, I am going to take an approach below.

sktometometo commented 1 year ago

With https://github.com/jsk-ros-pkg/jsk_robot/pull/1867, I can now execute (load "package://unitreeeus/unitree-interface.l")