open-dynamic-robot-initiative / robot_properties_solo

BSD 3-Clause "New" or "Revised" License
40 stars 20 forks source link

Having trouble bringing up ROS package to run simulations #23

Closed andrew103 closed 2 years ago

andrew103 commented 4 years ago

Hello,

I'm looking to setup a simulation environment with the Solo 12 robot and am having trouble getting the ROS package (and its dependencies) to compile with catkin_make. I wasn't able to find any documentation walking through the version requirements and installation of these ROS packages, so I went on the assumption of using ROS melodic with Ubuntu 18.04.

I'd appreciate any help in getting these packages up and running to run simulations of Solo 12 or any pointers to helpful documentation.

Thanks.

jviereck commented 4 years ago

Hi @andrew103 ,

for running the simulation the procedure is like this:

Make sure you have pinocchio installed. See the installation guide here.

mkdir src
cd src
git clone git@github.com:open-dynamic-robot-initiative/robot_properties_solo.git
git clone git@github.com:machines-in-motion/mpi_cmake_modules.git
git clone git@github.com:machines-in-motion/pinocchio_bullet.git
cd ..
source /opt/ros/melodic/setup.bash
catkin_make

Assuming you are using python2, let's ensure you have a few packages installed.

python2 -m pip install pybullet numpy

Source the created workspace and the pinocchio installation

source devel/setup.bash
source /opt/openrobots/setup.bash

Now, you should be able to run the simulation demo. For this

cd src/robot_properties_solo/python/robot_properties_solo
python2 quadruped12wrapper.py

Please let me know if this works for you or not.

Best, Julian

andrew103 commented 4 years ago

I was able to install everything and compile with catkin_make successfully, though /opt/openrobots/setup.bash doesn't exist in my directory. Also, I noticed that the script is run directly through python instead of with ROS. Could the simulation be run through one of the launch files in the robot_properties_solo package? If not, is there a way to do so?

On a sidenote, my research team and I have other various questions about the Solo12 in general. Who would be an appropriate contact for such questions (in a meeting preferably)?

nim65s commented 4 years ago

Hi,

I don't think we have a `/opt/openrobots/setup.bash`. If one install `robotpkg-ros-catkin` (which I don't think is necessary in this issue), here is the note: ``` ========================================================= To use ros, the following environment variables must contain those values: ROS_MASTER_URI http://localhost:11311 ROS_PACKAGE_PATH /opt/openrobots/share PYTHONPATH /opt/openrobots/lib/python2.7/site-packages PATH /opt/openrobots/bin As an alternative to the above configuration, commands can be executed by using the `env.sh' wrapper. For instance, roscore can be started like so: /opt/openrobots/etc/ros/env.sh roscore In Bourne shell scripts, the following file can be sourced instead: /opt/openrobots/etc/ros/setup.sh ========================================================= ```

To configure your environment to use the /opt/openrobots prefix, please follow the section "Configure environment variables" on the pinocchio installation guide.

I suppose @jviereck manually added that file with those instructions :)

andrew103 commented 4 years ago

Ah ok. I've added the environment variables from the pinocchio installation guide to my .bashrc already and sourced it, so the environment should be fine. The error I get when I try to run python2 quadruped12wrapper.py is this:

ImportError: /opt/openrobots/lib/python2.7/site-packages/pinocchio/pinocchio_pywrap.so: undefined symbol: _ZN7eigenpy9NumpyType7getTypeEv
nim65s commented 4 years ago

This looks like https://github.com/stack-of-tasks/pinocchio/issues/1229 : you probably have eigenpy both from ROS and from robotpkg.

To fix this, you can either remove the eigenpy from ROS, or ensure that /opt/openrobots is before /opt/ros in your environment variables, and especially LD_LIBRARY_PATH

andrew103 commented 4 years ago

Removing the eigenpy package from ROS got the script to run, although the script exits immediately after loading the model in the viewer. Also, I still can't get a proper simulation running using the provided roslaunch files in the robot_properties_solo package. I'd prefer to be able to run and test simulations through roslaunch if that's possible.

jviereck commented 4 years ago

although the script exits immediately after loading the model in the viewer.

That's the expected behavior for now.

though /opt/openrobots/setup.bash doesn't exist in my directory.

