Difference between revisions of "Vision System Setup"

From RobotForAll
Jump to: navigation, search
(edit the astra.urdf.xacro)
(add astra to your turtlebot)
 
Line 106: Line 106:
 
=== add astra to your turtlebot===
 
=== add astra to your turtlebot===
  
  $roscd roscd turtlebot_description/robots   
+
  $roscd turtlebot_description/robots   
 
  $gedit kobuki_hexagons_kinect.urdf.xacro  
 
  $gedit kobuki_hexagons_kinect.urdf.xacro  
  

Latest revision as of 15:37, 8 September 2019

intall astra driver

download OpenNI-Linux-x64-2.3.zip and install:

https://github.com/HilbertXu/KameRider_GPSR/tree/RoboCup2019/src/Prerequirements

$cd OpenNI-Linux-x64-2.3
$sudo chmod a+x install.sh
$sudo ./install.sh

install libuvc:

$git clone https://github.com/ktossell/libuvc
$cd libuvc
$mkdir build
$cd build
$cmake ..
$make && sudo make install

install astra_launch:

$sudo apt-get install ros-kinetic-astra-launch ros-kinetic-astra-camera

edit the astra.urdf.xacro

important: in order to avoid frame name conflict with kinect, change all the "camera" to "astra" in this file

after replace, your urdf file will look like this:

 1 <?xml version="1.0"?>
 2 <robot name="sensor_astra" xmlns:xacro="http://ros.org/wiki/xacro">
 3   <xacro:include filename="$(find turtlebot_description)/urdf/turtlebot_gazebo.urdf.xacro"/>
 4   <xacro:include filename="$(find turtlebot_description)/urdf/turtlebot_properties.urdf.xacro"/>
 5 
 6   <!-- Xacro properties -->
 7   <xacro:property name="astra_cam_py" value="-0.0125"/>
 8   <xacro:property name="astra_depth_rel_rgb_py" value="0.0250" />
 9   <xacro:property name="astra_cam_rel_rgb_py"   value="-0.0125" />
10   <xacro:property name="astra_dae_display_scale"   value="1" />
11   <!-- Parameterised in part by the values in turtlebot_properties.urdf.xacro -->
12   <xacro:macro name="sensor_astra" params="parent">
13     <joint name="astra_rgb_joint" type="fixed">
14       <origin xyz="-0.019 -0.005 0.607"
15               rpy="0 0.12217305 0"/>
16       <parent link="${parent}"/>
17       <child link="astra_rgb_frame" />
18     </joint>
19     <link name="astra_rgb_frame"/>
20 
21     <joint name="astra_rgb_optical_joint" type="fixed">
22       <origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
23       <parent link="astra_rgb_frame" />
24       <child link="astra_rgb_optical_frame" />
25     </joint>
26     <link name="astra_rgb_optical_frame"/>
27 
28     <joint name="astra_joint" type="fixed">
29       <origin xyz="0 ${astra_cam_rel_rgb_py} 0"
30               rpy="0 0 0"/>
31       <parent link="astra_rgb_frame"/>
32       <child link="astra_link"/>
33     </joint>
34     <link name="astra_link">
35       <visual>
36         <origin xyz="-0.04 0.02 -0.01" rpy="${M_PI/2} 0 ${M_PI/2}"/>
37         <geometry>
38           <mesh filename="package://turtlebot_description/meshes/sensors/astra.dae" scale="${astra_dae_display_scale} ${astra_dae_display_scale} ${astra_dae_display_scale}"/>
39         </geometry>
40       </visual>
41       <collision>
42         <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
43         <geometry>
44         <box size="0.0400 0.1650 0.0300"/>
45       </geometry>
46       </collision>
47       <inertial>
48         <mass value="0.564" />
49         <origin xyz="0 0 0" />
50         <inertia ixx="0.003881243" ixy="0.0" ixz="0.0"
51                  iyy="0.000498940" iyz="0.0"
52                  izz="0.003879257" />
53       </inertial>
54     </link>
55 
56     <joint name="astra_depth_joint" type="fixed">
57       <origin xyz="0 ${astra_depth_rel_rgb_py} 0" rpy="0 0 0" />
58       <parent link="astra_rgb_frame" />
59       <child link="astra_depth_frame" />
60     </joint>
61     <link name="astra_depth_frame"/>
62 
63     <joint name="astra_depth_optical_joint" type="fixed">
64       <origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
65       <parent link="astra_depth_frame" />
66       <child link="astra_depth_optical_frame" />
67     </joint>
68     <link name="astra_depth_optical_frame"/>
69 
70     <!-- RGBD sensor for simulation, same as Kinect -->
71     <turtlebot_sim_3dsensor/>
72 
73   </xacro:macro>
74 </robot>

add astra to your turtlebot

$roscd turtlebot_description/robots  
$gedit kobuki_hexagons_kinect.urdf.xacro 

add two labels:

1 <xacro:include filename="$(find turtlebot_description)/urdf/sensors/astra.urdf.xacro"/>
2 <sensor_astra parent="plate_top_link"/>

download astra description files:

https://github.com/HilbertXu/KameRider_GPSR/tree/RoboCup2019/src/Prerequirements/turtlebot_description

$roscd turtlebot_description/urdf/sensors/

put the astra.urdf.xacro in this folder

$gedit astra.urdf.xacro

change like this:

1    <joint name="astra_rgb_joint" type="fixed">
2       <origin xyz="-0.019 -0.005 0.607"
3               rpy="0 0.12217305 0"/>
4       <parent link="${parent}"/>
5       <child link="astra_rgb_frame" />
6     </joint>

xyz and rpy can be modified based on your need

visualization:

download urdf tutorial:

$git clone https://github.com/ros/urdf_tutorial

have a look at your robot:

$roslaunch urdf_tutorial display.launch model:=/path/to/your/turtlebot_description/robots/kobuki_hexagons_kinect.urdf.xacro

an example:

Urdf.png