Skip to content

Commit a5086bf

Browse files
yeshasvitirupachuritraversaro
authored andcommitted
Add ros rviz files for icub (#23)
1 parent b69b989 commit a5086bf

File tree

5 files changed

+219
-0
lines changed

5 files changed

+219
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ endmacro()
2020
# Copy the iCub folder in the build tree
2121
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/iCub DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2222

23+
# Copy the ros folder
24+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ros DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/iCub)
25+
2326
# Add the model.config just for a limited number of models that are known
2427
# to work in Gazebo, unless the ICUB_MODELS_INSTALL_ALL_GAZEBO_MODELS option
2528
# is enabled

ros/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
This directory contains the files related to [Rviz](http://wiki.ros.org/rviz)
2+
visualization of icub. The contents of this directory are installed inside `iCub`
3+
ros package. The location of `iCub` ros pacakge is discovered by running `roscd iCub`.
4+
The `launch` directory contains `roslaunch` file `iCubRviz.launch`. The robot model
5+
that will be used for rviz visualization depends `YARP_ROBOT_NAME` set in `.bashrc`.
6+
The default rviz configuration file is `iCubRviz.rviz` located inside `rviz` directory.
7+
The steps to run rviz visualization correctly are:
8+
9+
- Ensure that the robot is started correctly with ros configuration files for motor control boards.
10+
On the real robot, the [icub_ros_wrapper.xml](https://github.com/robotology/robots-configuration/blob/devel/iCubGenova04/wrappers/motorControl/icub_ros_wrapper.xml) configuration file must be included inside the startup
11+
`xml` [configuration file](https://github.com/robotology/robots-configuration/blob/devel/iCubGenova04/icub_wbd.xml#L107).
12+
- On starting the robot, one should see `/<prefix>/joint_states` ros topic by running `rostopic list`.
13+
Also, ensure that the `/<prefix>/joint_states` streams all the robot joint angles by running
14+
`rostopic echo /<prefix>/joint_states`. The name of topic is set through [ROS_topicName](https://github.com/robotology/robots-configuration/blob/devel/iCubGenova04/wrappers/motorControl/icub_ros_wrapper.xml#L38)
15+
parameter.
16+
- Start `transform server` by running `yarprobotinterface --config transform-server.xml`.
17+
The transform server is a central location for transforms `tfs` and it streams the transforms
18+
to `/tf` ros topic.
19+
- Launch [yarprobotstatepublisher](https://github.com/robotology/idyntree/tree/master/src/tools/yarprobotstatepublisher) that takes a tf-prefix, model, base frame name, joint states topic name as input and
20+
gives all the model transforms to the transform server. An example of running `yarprobotstatepublisher` is
21+
22+
```
23+
yarprobotstatepublisher --name-prefix icub --tf-prefix /icub/ --model model.urdf --base-frame root_link --jointstates-topic "/icub04/joint_states"
24+
```
25+
- Ensure that the transforms are available correctly by running `rostopic echo /tf`.
26+
The transforms of the links are streamed with the prefix give to `--tf-prefix` of `yarprobotstatepublisher`.
27+
28+
- Rviz visualization of icub is launched by running
29+
30+
```
31+
roslaunch iCub iCubRviz.launch
32+
```
33+
34+
The following two parameters are important to ensure correct visualization:
35+
36+
- Under `Global Options`, `Fixed Frame` field is the frame name with respect to
37+
which all the other frames transforms are give. The default value set inside the `iCubRviz.rviz` configuration value is `icub/root_link`.
38+
39+
![Selection_001](https://user-images.githubusercontent.com/6505998/62306298-e064e400-b481-11e9-9b5e-c665b5aaa5ff.png)
40+
41+
42+
- The next parameter is under `Robot Model`, `TF Prefix`. The default value set inside the `iCubRviz.rviz` configuration value is `icub`.
43+
The value of the parameter should match the `--tf-prefix` of `yarprobotstatepublisher` for rviz to get the correct transforms to visualize the model.
44+
45+
![Screenshot from 2019-08-01 11-37-26](https://user-images.githubusercontent.com/6505998/62283354-ab409d80-b451-11e9-9811-bd9158548e3e.png)
46+
47+
The contents of this directory are tested on:
48+
49+
##### Linux
50+
51+
```
52+
Ubuntu 18.04 LTS
53+
Rosdistro: Melodic
54+
Rosversion: 1.14.3
55+
```
56+
57+
##### MacOS
58+
59+
```
60+
MacOs High Sierra 10.13.6
61+
Rosdistro: Lunar
62+
Rosversion: 1.13.7
63+
```

ros/launch/iCubRviz.launch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<launch>
2+
<arg name="Robot"/>
3+
<arg name="gui" default="False"/>
4+
<arg name="vel" default="True"/>
5+
<arg name="eff" default="True"/>
6+
<arg name="YARP_ROBOT_NAME" default="$(env YARP_ROBOT_NAME)"/>
7+
<arg name="robotModel" default="$(find iCub)/robots/$(arg YARP_ROBOT_NAME)/model.urdf "/>
8+
<arg name="rvizconfig" default="$(find iCub)/ros/rviz/iCubRviz.rviz"/>
9+
10+
<param name="robot_description" command="$(find xacro)/xacro $(arg robotModel)" />
11+
<param name="use_gui" value="$(arg gui)"/>
12+
13+
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
14+
</launch>

ros/rviz/iCubRviz.rviz

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
Panels:
2+
- Class: rviz/Displays
3+
Help Height: 84
4+
Name: Displays
5+
Property Tree Widget:
6+
Expanded: ~
7+
Splitter Ratio: 0.5
8+
Tree Height: 1043
9+
- Class: rviz/Selection
10+
Name: Selection
11+
- Class: rviz/Views
12+
Expanded:
13+
- /Current View1
14+
Name: Views
15+
Splitter Ratio: 0.5
16+
- Class: rviz/Time
17+
Experimental: false
18+
Name: Time
19+
SyncMode: 0
20+
SyncSource: ""
21+
Preferences:
22+
PromptSaveOnExit: true
23+
Toolbars:
24+
toolButtonStyle: 2
25+
Visualization Manager:
26+
Class: ""
27+
Displays:
28+
- Alpha: 0.5
29+
Cell Size: 1
30+
Class: rviz/Grid
31+
Color: 173; 173; 177
32+
Enabled: true
33+
Line Style:
34+
Line Width: 0.029999999329447746
35+
Value: Billboards
36+
Name: Grid
37+
Normal Cell Count: 0
38+
Offset:
39+
X: 0
40+
Y: 0
41+
Z: 0
42+
Plane: XY
43+
Plane Cell Count: 1000
44+
Reference Frame: <Fixed Frame>
45+
Value: true
46+
- Alpha: 1
47+
Class: rviz/RobotModel
48+
Collision Enabled: false
49+
Enabled: true
50+
Links:
51+
All Links Enabled: true
52+
Expand Joint Details: false
53+
Expand Link Details: false
54+
Expand Tree: false
55+
Link Tree Style: Links in Alphabetic Order
56+
Name: RobotModel
57+
Robot Description: robot_description
58+
TF Prefix: icub
59+
Update Interval: 0
60+
Value: true
61+
Visual Enabled: true
62+
Enabled: true
63+
Global Options:
64+
Background Color: 255; 255; 255
65+
Default Light: true
66+
Fixed Frame: icub/root_link
67+
Frame Rate: 60
68+
Name: root
69+
Tools:
70+
- Class: rviz/Interact
71+
Hide Inactive Objects: true
72+
- Class: rviz/MoveCamera
73+
- Class: rviz/Select
74+
- Class: rviz/FocusCamera
75+
- Class: rviz/Measure
76+
- Class: rviz/SetInitialPose
77+
Theta std deviation: 0.2617993950843811
78+
Topic: /initialpose
79+
X std deviation: 0.5
80+
Y std deviation: 0.5
81+
- Class: rviz/SetGoal
82+
Topic: /move_base_simple/goal
83+
- Class: rviz/PublishPoint
84+
Single click: true
85+
Topic: /clicked_point
86+
Value: true
87+
Views:
88+
Current:
89+
Class: rviz/Orbit
90+
Distance: 7.744000434875488
91+
Enable Stereo Rendering:
92+
Stereo Eye Separation: 0.05999999865889549
93+
Stereo Focal Distance: 1
94+
Swap Stereo Eyes: false
95+
Value: false
96+
Focal Point:
97+
X: -0.16518345475196838
98+
Y: 0.3169254660606384
99+
Z: 0.5606259107589722
100+
Focal Shape Fixed Size: true
101+
Focal Shape Size: 0.05000000074505806
102+
Invert Z Axis: false
103+
Name: Current View
104+
Near Clip Distance: 0.009999999776482582
105+
Pitch: 0.3903980255126953
106+
Target Frame: <Fixed Frame>
107+
Value: Orbit (rviz)
108+
Yaw: 0.770397961139679
109+
Saved: ~
110+
Window Geometry:
111+
"&Displays":
112+
collapsed: false
113+
"&Time":
114+
collapsed: false
115+
"&Views":
116+
collapsed: false
117+
Height: 768
118+
Hide Left Dock: false
119+
Hide Right Dock: false
120+
QMainWindow State: 000000ff00000000fd00000004000000000000016a000004b4fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000007601000003fb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000044000004b4000000f701000003fb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c000002610000000100000110000004b4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000044000004b4000000d001000003fb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e1000001970000000300000a000000004cfc0100000002fb0000000800540069006d0065010000000000000a00000002ad01000003fb0000000800540069006d0065010000000000000450000000000000000000000784000004b400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
121+
Selection:
122+
collapsed: false
123+
Tool Properties:
124+
collapsed: false
125+
Width: 1024
126+
X: 2880
127+
Y: 0

ros/transform-server.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<robot name="Transform-Server" build=0 portprefix="">
3+
4+
<device type="transformServer" name="TransformServer">
5+
<param name="transforms_lifetime">0.2</param>
6+
<group name="ROS">
7+
<param name="enable_ros_publisher">true</param>
8+
<param name="enable_ros_subscriber">false</param>
9+
</group>
10+
</device>
11+
12+
</robot>

0 commit comments

Comments
 (0)