my bad. In our setup, we put the environment variables from the pinocchio installation into such a file. Glad you figured it out.

Could the simulation be run through one of the launch files in the robot_properties_solo package? If not, is there a way to do so?

I guess it should be possible. We try to keep the usage of ros low in our lab and rather launch scripts from python directly. Can you open another github issue about this please?

nim65s commented 4 years ago

Thanks @jviereck, I really like the idea of something that can work with ROS, but where ROS is absolutely not necessary :D

andrew103 commented 4 years ago

I've created a separate issue for roslaunch as requested.

That's the expected behavior for now.

Gotcha, ok. So to give some context on this question/thread, I'm on a research team looking to base our project off of the Solo12. We've found that there's a lot of good documentation about the mechanics of Solo12, but not as much about the software stack. At this point, I'm not sure how to proceed in terms of getting some sort of simulation software stack doing something (for example moving/actuating a joint in simulation).

Perhaps this is a conversation to be continued elsewhere, but I'd appreciate any guidance that could be offered in this regard.

Also, thanks for all your help thus far!

KardiaZero commented 3 years ago

Hi @andrew103 ,

for running the simulation the procedure is like this:

Make sure you have pinocchio installed. See the installation guide here.

mkdir src
cd src
git clone git@github.com:open-dynamic-robot-initiative/robot_properties_solo.git
git clone git@github.com:machines-in-motion/mpi_cmake_modules.git
git clone git@github.com:machines-in-motion/pinocchio_bullet.git
cd ..
source /opt/ros/melodic/setup.bash
catkin_make

Assuming you are using python2, let's ensure you have a few packages installed.

python2 -m pip install pybullet numpy

Source the created workspace and the pinocchio installation

source devel/setup.bash
source /opt/openrobots/setup.bash

Now, you should be able to run the simulation demo. For this

cd src/robot_properties_solo/python/robot_properties_solo
python2 quadruped12wrapper.py

Please let me know if this works for you or not.

Best, Julian

when I catkin_make, it shows

CMake Error at /opt/ros/noetic/share/catkin/cmake/catkin_workspace.cmake:100 (message): This workspace contains non-catkin packages in it, and catkin cannot build a non-homogeneous workspace without isolation. Try the 'catkin_make_isolated' command instead. Call Stack (most recent call first): CMakeLists.txt:69 (catkin_workspace) -- Configuring incomplete, errors occurred! See also "/home/bao/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/bao/catkin_ws/build/CMakeFiles/CMakeError.log".

The error I get when I try to run python2 quadruped12wrapper.py ignoring the above error is this:

pybullet build time: Nov 26 2020 23:09:05 Traceback (most recent call last): File "quadruped12wrapper.py", line 19, in <module> from robot_properties_solo.config import Solo12Config File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible File "<frozen zipimport>", line 259, in load_module File "/usr/local/lib/python3.8/dist-packages/robot_properties_solo-1.0.0-py3.8.egg/robot_properties_solo/config.py", line 71, in <module> class Solo8Config(SoloAbstract): File "/usr/local/lib/python3.8/dist-packages/robot_properties_solo-1.0.0-py3.8.egg/robot_properties_solo/config.py", line 77, in Solo8Config get_package_share_directory("robot_properties_" + robot_family), File "/usr/local/lib/python3.8/dist-packages/ament_index_python-1.0.1-py3.8.egg/ament_index_python/packages.py", line 69, in get_package_share_directory File "/usr/local/lib/python3.8/dist-packages/ament_index_python-1.0.1-py3.8.egg/ament_index_python/packages.py", line 49, in get_package_prefix File "/usr/local/lib/python3.8/dist-packages/ament_index_python-1.0.1-py3.8.egg/ament_index_python/resources.py", line 37, in get_resource File "/usr/local/lib/python3.8/dist-packages/ament_index_python-1.0.1-py3.8.egg/ament_index_python/search_paths.py", line 29, in get_search_paths OSError: Environment variable 'AMENT_PREFIX_PATH' is not set or empty

jviereck commented 3 years ago

Hi @KardiaZero ,

we switched from Ros1 to Ros2. The previous installation guide is therefore no longer valid. I wrote up a new version of the installation guide and how to run the basic demo here:

https://odri.discourse.group/t/trying-to-run-simulation-need-help/112/2

Best, Julian