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

NASA Challenge_[@azmyin12]_[Space ROS meets Open 3D Engine: A Case Study On Setup Complexity, Features, and Challenges in Mobile Robot Simulation](closes #63) #64

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
727d338
added Ruff linting, removed unused imports
Mechazo11 Aug 29, 2024
99adad5
commented and cleaned up mars_rover.launch.py
Mechazo11 Aug 29, 2024
5d583b0
added mars_rover_o3de.launch.py
Mechazo11 Aug 29, 2024
d002a59
simulation works without arm and mast controllers
Mechazo11 Aug 29, 2024
bedd01f
added doctring in move_wheel.py
Mechazo11 Aug 29, 2024
d4327cd
added comments to RunDemo()
Mechazo11 Aug 29, 2024
6a0af2c
update
Mechazo11 Aug 29, 2024
6d5745e
RunDemo successfully refactored to TeleOpRover class
Mechazo11 Aug 29, 2024
b7de63d
before turning off odom_tf
Mechazo11 Aug 29, 2024
42cb35b
deactivated odom_tf, it does not affect movement
Mechazo11 Aug 29, 2024
c5b6b06
update
Mechazo11 Aug 30, 2024
8587126
update
Mechazo11 Aug 30, 2024
16f1253
updated Cmake
Mechazo11 Aug 30, 2024
28ee7a3
fixed files builds and runs simulation
Mechazo11 Aug 30, 2024
1e28941
update
Mechazo11 Aug 31, 2024
a502ccd
update
Mechazo11 Sep 2, 2024
aa2fef7
fixed erroneous code for sending stop signal
Mechazo11 Sep 7, 2024
1d27a3d
updated teleop_rover for submission
Mechazo11 Sep 8, 2024
8a0a59b
added o3de_mars_rover directory
Mechazo11 Sep 11, 2024
8c70a0d
updated mars_rover demo package to allow control of o3de rover
Mechazo11 Sep 11, 2024
b53ad79
Merge branch 'opening_pr'
Mechazo11 Sep 11, 2024
74246ff
fix merge conflicts
Mechazo11 Sep 11, 2024
9f8d9a9
recovered run_demo node
Mechazo11 Sep 11, 2024
9fcffa4
recovered functionality of gazebo rover demo
Mechazo11 Sep 11, 2024
7d73ea2
can install ros-humble-cyclonedds-cpp and realtime-tools
Mechazo11 Sep 11, 2024
31b4e9a
space ros ws rebuilt
Mechazo11 Sep 11, 2024
a2e43cc
movit2 permission issue fixed, building moveit2 ws
Mechazo11 Sep 11, 2024
1a5fd68
mongo-cxx built, custom packages imported
Mechazo11 Sep 11, 2024
4ace3e5
another milestone
Mechazo11 Sep 11, 2024
f572dd4
before cmake to configure o3de project
Mechazo11 Sep 11, 2024
b60969a
before cmake test, all other steps okay
Mechazo11 Sep 11, 2024
60480a0
found tentative fix, testing in docker
Mechazo11 Sep 11, 2024
790c44b
before crazy build test
Mechazo11 Sep 11, 2024
eb5cf61
progress spaceros ws now look to ros-humble-rmw-cyclonedds and ros-hu…
Mechazo11 Sep 11, 2024
20e3394
activating final build
Mechazo11 Sep 11, 2024
fb7d5db
image built successfully, finalizing run script, testing
Mechazo11 Sep 11, 2024
11f5bb0
Docker tested successfully, GPU acceleration works, ros2 std message …
Mechazo11 Sep 11, 2024
cac609f
before rmw and cyclonedds conflict patch
Mechazo11 Sep 13, 2024
3bb7f89
Space ros directory fixed, cleaning up dependency for demo_ws rebuild
Mechazo11 Sep 13, 2024
9f1f62b
demo_ws rebuilt with ros2 command codes for o3de rover
Mechazo11 Sep 14, 2024
fd9a467
before testing o3de project cmake, looking out for rmw_implementation…
Mechazo11 Sep 14, 2024
697ce13
fixed gazebo-msgs not found issue, rmw_implementation and cycloedds d…
Mechazo11 Sep 14, 2024
af6234b
testing build upto demo_ws with correct demos repo
Mechazo11 Sep 14, 2024
6cae88f
build passed, ready for CI test
Mechazo11 Sep 14, 2024
48e9b7a
added three docker files into docker/ dir, testing if they can be cha…
Mechazo11 Sep 14, 2024
a656743
build script modified to build three docker images, testing in local …
Mechazo11 Sep 14, 2024
1bcb92c
why control_toolbox fails in moveit2?
Mechazo11 Sep 14, 2024
dfcf50e
rmw conflict affecting moveit2 image, found temporary fix, ready for …
Mechazo11 Sep 14, 2024
861045d
ready for ci test
Mechazo11 Sep 14, 2024
cdbba81
correct .repos for space_robot, pushing for ci
Mechazo11 Sep 14, 2024
1037bf4
missed :latest tag when defining source file for o3de image, attempti…
Mechazo11 Sep 14, 2024
2522d1f
o3de_docker image was looking for an image with wrong name, fixed. At…
Mechazo11 Sep 14, 2024
e33cebe
removed duplicate commands in moveit2, space_robot_demo and o3de_curi…
Mechazo11 Sep 15, 2024
a02400f
doing a master build test
Mechazo11 Sep 15, 2024
9ec5bf2
master build test
Mechazo11 Sep 15, 2024
6e67f57
o3de separated completely, ready for CI test
Mechazo11 Sep 15, 2024
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
3 changes: 2 additions & 1 deletion mars_rover/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ install(PROGRAMS
nodes/move_arm
nodes/move_mast
nodes/move_wheel
nodes/run_demo
nodes/run_demo # To run the Gazebo rover demo
nodes/teleop_rover # To run O3DE rover demo
nodes/odom_tf_publisher
DESTINATION lib/${PROJECT_NAME}
)
Expand Down
14 changes: 14 additions & 0 deletions mars_rover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Curiosity Mars Rover ROS2 package

This packge launches the curiositry mars rover simulation in Gazebo ignition. It is part of the Space ROS demonstration examples.

**TODO**

* [ ] Description of fixing the .dae file for the ```chassis```
* [ ] How I configured it to work with the O3DE project.
* [ ] How to instructions

**Changelogs**

* Changed RunDemo class name to TeleOpRover as this class's primary function is to publish Twist message based on user/teleop input.
* odom_tf_broadcaster may need to be turned off???
83 changes: 43 additions & 40 deletions mars_rover/launch/mars_rover.launch.py
Original file line number Diff line number Diff line change
@@ -1,85 +1,87 @@
from http.server import executable
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess, RegisterEventHandler, IncludeLaunchDescription
from launch.substitutions import TextSubstitution, PathJoinSubstitution, LaunchConfiguration, Command
from launch_ros.actions import Node, SetParameter
from launch_ros.substitutions import FindPackageShare
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.event_handlers import OnProcessExit, OnExecutionComplete
import os
from os import environ
"""
Bring up nodes, hardware interfaces and spaw curiosity rover in a Gazebo world.

from ament_index_python.packages import get_package_share_directory
Author:
Space ROS

import xacro
Date: TODO
Version: N/A

A.I Tool: ChatGPT 4.o

"""

# . ../spaceros_ws/install/setup.bash && . ../depends_ws/install/setup.bash
# rm -rf build install log && colcon build && . install/setup.bash
# Imports
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import ExecuteProcess, RegisterEventHandler
from launch_ros.actions import Node, SetParameter
from launch.event_handlers import OnProcessExit
import os
from os import environ
import xacro

def generate_launch_description():

"""Generate launch description to bringup curiosity rover simulation."""
# Define paths to mars_rover and simulation packages
mars_rover_demos_path = get_package_share_directory('mars_rover')
mars_rover_models_path = get_package_share_directory('simulation')

# Define
env = {'IGN_GAZEBO_SYSTEM_PLUGIN_PATH':
':'.join([environ.get('IGN_GAZEBO_SYSTEM_PLUGIN_PATH', default=''),
environ.get('LD_LIBRARY_PATH', default='')]),
'IGN_GAZEBO_RESOURCE_PATH':
':'.join([environ.get('IGN_GAZEBO_RESOURCE_PATH', default=''), mars_rover_demos_path])}

urdf_model_path = os.path.join(mars_rover_models_path, 'models', 'curiosity_path',
'urdf', 'curiosity_mars_rover.xacro')
mars_world_model = os.path.join(mars_rover_demos_path, 'worlds', 'mars_curiosity.world')

doc = xacro.process_file(urdf_model_path)
robot_description = {'robot_description': doc.toxml()}

# Arm
arm_node = Node(
package="mars_rover",
executable="move_arm",
output='screen'
)

# Sensor mast
mast_node = Node(
package="mars_rover",
executable="move_mast",
output='screen'
)

# Wheel groups
wheel_node = Node(
package="mars_rover",
executable="move_wheel",
output='screen'
)

# Start demo
run_node = Node(
package="mars_rover",
executable="run_demo",
output='screen'
)

# Publish odometry
odom_node = Node(
package="mars_rover",
executable="odom_tf_publisher",
output='screen'
)

# Fire up Gazebo ignition model
start_world = ExecuteProcess(
cmd=['ign gazebo', mars_world_model, '-r'],
output='screen',
additional_env=env,
shell=True
)

# Publish various joint positions and link orientation
robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[robot_description])

