Skip to content

Commit 903e857

Browse files
committed
add ovis integration
1 parent 522dc3c commit 903e857

File tree

6 files changed

+223
-81
lines changed

6 files changed

+223
-81
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Before installing the robot software, you need to install the simulator : https:
4646
git clone https://github.com/clubcapra/rove.git
4747
cd rove
4848
vcs import src < rove.repos
49+
echo "export GZ_VERSION=harmonic" >> ~/.bashrc && source ~/.bashrc
4950
sudo rosdep init
5051
rosdep update
5152
rosdep install --from-paths src --ignore-src -r -y

rove.repos

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ repositories:
66
ovis_ros2:
77
type: git
88
url: https://github.com/clubcapra/ovis_ros2
9-
version: new-env-with-arm
9+
version: fix-gazebo-joy
10+
gz_ros2_control:
11+
type: git
12+
url: https://github.com/clubcapra/gz_ros2_control.git
13+
version: iron

src/rove_bringup/launch/sim.launch.py

Lines changed: 113 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,109 +3,129 @@
33
from ament_index_python.packages import get_package_share_directory
44
from launch import LaunchDescription
55
from launch.actions import IncludeLaunchDescription
6-
76
from launch.launch_description_sources import PythonLaunchDescriptionSource
87
from launch.substitutions import Command
98
from launch_ros.actions import Node
109
from launch_ros.parameter_descriptions import ParameterValue
11-
from math import pi
1210

1311

1412
def generate_launch_description():
1513
# Get the launch directory
16-
pkg_rove_bringup = get_package_share_directory('rove_bringup')
17-
pkg_rove_description = get_package_share_directory('rove_description')
18-
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')
14+
pkg_rove_bringup = get_package_share_directory("rove_bringup")
15+
pkg_rove_description = get_package_share_directory("rove_description")
16+
pkg_ros_gz_sim = get_package_share_directory("ros_gz_sim")
17+
pkg_ovis = get_package_share_directory("ovis_bringup")
1918

2019
# Get the URDF file
21-
urdf_path = os.path.join(pkg_rove_description, 'urdf', 'rove.urdf.xacro')
22-
robot_desc = ParameterValue(Command(['xacro ', urdf_path]), value_type=str)
20+
urdf_path = os.path.join(pkg_rove_description, "urdf", "rove.urdf.xacro")
21+
robot_desc = ParameterValue(Command(["xacro ", urdf_path]), value_type=str)
2322

2423
# Get simulation file
25-
world_file_name = 'worlds/base_world.world'
24+
world_file_name = "worlds/base_world.world"
2625
world = os.path.join(pkg_rove_description, world_file_name)
2726

2827
# Setup to launch the simulator and Gazebo world
2928
gz_sim = IncludeLaunchDescription(
3029
PythonLaunchDescriptionSource(
31-
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')),
32-
launch_arguments={'gz_args': "-v 4 -r " + world}.items(),
30+
os.path.join(pkg_ros_gz_sim, "launch", "gz_sim.launch.py")
31+
),
32+
launch_arguments={"gz_args": "-v 4 -r " + world}.items(),
3333
)
3434

35-
walls_file_path = os.path.join(pkg_rove_description, 'worlds', 'walls.sdf')
35+
walls_file_path = os.path.join(pkg_rove_description, "worlds", "walls.sdf")
3636
spawn_walls = Node(
37-
package='ros_gz_sim',
38-
executable='create',
39-
arguments=['-file', walls_file_path,
40-
'-name', 'walls',
41-
'-x', '0',
42-
'-y', '0',
43-
'-z', '0'],
44-
output='screen',
37+
package="ros_gz_sim",
38+
executable="create",
39+
arguments=[
40+
"-file",
41+
walls_file_path,
42+
"-name",
43+
"walls",
44+
"-x",
45+
"0",
46+
"-y",
47+
"0",
48+
"-z",
49+
"0",
50+
],
51+
output="screen",
4552
)
4653

47-
actor_file_path = os.path.join(pkg_rove_description, 'worlds', 'actor.sdf')
54+
actor_file_path = os.path.join(pkg_rove_description, "worlds", "actor.sdf")
4855
spawn_actor = Node(
49-
package='ros_gz_sim',
50-
executable='create',
51-
arguments=['-file', actor_file_path,
52-
'-name', 'actor',
53-
'-topic', 'actor_pose',
54-
'-x', '0',
55-
'-y', '0',
56-
'-z', '0.1'],
57-
output='screen',
56+
package="ros_gz_sim",
57+
executable="create",
58+
arguments=[
59+
"-file",
60+
actor_file_path,
61+
"-name",
62+
"actor",
63+
"-x",
64+
"0",
65+
"-y",
66+
"0",
67+
"-z",
68+
"0.1",
69+
],
70+
output="screen",
5871
)
5972

