Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rove with ovis 2 #69

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Before installing the robot software, you need to install the simulator : https:
git clone https://github.com/clubcapra/rove.git
cd rove
vcs import src < rove.repos
echo "export GZ_VERSION=harmonic" >> ~/.bashrc && source ~/.bashrc
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -r -y
Expand Down
6 changes: 5 additions & 1 deletion rove.repos
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ repositories:
ovis_ros2:
type: git
url: https://github.com/clubcapra/ovis_ros2
version: new-env-with-arm
version: fix-gazebo-joy
gz_ros2_control:
type: git
url: https://github.com/clubcapra/gz_ros2_control.git
version: iron
161 changes: 89 additions & 72 deletions src/rove_bringup/launch/sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,109 +3,110 @@
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription

from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import Command
from launch_ros.actions import Node
from launch_ros.parameter_descriptions import ParameterValue
from math import pi


def generate_launch_description():
# Get the launch directory
pkg_rove_bringup = get_package_share_directory('rove_bringup')
pkg_rove_description = get_package_share_directory('rove_description')
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')

# Get the URDF file
urdf_path = os.path.join(pkg_rove_description, 'urdf', 'rove.urdf.xacro')
robot_desc = ParameterValue(Command(['xacro ', urdf_path]), value_type=str)
pkg_rove_bringup = get_package_share_directory("rove_bringup")
pkg_rove_description = get_package_share_directory("rove_description")
pkg_ros_gz_sim = get_package_share_directory("ros_gz_sim")
pkg_ovis = get_package_share_directory("ovis_bringup")

# Get simulation file
world_file_name = 'worlds/base_world.world'
world_file_name = "worlds/base_world.world"
world = os.path.join(pkg_rove_description, world_file_name)

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

walls_file_path = os.path.join(pkg_rove_description, 'worlds', 'walls.sdf')
walls_file_path = os.path.join(pkg_rove_description, "worlds", "walls.sdf")
spawn_walls = Node(
package='ros_gz_sim',
executable='create',
arguments=['-file', walls_file_path,
'-name', 'walls',
'-x', '0',
'-y', '0',
'-z', '0'],
output='screen',
package="ros_gz_sim",
executable="create",
arguments=[
"-file",
walls_file_path,
"-name",
"walls",
"-x",
"0",
"-y",
"0",
"-z",
"0",
],
output="screen",
)

actor_file_path = os.path.join(pkg_rove_description, 'worlds', 'actor.sdf')
actor_file_path = os.path.join(pkg_rove_description, "worlds", "actor.sdf")
spawn_actor = Node(
package='ros_gz_sim',
executable='create',
arguments=['-file', actor_file_path,
'-name', 'actor',
'-topic', 'actor_pose',
'-x', '0',
'-y', '0',
'-z', '0.1'],
output='screen',
package="ros_gz_sim",
executable="create",
arguments=[
"-file",
actor_file_path,
"-name",
"actor",
"-x",
"0",
"-y",
"0",
"-z",
"0.06",
],
output="screen",
)

yaw = -pi / 2

# Spawn robot
spawn_rove = Node(
package='ros_gz_sim',
executable='create',
package="ros_gz_sim",
executable="create",
arguments=[
'-name', 'rove',
'-topic', 'robot_description',
'-x', '0',
'-y', '0',
'-z', '0.1',
'-Y', str(yaw),
"-name",
"rove",
"-topic",
"robot_description",
"-x",
"0",
"-y",
"0",
"-z",
"0.1",
],
output='screen',
)

# Takes the description and joint angles as inputs and publishes
# the 3D poses of the robot links
robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='both',
parameters=[
{'robot_description': robot_desc},
{"use_sim_time": True, }
]
output="screen",
)

# fake human tracker
human_tracker = Node(
package='rove_navigation',
executable='green_person_tracker',
name='green_person_tracker',
output='screen',
package="rove_navigation",
executable="green_person_tracker",
name="green_person_tracker",
output="screen",
)

# Bridge ROS topics and Gazebo messages for establishing communication
bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
parameters=[{
'config_file': os.path.join(pkg_rove_description, 'config',
'default_bridge.yaml'),
'qos_overrides./tf_static.publisher.durability': 'transient_local',
"use_sim_time": True,
}],
output='screen'
package="ros_gz_bridge",
executable="parameter_bridge",
parameters=[
{
"config_file": os.path.join(
pkg_rove_description, "config", "default_bridge.yaml"
),
"qos_overrides./tf_static.publisher.durability": "transient_local",
"use_sim_time": True,
}
],
output="screen",
)

common = IncludeLaunchDescription(
Expand All @@ -117,13 +118,29 @@ def generate_launch_description():
}.items(),
)

return LaunchDescription([

ovis = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ovis, "launch", "sim.launch.py"),
),
launch_arguments={
"with_rove": "true",
"with_joy": "false",
"ovis_base_origin": "0.22 0 0.34 0 0 3.14",
}.items(),
)



return LaunchDescription(
[
gz_sim,
bridge,
robot_state_publisher,
spawn_walls,
spawn_actor,
spawn_rove,
common,
human_tracker,
])
# human_tracker,
ovis,
]
)
Loading
Loading