Skip to content

Commit

Permalink
Merge branch 'main' into add-opi-real
Browse files Browse the repository at this point in the history
  • Loading branch information
IliTheButterfly authored Apr 7, 2024
2 parents 5d738b8 + 933308c commit d3ea24a
Show file tree
Hide file tree
Showing 26 changed files with 706 additions and 101 deletions.
37 changes: 33 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM ghcr.io/clubcapra/gazebo:harmonic
FROM ros:humble-ros-base

# Add vscode user with same UID and GID as your host system
# (copied from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user)
ARG USERNAME=rove
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# ENV variables
ENV ROS_DISTRO=humble
ENV GZ_VERSION=harmonic

WORKDIR /workspace/$USERNAME

RUN groupadd --gid $USER_GID $USERNAME || true \
Expand All @@ -22,7 +26,32 @@ RUN apt update && apt upgrade -y
# Install Git
RUN apt install -y git

# Install necessary packages for Gazebo Garden and its dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
wget \
lsb-release \
gnupg \
curl

# Install Gazebo
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null

RUN apt update -y

RUN apt install -y ros-humble-ros-gzharmonic

# Adding an APT update and clean step
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
apt-get update

# Change user
RUN chown $USER_UID:$USER_GID /workspace/$USERNAME

USER $USERNAME

# Copy to preload the ros packages
Expand All @@ -31,12 +60,12 @@ COPY ./ /workspace/$USERNAME/
# Install Tesseract

# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc && \
echo "source /gazebo/gazebo_ws/install/setup.bash" >> ~/.bashrc
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc

COPY --chown=$USERNAME ./ /workspace/$USERNAME

# Rosdep update
RUN rosdep update

# Install ROS dependencies
RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ IF YOU ARE RUNNING IN WSL: do this command
```bash
export LIBGL_ALWAYS_INDIRECT=0 export LIBGL_ALWAYS_SOFTWARE=1
```
Do these commands to run the simulation
Do these commands to run the gazebo simulation with physics enabled
```bash
colcon build --symlink-install
source install/setup.bash
ros2 launch rove_description sim.launch.py
```

OR Do these commands to only run the rviz simulation (with joints control)
```bash
colcon build --symlink-install
source install/setup.bash
ros2 launch rove_description launch.py
```

## Running the controller with a usb cable

Expand Down
6 changes: 3 additions & 3 deletions rove.repos
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repositories:
type: git
url: https://github.com/clubcapra/capra_gazebo.git
version: main
capra_gazebo:
ovis_description:
type: git
url: https://github.com/clubcapra/capra_opi.git
version: main
url: https://github.com/clubcapra/ovis_ros2.git
version: master
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def generate_launch_description():
name='teleop_twist_joy_node',
parameters=[teleope_joy_params_file],
remappings=[
('/joy', '/rove/joy'),
('/joy', '/joy'),
# ('/cmd_vel', '/model/rove/cmd_vel')
],
),
Expand Down
2 changes: 1 addition & 1 deletion src/rove_bringup/launch/rove_controller_usb.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def generate_launch_description():
name='teleop_twist_joy_node',
parameters=[teleope_joy_params_file],
remappings=[
('/joy', '/rove/joy'),
('/joy', '/joy'),
# ('/cmd_vel', '/model/rove/cmd_vel')
],
),
Expand Down
7 changes: 7 additions & 0 deletions src/rove_description/config/default_bridge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
gz_type_name: "gz.msgs.LaserScan"
direction: GZ_TO_ROS

# gz topic published by Sensors plugin (point cloud)
- ros_topic_name: "velodyne_points"
gz_topic_name: "/scan/points"
ros_type_name: "sensor_msgs/msg/PointCloud2"
gz_type_name: "gz.msgs.PointCloudPacked"
direction: GZ_TO_ROS

# gz topic published by JointState plugin
- ros_topic_name: "joint_states"
gz_topic_name: "joint_states"
Expand Down
16 changes: 0 additions & 16 deletions src/rove_description/config/robot_bridge.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions src/rove_description/launch/sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def generate_launch_description():
pkg_rove_nav = get_package_share_directory('rove_navigation')
slam_pkg_path = get_package_share_directory("slam_toolbox")
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')
bringup_pkg_path = get_package_share_directory('rove_bringup')

# Get the URDF file
urdf_path = os.path.join(pkg_rove_description, 'urdf', 'rove.urdf.xacro')
Expand Down Expand Up @@ -93,6 +94,16 @@ def generate_launch_description():
}.items(),
)

slam3d = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_rove_slam, "launch", "slam3d.launch.py"),
),
launch_arguments={
"use_sim_time": "true",
"deskewing": "true",
}.items(),
)

nav = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_rove_nav, "navigation.launch.py"),
Expand All @@ -108,6 +119,12 @@ def generate_launch_description():
{'use_sim_time': True}]
)

teleop = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(bringup_pkg_path, "launch", "rove_controller_usb.launch.py"),
),
)

