【问题标题】:How to use change directory CD and source commands in a singularity recipe如何在奇异配方中使用更改目录 CD 和源命令
【发布时间】:2019-04-12 05:57:50
【问题描述】:

我正在尝试创建一个奇点容器来模拟 Emika Franka 机器人。为此,我需要使用 catkin 从 GitHub 存储库构建 moveit examplespanda_config。但是,由于我了解奇异性如何相对于我的主系统文件夹安装容器,因此我一直遇到一些麻烦。我使用下面的配方通过sudo singularity build --sandbox ros-kinetic-pandasim-xenial/ recipes/ros_kinetic_pandasim_xenial/ros_kinetic_pandasim_xenial.def 命令构建容器。

ros_kinetic_pandasim_xenial 配方

# Ros kinetic panda simulation ubuntu xenial singularity container recipe file
Bootstrap: docker
From: osrf/ros:kinetic-desktop-full-xenial

%help
    singularity container with Ros kinetic and Gazebo7 for the dynamic simulation of the Emika Franka Panda robot.

%post
    echo "Setting up ros kinetic emika Franka container."

    ## Set user permissions to root ##
    chmod 755 /root

    ## Retrieve updates ##
    apt-get update

    ## Install ros dependencies for building packages
    apt-get install -y python-rosinstall python-rosinstall-generator python-wstool build-essential

    ## Install additional ros packages ##
    apt-get install -y ros-kinetic-joint-state-controller ros-kinetic-controller-manager* ros-kinetic-joint-trajectory-controller
    apt-get install -y ros-kinetic-effort-controllers ros-kinetic-gazebo-ros* ros-kinetic-gazebo-ros-control ros-kinetic-rviz*
    apt-get install -y ros-kinetic-catkin python-catkin-tools

    ## Install other needed packages ##
    apt-get install -y usbutils wget libboost-filesystem-dev libjsoncpp-dev

    ## Setup ros dependency tool ##
    rosdep update

    ## Install MoveIt, MoveIt tutorials and the panda_movit_config files ##
    apt-get install -y ros-kinetic-moveit*
    . /opt/ros/kinetic/setup.sh
    mkdir -p ~/pandasim_ws/src
    cd ~/pandasim_ws/src
    git clone -b kinetic-devel https://github.com/ros-planning/moveit_tutorials.git
    git clone https://github.com/erdalpekel/panda_moveit_config.git
    rosdep install -y --from-paths . --ignore-src --rosdistro kinetic
    cd ~/pandasim_ws/
    catkin config --extend /opt/ros/kinetic
    catkin build
    . ~/pandasim_ws/devel/setup.bash

%environment

    ## Change floating point format ##
    LC_NUMERIC="en_US.UTF-8"

    ## Source ros setup file ##
    . /opt/ros/kinetic/setup.sh

    ## Source catkin setup file ##
    . ~/pandasim_ws/devel/setup.bash

预期行为

我希望将配方 cd 到 ~/pandasim_ws/ 文件夹中,以便我可以执行 catkin 构建。

当前行为

目前,它给了我以下错误:

#All required steps installed successfully
+ cd ~/pandasim_ws/
/bin/sh: 31: cd: can't cd to ~/pandasim_ws/
FATAL:   post proc: exit status 2
FATAL:   While performing build: while running engine: exit status 255

主要问题

有人可以就奇异性如何相对于我的系统目录安装其容器提供解释或一些文档吗?看起来它使用了用户工作区,因此 cd ~/ 指向在主机系统内启动容器的用户的主目录。跟随/ 看起来是根目录。有没有办法 cd 相对于奇异沙盒文件夹?例如$SINGULARITY_PATH 变量或构建参数。

【问题讨论】:

    标签: ros catkin singularity-container moveit


    【解决方案1】:

    我找到了解决方案。由于奇异性使用 sh shell,您必须使用 bash -c 命令来运行 bash 命令。此外,由于在沙箱中您确实在主工作区中,因此最好安装在根文件夹而不是主文件夹下,请参阅definition file documentation

    ## Install MoveIt, MoveIt tutorials and the panda_movit_config files ##
    rosdep update
    apt-get install -y ros-kinetic-moveit
    apt-get install -y \
        ros-kinetic-catkin \
        python-catkin-tools \
        ros-kinetic-controller-manager* \
        ros-kinetic-effort-controllers \
        ros-kinetic-joint-trajectory-controller \
        ros-kinetic-rviz* \
        libboost-filesystem-dev \
        libjsoncpp-dev
    bash -c "source /opt/ros/kinetic/setup.sh \
        && mkdir -p /moveit_ws/src \
        && cd /moveit_ws/src \
        && git clone -b kinetic-devel https://github.com/ros-planning/moveit_tutorials.git \
        && git clone https://github.com/erdalpekel/panda_moveit_config.git \
        && rosdep install -y --from-paths . --ignore-src --rosdistro kinetic \
        && cd /moveit_ws \
        && catkin config --extend /opt/ros/kinetic \
        && catkin build \
        && source /moveit_ws/devel/setup.bash
    

    【讨论】:

      猜你喜欢
      • 2012-06-25
      • 2013-10-10
      • 2015-01-01
      • 1970-01-01
      • 2021-09-10
      • 1970-01-01
      • 2010-09-30
      相关资源
      最近更新 更多