60-
yaw = -pi / 2
61-
6273
# Spawn robot
6374
spawn_rove = Node(
64-
package='ros_gz_sim',
65-
executable='create',
75+
package="ros_gz_sim",
76+
executable="create",
6677
arguments=[
67-
'-name', 'rove',
68-
'-topic', 'robot_description',
69-
'-x', '0',
70-
'-y', '0',
71-
'-z', '0.1',
72-
'-Y', str(yaw),
78+
"-name",
79+
"rove",
80+
"-topic",
81+
"robot_description",
82+
"-x",
83+
"0",
84+
"-y",
85+
"0",
86+
"-z",
87+
"0.1",
7388
],
74-
output='screen',
89+
output="screen",
7590
)
7691

7792
# Takes the description and joint angles as inputs and publishes
7893
# the 3D poses of the robot links
7994
robot_state_publisher = Node(
80-
package='robot_state_publisher',
81-
executable='robot_state_publisher',
82-
name='robot_state_publisher',
83-
output='both',
95+
package="robot_state_publisher",
96+
executable="robot_state_publisher",
97+
name="robot_state_publisher",
98+
output="both",
8499
parameters=[
85-
{'robot_description': robot_desc},
86-
{"use_sim_time": True, }
87-
]
100+
{"robot_description": robot_desc},
101+
{
102+
"use_sim_time": True,
103+
},
104+
],
88105
)
89106

90107
# fake human tracker
91108
human_tracker = Node(
92-
package='rove_navigation',
93-
executable='green_person_tracker',
94-
name='green_person_tracker',
95-
output='screen',
109+
package="rove_navigation",
110+
executable="green_person_tracker",
111+
name="green_person_tracker",
112+
output="screen",
96113
)
97114

98115
# Bridge ROS topics and Gazebo messages for establishing communication
99116
bridge = Node(
100-
package='ros_gz_bridge',
101-
executable='parameter_bridge',
102-
parameters=[{
103-
'config_file': os.path.join(pkg_rove_description, 'config',
104-
'default_bridge.yaml'),
105-
'qos_overrides./tf_static.publisher.durability': 'transient_local',
106-
"use_sim_time": True,
107-
}],
108-
output='screen'
117+
package="ros_gz_bridge",
118+
executable="parameter_bridge",
119+
parameters=[
120+
{
121+
"config_file": os.path.join(
122+
pkg_rove_description, "config", "default_bridge.yaml"
123+
),
124+
"qos_overrides./tf_static.publisher.durability": "transient_local",
125+
"use_sim_time": True,
126+
}
127+
],
128+
output="screen",
109129
)
110130

111131
common = IncludeLaunchDescription(
@@ -117,13 +137,43 @@ def generate_launch_description():
117137
}.items(),
118138
)
119139

120-
return LaunchDescription([
140+
static_tf_ovis = Node(
141+
package="tf2_ros",
142+
executable="static_transform_publisher",
143+
arguments=[
144+
"0.25",
145+
"0",
146+
"0.25",
147+
"0",
148+
"0",
149+
"3.14",
150+
"base_link",
151+
"ovis_base_link",
152+
],
153+
)
154+
155+
ovis = IncludeLaunchDescription(
156+
PythonLaunchDescriptionSource(
157+
os.path.join(pkg_ovis, "launch", "sim.launch.py"),
158+
),
159+
launch_arguments={
160+
"with_rove": "true",
161+
"with_joy": "false",
162+
"ovis_base_origin": "0.25 0 0.25 0 0 3.14",
163+
}.items(),
164+
)
165+
166+
return LaunchDescription(
167+
[
121168
gz_sim,
122169
bridge,
123170
robot_state_publisher,
124171
spawn_walls,
125172
spawn_actor,
126173
spawn_rove,
127174
common,
128-
human_tracker,
129-
])
175+
# human_tracker,
176+
ovis,
177+
static_tf_ovis,
178+
]
179+
)

