整理一下Aubo机器人的ROS环境搭建步骤
-
完成
WSL(Window system for Linux)下安装ROS
- 安装部分依赖包
sudo apt-get install ros-kinetic-moveit
sudo apt-get install ros-kinetic-industrial-core
- 建立工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
-
从GitHub中下载
Aubo源代码
git clone https://github.com/lg609/aubo_robot.git
- 编译源代码
sudo apt-get install ros-kinetic-moveit-visual-tools
//rosdep install --from-paths src --ignore-src -r -y
cd ~/catkin_ws
catkin_make
如果编译时提示类似下方关于boost的Cmake Warning:
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message):
catkin_package() DEPENDS on 'boost' but neither 'boost_INCLUDE_DIRS' nor
'boost_LIBRARIES' is defined.
只需在
~/WS_name/src/aubo_robot/aubo_kinematics
目录中编辑
CMakeLists
文件,将其中的
DEPENDS boost
修改为
DEPENDS Boost
即可。
将工作空间加入环境变量中
echo 'source ~/WS_name/devel/setup.bash' >> ~/.bashrc
-
更新
Moveit_core_lib
cd ~/catkin_ws/src/aubo_robot/UpdateMoveitLib/Kinetic
chmod +x Update.sh
//赋以所有用户对Update.sh的执行权限,去除用chmod -x
sudo ./Update.sh
- 编辑.bashrc文件
sudo edit ~/.bashrc
在文件末尾添加
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/你的工作空间路径/src
例如:
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/catkin_ws/src
并确认文件中包含类似下面的文字指明环境信息
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
esc,:wq保存退出
执行
cd ~/
source ~/.bashrc
可以
export | grep ROS
查看ROS package路径
安装Ubuntu桌面环境
Windows中下载
vcxsrv
按照提示缺省安装好,并打开。
sudo apt install xfce4 dbus-x11
启动
xfce4-session
如果有类似的提示
ERROR: cannot launch node of type [aubo_controller/aubo_joint_trajectory_action]: can't locate node
可尝试
source devel/setup.bash
Mark: Ubuntu的复制粘贴操作
文字复制与粘贴:
左键鼠标***选中所需用的文字,到需要粘贴的地方按***鼠标中键
,现在一般就是滚轮了。这个在各个程序之间也是可以使用的,包括终端下使用。
First set up the MoveIt nodes to allow motion planning and run:
rviz
roslaunch aubo_i5_moveit_config moveit_planning_execution.launch robot_ip:=127.0.0.1
gazebo
roslaunch aubo_gazebo aubo_i5_gazebo_control.launch
you should install some package when you use aubo model in gazebo
sudo apt-get install ros-kinetic-gazebo-ros-control
sudo apt-get install ros-kinetic-joint-state-controller
sudo apt-get install ros-kinetic-effort-controllers
sudo apt-get install ros-kinetic-position-controllers
Then select
"Interact"
and move the end-effector to a new goal.
In
"Motion Planning"
->
"Plan and Execute"
to send trajectory to the sim robot
机械臂执行轨迹时报超时的错误
找到
~/catkin_ws/src/aubo_robot/aubo_i5_moveit_config/launch
中的
move_group.launch
文件
找到
<node name="move_group">
标签,在其中添加以下参数:
<param name="trajectory_execution/allowed_execution_duration_scaling" value="6"/>
<param name="trajectory_execution/allowed_goal_duration_margin" value="0.5"/>
或者直接关掉对轨迹执行的监视
<param name="trajectory_execution/execution_duration_monitoring" value="false"/>
运行gazebo时的顺序
运行的是
~/catkin_ws/src/aubo_robot/aubo_gazebo/launch/aubo_i5_gazebo_control.launch
包括:
<!-- 1.load urdf to Gazebo -->
<!-- startup Gazebo -->
<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<!-- We resume the logic in empty_world.launch -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
</include>
<!-- Load the URDF into the ROS Parameter Server -->
<param name="robot_description" textfile="$(find aubo_gazebo)/urdf/aubo_i5.xacro"/>
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model arm -param robot_description"/>
<!-- 2.JointStateController and robot state publisher -->
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find aubo_gazebo)/config/aubo_i5_gazebo_control.yaml" command="load"/>
<!-- 3.load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/aubo_i5" args="joint_state_controller
shoulder_joint_position_controller
upperArm_joint_position_controller
foreArm_joint_position_controller
wrist1_joint_position_controller
wrist2_joint_position_controller
wrist3_joint_position_controller"/>
<!--4. run transform node /joint_state -> /gazebo every joint/command -->
<node name="aubo_gazebo_driver" pkg="aubo_driver" type="aubo_gazebo_driver" />
运行gazebo时报错:
[ERROR] [1527494740.144219702, 307.635000000]: GazeboRosControlPlugin missing <legacyModeNS> while using DefaultRobotHWSim, defaults to true.
This setting assumes you have an old package with an old implementation of DefaultRobotHWSim, where the robotNamespace is disregarded and absolute paths are used instead.
If you do not want to fix this issue in an old package just set <legacyModeNS> to true.
找到
~/catkin_ws/src/aubo_robot/aubo_gazebo/urdf
中的
aubo_i5.xacro
文件
找到
<!-- ros_control plugin --><gazebo>
标签,修改为:
<!-- ros_control plugin -->
<gazebo>
<static>false</static>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/aubo_i5</robotNamespace>
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
<legacyModeNS>true</legacyModeNS>
</plugin>
</gazebo>