return LaunchDescription([
gz_sim,
DeclareLaunchArgument('rviz', default_value='true',
Expand All @@ -117,6 +134,8 @@ def generate_launch_description():
robot_localization_node,
rviz,
slam,
#slam3d,
create,
nav,
teleop,
])
89 changes: 89 additions & 0 deletions src/rove_description/meshes/vlp16/VLP16_base_1.dae

Large diffs are not rendered by default.

Binary file not shown.
89 changes: 89 additions & 0 deletions src/rove_description/meshes/vlp16/VLP16_base_2.dae

Large diffs are not rendered by default.

Binary file not shown.
89 changes: 89 additions & 0 deletions src/rove_description/meshes/vlp16/VLP16_scan.dae

Large diffs are not rendered by default.

Binary file added src/rove_description/meshes/vlp16/VLP16_scan.stl
Binary file not shown.
2 changes: 1 addition & 1 deletion src/rove_description/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<exec_depend>rviz2</exec_depend>
<exec_depend>xacro</exec_depend>
<exec_depend>ros_gz_bridge</exec_depend>
<exec_depend>velodyne_description</exec_depend>

<buildtool_depend>ament_cmake</buildtool_depend>

Expand Down
101 changes: 101 additions & 0 deletions src/rove_description/urdf/command.urdf.xacro
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">87</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: 1.0}, angular: {z: 0.0}
</output>
</plugin>

<!-- Moving Backward: X -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">88</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: -1.0}, angular: {z: 0.0}
</output>
</plugin>

<!-- Stop: S -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">83</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: 0.0}, angular: {z: 0.0}
</output>
</plugin>

<!-- Left: A -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">65</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: 0.0}, angular: {z: 1.0}
</output>
</plugin>

<!-- Right: D -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">68</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: 0.0}, angular: {z: -1.0}
</output>
</plugin>

<!-- Forward Left: Q -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">81</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: 1.0}, angular: {z: 1.0}
</output>
</plugin>

<!-- Forward Right: E -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">69</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: 1.0}, angular: {z: -1.0}
</output>
</plugin>

<!-- Back Left: Z -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">90</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: -1.0}, angular: {z: 1.0}
</output>
</plugin>

<!-- Back Right: C -->
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Int32" topic="/keyboard/keypress">
<match field="data">67</match>
</input>
<output type="gz.msgs.Twist" topic="cmd_vel">
linear: {x: -1.0}, angular: {z: -1.0}
</output>
</plugin>

</robot>
6 changes: 3 additions & 3 deletions src/rove_description/urdf/flipper.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dynamics damping="50.0" friction="50"/>
</joint>




<link name="flipper_${suffix}">
Expand All @@ -54,7 +54,7 @@
<mesh filename="file://$(find rove_description)/meshes/flipper.stl"/>
</geometry>
<surface>
<friction>
<friction>
<ode>
<mu>0.65</mu>
<mu2>0.85</mu2>
Expand All @@ -75,7 +75,7 @@
</inertial>
</link>
<gazebo>
<plugin name='ignition::gazebo::systems::TrackController' filename='libignition-gazebo-track-controller-system.so'>
<plugin name='gz::sim::systems::TrackController' filename='gz-sim-track-controller-system'>
<link>flipper_${suffix}</link>
<min_velocity>-3.0</min_velocity>
<max_velocity>3.0</max_velocity>
Expand Down
18 changes: 9 additions & 9 deletions src/rove_description/urdf/gazebo.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

<gazebo>
<plugin
filename="ignition-gazebo-joint-state-publisher-system"
name="ignition::gazebo::systems::JointStatePublisher">
filename="gz-sim-joint-state-publisher-system"
name="gz::sim::systems::JointStatePublisher">
<topic>joint_states</topic>
</plugin>

<plugin
filename="ignition-gazebo-imu-system"
name="ignition::gazebo::systems::Imu">
filename="gz-sim-imu-system"
name="gz::sim::systems::Imu">
</plugin>


Expand All @@ -22,27 +22,27 @@
<right_track><link>flipper_fr</link></right_track>
<right_track><link>flipper_rr</link></right_track>

<!-- TODO PUT ACTUAL VALUES -->
<!-- TODO PUT ACTUAL VALUES -->
<tracks_separation>0.63</tracks_separation>
<tracks_height>0.18094</tracks_height>
<steering_efficiency>1</steering_efficiency>

<topic>cmd_vel</topic>
<topic>cmd_vel</topic>

<odom_topic>odom</odom_topic>
<frame_id>odom</frame_id>
<child_frame_id>base_footprint</child_frame_id>
<odom_publisher_frequency>30</odom_publisher_frequency>

<publish_odom_tf>false</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>
<publish_wheel_tf>false</publish_wheel_tf>

<tf_topic>/tf</tf_topic>
</plugin>

<plugin
filename="ignition-gazebo-sensors-system"
name="ignition::gazebo::systems::Sensors">
filename="gz-sim-sensors-system"
name="gz::sim::systems::Sensors">
<render_engine>ogre2</render_engine>
</plugin>
</gazebo>
Expand Down
Loading

0 comments on commit d3ea24a

Please sign in to comment.