src/rove_description/config/basic.rviz

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Panels:
55
Property Tree Widget:
66
Expanded:
77
- /DepthCloud1/Auto Size1
8+
- /RobotModel2/Status1
89
Splitter Ratio: 0.5
910
Tree Height: 325
1011
- Class: rviz_common/Selection
@@ -472,6 +473,79 @@ Visualization Manager:
472473
Use Fixed Frame: true
473474
Use rainbow: true
474475
Value: true
476+
- Alpha: 1
477+
Class: rviz_default_plugins/RobotModel
478+
Collision Enabled: false
479+
Description File: ""
480+
Description Source: Topic
481+
Description Topic:
482+
Depth: 5
483+
Durability Policy: Volatile
484+
History Policy: Keep Last
485+
Reliability Policy: Reliable
486+
Value: /ovis/robot_description
487+
Enabled: true
488+
Links:
489+
All Links Enabled: true
490+
Expand Joint Details: false
491+
Expand Link Details: false
492+
Expand Tree: false
493+
Link Tree Style: Links in Alphabetic Order
494+
base_link:
495+
Alpha: 1
496+
Show Axes: false
497+
Show Trail: false
498+
ovis_base_link:
499+
Alpha: 1
500+
Show Axes: false
501+
Show Trail: false
502+
ovis_end_effector:
503+
Alpha: 1
504+
Show Axes: false
505+
Show Trail: false
506+
ovis_link_1:
507+
Alpha: 1
508+
Show Axes: false
509+
Show Trail: false
510+
Value: true
511+
ovis_link_2:
512+
Alpha: 1
513+
Show Axes: false
514+
Show Trail: false
515+
Value: true
516+
ovis_link_3:
517+
Alpha: 1
518+
Show Axes: false
519+
Show Trail: false
520+
Value: true
521+
ovis_link_4:
522+
Alpha: 1
523+
Show Axes: false
524+
Show Trail: false
525+
Value: true
526+
ovis_link_5:
527+
Alpha: 1
528+
Show Axes: false
529+
Show Trail: false
530+
Value: true
531+
ovis_link_6:
532+
Alpha: 1
533+
Show Axes: false
534+
Show Trail: false
535+
Value: true
536+
ovis_link_base:
537+
Alpha: 1
538+
Show Axes: false
539+
Show Trail: false
540+
Value: true
541+
Mass Properties:
542+
Inertia: false
543+
Mass: false
544+
Name: RobotModel
545+
TF Prefix: ""
546+
Update Interval: 0
547+
Value: true
548+
Visual Enabled: true
475549
Enabled: true
476550
Global Options:
477551
Background Color: 48; 48; 48
@@ -518,25 +592,25 @@ Visualization Manager:
518592
Views:
519593
Current:
520594
Class: rviz_default_plugins/Orbit
521-
Distance: 36.84917449951172
595+
Distance: 5.473262786865234
522596
Enable Stereo Rendering:
523597
Stereo Eye Separation: 0.05999999865889549
524598
Stereo Focal Distance: 1
525599
Swap Stereo Eyes: false
526600
Value: false
527601
Focal Point:
528-
X: 0.4458295702934265
529-
Y: 3.5056796073913574
530-
Z: -1.5910545587539673
602+
X: 2.4571151733398438
603+
Y: -1.7171390056610107
604+
Z: -1.659576654434204
531605
Focal Shape Fixed Size: true
532606
Focal Shape Size: 0.05000000074505806
533607
Invert Z Axis: false
534608
Name: Current View
535609
Near Clip Distance: 0.009999999776482582
536-
Pitch: 0.914797306060791
610+
Pitch: 0.8547973036766052
537611
Target Frame: <Fixed Frame>
538612
Value: Orbit (rviz)
539-
Yaw: 4.8786468505859375
613+
Yaw: 3.2836241722106934
540614
Saved: ~
541615
Window Geometry:
542616
Camera:

src/rove_description/config/default_bridge.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,18 @@
7373
gz_topic_name: "/camera_info"
7474
ros_type_name: "sensor_msgs/msg/CameraInfo"
7575
gz_type_name: "gz.msgs.CameraInfo"
76-
direction: GZ_TO_ROS
76+
direction: GZ_TO_ROS
77+
78+
# Bridge for dynamic transforms
79+
- ros_topic_name: "/tf"
80+
gz_topic_name: "/tf"
81+
ros_type_name: "tf2_msgs/msg/TFMessage"
82+
gz_type_name: "gz.msgs.Pose_V"
83+
direction: BIDIRECTIONAL
84+
85+
# Bridge for static transforms
86+
- ros_topic_name: "/tf_static"
87+
gz_topic_name: "/tf_static"
88+
ros_type_name: "tf2_msgs/msg/TFMessage"
89+
gz_type_name: "gz.msgs.Pose_V"
90+
direction: BIDIRECTIONAL

0 commit comments

Comments
 (0)