作者在配置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. 如果不想在django 的settings中保存mysql数据库的密码

    如题,你可以编写一个配置文件,用'OPTIONS' 将该配置文件导入进来,这样你发布到git上的源码上就没有你的数据库密码了. 这是django推荐的方法. # settings.py DATABAS ...

  2. java中,小数为0,保留整数,不为0,保留小数

  3. 洛谷 P1094 纪念品分类

    刚开始看到这题就确定这题最好先要排序 第一个想法是排好序后先让第一个和从倒数第一个开始相加和如果就  <= w,那么用n除以2或者再加一得出答案,然后发现随便 当w = 110  n = 5序列 ...

  4. 「CF1039D」You Are Given a Tree

    传送门 Luogu 解题思路 整体二分. 的确是很难看出来,但是你可以发现输出的答案都是一些可以被看作是关键字处于 \([1, n]\) 的询问,而答案的范围又很显然是 \([0, n]\),这不就刚 ...

  5. Redis字符串类型

    字符串是Redis中最基本的数据类型,他能存储任何形式的字符串,包括二进制数据. 命令 赋值 SET key value > SET key hello OK 取值 GET key > G ...

  6. PCS 7 V9.0 SP1安装过程截图

  7. Hive事务原理和Datax同步事务表问题解决

    一.事务的概述 1.定义 事务就是一组单元化操作,这些操作要么都执行,要么都不执行,是一个不可分割的工作单位. 2.特点 事务(transaction)具有的四个要素:原子性(Atomicity).一 ...

  8. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 按钮:内嵌下拉菜单的按钮组

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  9. 拷贝Maven工程依赖的jar包出来

    参考:https://blog.csdn.net/fengsheng5210/article/details/80491731

  10. LoadRunner之Block

    如何在一个脚本中实现不同事务不同次数的循环呢? 案例:假如你想在一个脚本中,实现登录执行1次,查询执行2次,插入执行3次,怎么办?录3个脚本?每个事务分别在脚本中复制N次? 当然不用,LR早就想到了你 ...