# Bridge communication between ROS 2 and the Ignition Gazebo simulation
ros_gz_bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
Expand All @@ -89,13 +91,13 @@ def generate_launch_description():
'/scan@sensor_msgs/msg/[email protected]',
],
output='screen')
# Connect image messages from Gazebo to ROS2
image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['/image_raw', '/image_raw'],
output='screen')

# Spawn curiosity rover into the world.
spawn = Node(
package='ros_ign_gazebo', executable='create',
arguments=[
Expand All @@ -104,52 +106,49 @@ def generate_launch_description():
'-z', '-7.5'
],
output='screen'

)


## Control Components

# Control Components
component_state_msg = '{name: "IgnitionSystem", target_state: {id: 3, label: ""}}'

## a hack to resolve current bug
# TODO what bug was resolved with this hack?
# Set hardware_interface state to active
set_hardware_interface_active = ExecuteProcess(
cmd=['ros2', 'service', 'call',
'controller_manager/set_hardware_component_state',
'controller_manager_msgs/srv/SetHardwareComponentState',
component_state_msg]
)

# Controller to broadcast all joint states
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
)

# Controller for arm
load_arm_joint_traj_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'arm_joint_trajectory_controller'],
output='screen'
)

# Controller for sensor mast
load_mast_joint_traj_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'mast_joint_trajectory_controller'],
output='screen'
)

# Controller for wheel
load_wheel_joint_traj_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'wheel_velocity_controller'],
output='screen'
)

# Controller for steering
load_steer_joint_traj_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'steer_position_controller'],
output='screen'
)

# Controller for suspension joints
load_suspension_joint_traj_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'wheel_tree_position_controller'],
Expand All @@ -175,12 +174,16 @@ def generate_launch_description():
on_exit=[set_hardware_interface_active],
)
),
# After the hardware interface is activated,
# the joint state broadcaster is loaded.
RegisterEventHandler(
OnProcessExit(
target_action=set_hardware_interface_active,
on_exit=[load_joint_state_broadcaster],
)
),
# After the joint state broadcaster is loaded,
# all trajectory controllers (arm, mast, wheel, steer, suspension) are loaded and activated.
RegisterEventHandler(
OnProcessExit(
target_action=load_joint_state_broadcaster,
Expand Down
Loading
Loading