作者在配置pibot机器人时报错:

Invalid <arg> tag: environment variable 'PIBOT_MODEL' is not set.

Arg xml is <arg default="$(env PIBOT_MODEL)" doc="model type [apollo, zeus, hades, hera]" name="model"/>
The traceback for the exception was written to the log file

解决方案:

环境未配置

配置环境即可

./pibot_init_env.sh
source ~/.bashrc

其中,pibot_init_env.sh文件源码如下:

 #!/bin/bash

 if ! [ $PIBOT_ENV_INITIALIZED ]; then
echo "export PIBOT_ENV_INITIALIZED=1" >> ~/.bashrc
echo "source ~/.pibotrc" >> ~/.bashrc #rules
echo "setup pibot modules"
echo " "
sudo cp rules/pibot.rules /etc/udev/rules.d
sudo cp rules/rplidar.rules /etc/udev/rules.d
sudo cp rules/ydlidar.rules /etc/udev/rules.d
sudo cp rules/orbbec.rules /etc/udev/rules.d
echo " "
echo "Restarting udev"
echo ""
sudo service udev reload
sudo service udev restart
fi code_name=$(lsb_release -sc) if [ "$code_name" = "trusty" ]; then
ros_version="indigo"
elif [ "$code_name" = "xenial" ]; then
ros_version="kinetic"
else
echo "PIBOT not support "$code_name
exit
fi echo "source /opt/ros/${ros_version}/setup.bash" > ~/.pibotrc #LOCAL_IP=`ifconfig eth0|grep "inet addr:"|awk -F":" '{print $2}'|awk '{print $1}'`
#LOCAL_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | awk -F"/" '{print $1}'` #if [ ! ${LOCAL_IP} ]; then
# echo "please check network"
# exit
#fi LOCAL_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | awk -F"/" '{print $1}'`
echo "LOCAL_IP=\`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print \$2}' | awk -F"/" '{print \$1}'\`" >> ~/.pibotrc if [ ! ${LOCAL_IP} ]; then
echo "please check network"
exit
fi read -p "please specify pibot model(0:apollo,1:apolloX,2:zeus,3:hera,4:hades,other for user defined):" PIBOT_MODEL_INPUT if [ "$PIBOT_MODEL_INPUT" = "" ]; then
PIBOT_MODEL='apollo'
elif [ "$PIBOT_MODEL_INPUT" = "" ]; then
PIBOT_MODEL='apolloX'
elif [ "$PIBOT_MODEL_INPUT" = "" ]; then
PIBOT_MODEL='zeus'
elif [ "$PIBOT_MODEL_INPUT" = "" ]; then
PIBOT_MODEL='hera'
elif [ "$PIBOT_MODEL_INPUT" = "" ]; then
PIBOT_MODEL='hades'
else
PIBOT_MODEL=$PIBOT_MODEL_INPUT
fi read -p "please specify your pibot lidar(0:rplidar,1:rplidar-a3,2:eai-x4,3:eai-g4,4:xtion,5:astra,6:kinectV1,other for user defined):" PIBOT_LIDAR_INPUT if [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='rplidar'
elif [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='rplidar-a3'
elif [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='eai-x4'
elif [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='eai-g4'
elif [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='xtion'
elif [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='astra'
elif [ "$PIBOT_LIDAR_INPUT" = "" ]; then
PIBOT_LIDAR='kinectV1'
else
PIBOT_LIDAR=$PIBOT_LIDAR_INPUT
fi echo "export ROS_IP=\`echo \$LOCAL_IP\`" >> ~/.pibotrc
echo "export ROS_HOSTNAME=\`echo \$LOCAL_IP\`" >> ~/.pibotrc
echo "export PIBOT_MODEL=${PIBOT_MODEL}" >> ~/.pibotrc
echo "export PIBOT_LIDAR=${PIBOT_LIDAR}" >> ~/.pibotrc read -p "please select specify the current machine(ip:$LOCAL_IP) type(0:onboard,other:remote):" PIBOT_MACHINE_VALUE
if [ "$PIBOT_MACHINE_VALUE" = "" ]; then
ROS_MASTER_IP_STR="\`echo \$LOCAL_IP\`"
ROS_MASTER_IP=`echo $LOCAL_IP`
else
read -p "plase specify the onboard machine ip for commnicationi:" PIBOT_ONBOARD_MACHINE_IP
ROS_MASTER_IP_STR=`echo $PIBOT_ONBOARD_MACHINE_IP`
ROS_MASTER_IP=`echo $PIBOT_ONBOARD_MACHINE_IP`
fi echo "export ROS_MASTER_URI=`echo http://${ROS_MASTER_IP_STR}:11311`" >> ~/.pibotrc echo "*****************************************************************"
echo "model: " $PIBOT_MODEL
echo "lidar:" $PIBOT_LIDAR
echo "local_ip: " ${LOCAL_IP}
echo "onboard_ip:" ${ROS_MASTER_IP}
echo ""
echo "please execute source ~/.bashrc to make the configure effective"
echo "*****************************************************************" echo "source ~/pibot_ros/ros_ws/devel/setup.bash" >> ~/.pibotrc #alias
echo "alias pibot_bringup='roslaunch pibot_bringup bringup.launch'" >> ~/.pibotrc
echo "alias pibot_bringup_with_imu='roslaunch pibot_bringup bringup_with_imu.launch'" >> ~/.pibotrc
echo "alias pibot_lidar='roslaunch pibot_bringup ${PIBOT_LIDAR}.launch'" >> ~/.pibotrc
echo "alias pibot_base='roslaunch pibot_bringup robot.launch'" >> ~/.pibotrc
echo "alias pibot_base_with_imu='roslaunch pibot_bringup robot_with_imu.launch'" >> ~/.pibotrc
echo "alias pibot_control='roslaunch pibot keyboard_teleop.launch'" >> ~/.pibotrc echo "alias pibot_gmapping='roslaunch pibot_navigation gmapping.launch'" >> ~/.pibotrc
echo "alias pibot_gmapping_with_imu='roslaunch pibot_navigation gammaping_with_imu.launch'" >> ~/.pibotrc
echo "alias pibot_save_map='roslaunch pibot_navigation save_map.launch'" >> ~/.pibotrc echo "alias pibot_naviagtion='roslaunch pibot_navigation nav.launch'" >> ~/.pibotrc
echo "alias pibot_naviagtion_with_imu='roslaunch pibot_navigation nav_with_imu.launch'" >> ~/.pibotrc
echo "alias pibot_view='roslaunch pibot_navigation view_nav.launch'" >> ~/.pibotrc echo "alias pibot_cartographer='roslaunch pibot_navigation cartographer.launch'" >> ~/.pibotrc
echo "alias pibot_view_cartographer='roslaunch pibot_navigation view_cartographer.launch'" >> ~/.pibotrc echo "alias pibot_hector_mapping='roslaunch pibot_navigation hector_mapping.launch'" >> ~/.pibotrc
echo "alias pibot_hector_mapping_without_imu='roslaunch pibot_navigation hector_mapping_without_odom.launch'" >> ~/.pibotrc echo "alias pibot_karto_slam='roslaunch pibot_navigation karto_slam.launch'" >> ~/.pibotrc

其他出现类似报错的可以参考上面的代码直接把环境变量加到~/.bashrc里面。

ROS常见问题(二) 运行文件时报错environment variable ' ###_MODEL' is not set的更多相关文章

  1. python 使用read_csv读取 CSV 文件时报错

    读取csv文件时报错 df = pd.read_csv('c:/Users/NUC/Desktop/成绩.csv' ) Traceback (most recent call last):  File ...

  2. python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib

    python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib ...

  3. javah生成jni头文件时报错 Error: cannot access android.support...

    javah生成jni头文件时报错: Error: cannot access android.support.v7.app.AppCompatActivity class file for andro ...

  4. python读取txt文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte sequence

    python读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte ...

  5. Debug运行项目时报错,connected to the target VM, address: '127.0.0.1:50495', transport: 'socket'

    Debug运行项目时报错,无法进入Debug,猜想出错原因可能是未正确关闭IDEA. 解决方法,先直接运行项目,然后停掉项目,再用Debug模式启动,问题解决.

  6. python 读取文件时报错UnicodeDecodeError

    python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib ...

  7. 命令行运行命令时报错You don&#39;t have write permissions for the /Library/***

    这是由于要运行这些操作时必须有管理员的权限(比方更新软件),比方更新cocoapods时报错 soindy:SmartThermo soindy$ gem install cocoapods Fetc ...

  8. 在英文Windows操作系统上使用SQL Server Management Studio(SSMS)导入Excel 97-2003文件时报错:Failure creating file

    今天在公司服务器上使用SQL Server Management Studio(SSMS)导入Excel 97-2003文件(.xls)时报错: Failure creating file. (Mic ...

  9. bladex下载前端代码后,运行服务时报错【'vue-cli-service' 不是内部或外部命令,也不是可运行的程序或批处理文件。】的解决方法

    问题:E:\BladeXDB\Saber>yarn run serveyarn run v1.13.0$ vue-cli-service serve'vue-cli-service' 不是内部或 ...

随机推荐

  1. lnmp1.5下安装mongodb

    一.安装mongodb .下载MongoDB 2.6.0二进制发行版 $ curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64 ...

  2. Django 数据库访问性能优化

    使用标准的数据库优化技术: 在进行Django数据库访问性能优化之前,首先应该使用标准的数据库技术对其进行优化,比如给字段加索引,通过使用 django.db.models.Field.db_inde ...

  3. Struts2出现的问题:

    HTTP 500: 在用通配符配置Method时候,action的形式固定,比如customer_*,那么只用一个Action类比如CustomerAction即可. 在配置的时候,不同的方法在同一个 ...

  4. Jquery实现功能---购物车

    //需求,勾选选项时,总价格要跟着变,点击添加数量,总价格也要跟着变,全部要动态变化 //代码如下 <!DOCTYPE html> <html> <head> &l ...

  5. SciPy 介绍

    章节 SciPy 介绍 SciPy 安装 SciPy 基础功能 SciPy 特殊函数 SciPy k均值聚类 SciPy 常量 SciPy fftpack(傅里叶变换) SciPy 积分 SciPy ...

  6. vue前端项目初始化的步骤

    前端项目初始化的步骤 1. 安装vue脚手架 2.通过vue脚手架创建项目 可以直接    vue create  项目名 也可以 vue ui 3.配置vue路由 4.配置Element-ui 组件 ...

  7. Python测试进阶——(2)配置PyCharm远程调试环境

    新建一个Python项目 配置Deployment,用于本地文件和远程文件的同步,在pycharm的菜单栏依次找到:Tools > Deployment > Configuration 点 ...

  8. ESX/ESXi 主机上的每个插槽中安装了多少内存

    要确定在 ESX/ESXi 主机上的每个插槽中安装了多少内存,请执行以下操作: 1. 启动ssh服务 2. 登陆esxi主机查看 使用 SSH 客户端登录主机,以 root 用户身份运行以下命令之一: ...

  9. XtraReport1添加参数

    解决了在report有个BeforePrint事件这里面直接 C# code   ? 1 string year = this.Parameters["year"].Value.T ...

  10. Java虚拟机05.1(各种环境下jvm的参数如何调整?)

    cmd下 eclipse下 tomcat下 cmd下指定jvm参数 在cmd下执行Java程序可以通过如下方式之地需要配置的Java 虚拟机参数: 这里只是指定了对初始为2M,新生代为1M,堆最大值为 ...