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

Realistic hunter2 #11

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c040774
minor update in pkg xml for hunter_gazebo
ibrahimhroob Jun 8, 2024
77eba1d
update pkg xml for hunter_description
ibrahimhroob Jun 8, 2024
2f7a8d2
reduce number of meshes and size
ibrahimhroob Jun 9, 2024
5db80c9
rescale the chassis to match the real robot
ibrahimhroob Jun 9, 2024
a1e18bf
fix origin
ibrahimhroob Jun 9, 2024
d90695c
add real robot wheels meshes
ibrahimhroob Jun 9, 2024
031d8fc
update chassis origin
ibrahimhroob Jun 9, 2024
025ec67
fix robot urdf and add steering joints
ibrahimhroob Jun 10, 2024
1bde5f4
update robot mesh files to the true hunter 2
ibrahimhroob Jun 10, 2024
d398d54
further progress ...
ibrahimhroob Jun 30, 2024
99054f0
simplify hunter urdf model
ibrahimhroob Dec 10, 2024
eae6b35
convert to car like robot
ibrahimhroob Dec 11, 2024
60e5e59
added two new links for the wheels and simplify the controller
ibrahimhroob Dec 11, 2024
ce49df0
update version
ibrahimhroob Dec 11, 2024
2c32c44
fix author name
ibrahimhroob Dec 11, 2024
a346230
move meshes into new xacro
ibrahimhroob Dec 11, 2024
41f3ec4
refactor
ibrahimhroob Dec 11, 2024
80aefbc
WIP
ibrahimhroob Dec 14, 2024
ed669d8
WIP - 2
ibrahimhroob Dec 14, 2024
3422d76
remove some files
ibrahimhroob Dec 16, 2024
18963b2
Merge branch 'main' into refactor
ibrahimhroob Dec 16, 2024
e0f34a3
fix steering
ibrahimhroob Dec 16, 2024
eb778d7
set to tricycle_controller
ibrahimhroob Dec 16, 2024
39c3542
clean up
ibrahimhroob Dec 17, 2024
1eac268
added use sim time param
ibrahimhroob Dec 17, 2024
4beaf23
update package xml version
ibrahimhroob Dec 17, 2024
ac68b95
Update README.md
ibrahimhroob Dec 17, 2024
0da8a22
Update README.md
ibrahimhroob Dec 17, 2024
cac88a7
Update README.md
ibrahimhroob Dec 17, 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
131 changes: 130 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,130 @@
# hunter_robot
# Hunter Robot Simulation

This repository contains the **URDF** description and Gazebo simulation for the **Hunter V2** robot. The Hunter V2 is an **Ackermann-steered** mobile robot with front-wheel steering, simulated using ROS 2 control.

Official Robot Website: [AgileX Hunter V2B](https://robosavvy.co.uk/agilex-hunter-2b.html)

---

## Key Features

- **Ackermann Steering**: Configured for front-wheel steering with accurate kinematics.
- **ROS 2 Control Integration**: Leverages `ros2_control` for simulating robot kinematics and dynamics.
- **URDF Description**: Detailed robot description based on manufacturer specifications.
- **Gazebo Simulation**: Visualize and simulate the Hunter V2 robot in Gazebo.
- **Rviz Support**: Visualize the robot and interact with its joints using Rviz.

---


## Installation and Build Instructions

### Prerequisites
Ensure you have a ROS 2 workspace set up. If not, create one:
```bash
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
colcon build
```

### Clone and Build
1. Clone this repository into your ROS 2 workspace:
```bash
cd ~/ros2_ws/src
git clone https://github.com/LCAS/hunter_robot.git
```
2. Install dependencies:
```bash
rosdep update
rosdep install --from-paths . --ignore-src -r -y
```
3. Build the workspace:
```bash
cd ~/ros2_ws
colcon build
source install/setup.bash
```

---

## Packages Overview

This repository includes the following ROS 2 packages:

1. **`hunter_description`**: URDF and robot description files.
2. **`hunter_gazebo`**: Simulation environment for the Hunter V2 in Gazebo.

---

## Usage

### 1. Visualize the Robot in Rviz

To view the robot model and interact with its joints in Rviz:

```bash
ros2 launch hunter_description robot_view.launch.py
```

This launch file starts Rviz and loads the Hunter V2 model.

[Rviz Simulation](https://github.com/user-attachments/assets/1cc10c03-fad7-47b0-8816-74c49d79be31)

---

### 2. Simulate the Robot in Gazebo

To load the Hunter V2 in a Gazebo simulation environment:

```bash
ros2 launch hunter_gazebo launch_sim.launch.py
```

[Gazebo Simulation](https://github.com/user-attachments/assets/90757617-af3b-4bc8-bf1f-f08c5ecc1247)

---

### 3. Control the Robot with Teleop

You can control the Hunter V2 using the `teleop_twist_keyboard` package. First, ensure the simulation is running, then execute:

```bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap cmd_vel:=/ackermann_like_controller/cmd_vel
```

Use the keyboard inputs to move the robot in the simulation.

---

## Robot Controller Configuration

The main configuration of the robot controller is available [here](https://github.com/LCAS/hunter_robot/blob/refactor/hunter_description/config/ackermann_like_controller.yaml)

---

## Robot Specifications

The primary robot parameters, such as mass, wheel size, and turning angles, are derived from the manufacturer's specifications and the following reference repository:

- [Hunter 2 Base URDF (AgileX Robotics)](https://github.com/agilexrobotics/ugv_gazebo_sim/blob/master/hunter/hunter2_base/urdf/hunter2_base_gazebo.xacro)

---

## License

This project is licensed under the **Apache License**. See the [LICENSE](LICENSE) file for details.

---

## References

For more details on ROS 2 Control and Gazebo integration, see:

- [ros2_controllers](https://github.com/ros-controls/ros2_controllers/tree/master)
- [gazebo_ros2_control](https://github.com/ros-controls/gazebo_ros2_control)
- [Getting Started with ros2_control](https://control.ros.org/humble/doc/getting_started/getting_started.html)
- [ros2controlcli Documentation](https://control.ros.org/master/doc/ros2_control/ros2controlcli/doc/userdoc.html)
- [gazebo_ros2_control User Guide](https://control.ros.org/rolling/doc/gazebo_ros2_control/doc/index.html)
- [Video Tutorial](https://youtu.be/BcjHyhV0kIs?si=dUpg7IF-kHSUgB-w)

---
36 changes: 12 additions & 24 deletions hunter_description/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
cmake_minimum_required(VERSION 3.8)
project(hunter_description)
cmake_minimum_required(VERSION 3.16)
project(hunter_description LANGUAGES CXX)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
# find_package(ament_lint_auto REQUIRED)
# # the following line skips the linter which checks for copyrights
# # comment the line when a copyright and license is added to all source files
# set(ament_cmake_copyright_FOUND TRUE)
# # the following line skips cpplint (only works in a git repo)
# # comment the line when this package is in a git repo and when
# # a copyright and license is added to all source files
# set(ament_cmake_cpplint_FOUND TRUE)
# ament_lint_auto_find_test_dependencies()
find_package(ament_cmake_gtest REQUIRED)
endif()
find_package(control_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(std_msgs REQUIRED)
find_package(backward_ros REQUIRED)

install(
DIRECTORY description launch meshes
DESTINATION share/${PROJECT_NAME}
DIRECTORY description launch config rviz meshes
DESTINATION share/${PROJECT_NAME}/
)


ament_package()
59 changes: 59 additions & 0 deletions hunter_description/config/ackermann_like_controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
controller_manager:
ros__parameters:
update_rate: 50 # Hz
use_sim_time: true

ackermann_like_controller:
type: tricycle_controller/TricycleController

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

joint_state_broadcaster:
ros__parameters:
extra_joints: ["front_left_wheel_joint", "front_right_wheel_joint"]


ackermann_like_controller:
ros__parameters:
# Model
traction_joint_name: rear_left_wheel_joint # Name of traction joint in URDF
steering_joint_name: front_left_steering_joint # Name of steering joint in URDF
wheel_radius: 0.165 # Radius of front wheel
wheelbase: 0.65 # Distance between center of back wheels and front wheel

# Odometry
odom_frame_id: odom
base_frame_id: base_link
publish_rate: 50.0 # publish rate of odom and tf
open_loop: false # if True, uses cmd_vel instead of hardware interface feedback to compute odometry
enable_odom_tf: true # If True, publishes odom<-base_link TF
odom_only_twist: false # If True, publishes on /odom only linear.x and angular.z; Useful for computing odometry in another node, e.g robot_localization's ekf
pose_covariance_diagonal: [0.0, 7.0, 14.0, 21.0, 28.0, 35.0] # Need to be set if fusing odom with other localization source
twist_covariance_diagonal: [0.0, 7.0, 14.0, 21.0, 28.0, 35.0] # Need to be set if fusing odom with other localization source
velocity_rolling_window_size: 10 # Rolling window size of rcppmath::RollingMeanAccumulator applied on linear and angular speeds published on odom

# Rate Limiting
traction: # All values should be positive
# min_velocity: 0.0
# max_velocity: 10.0
# min_acceleration: 0.0
max_acceleration: 5.0
# min_deceleration: 0.0
max_deceleration: 8.0
# min_jerk: 0.0
# max_jerk: 10.0
steering:
min_position: -0.461
max_position: 0.461
# min_velocity: 0.0
max_velocity: 1.0
# min_acceleration: 0.0
# max_acceleration: 10.0

# cmd_vel input
cmd_vel_timeout: 500 # In milliseconds. Timeout to stop if no cmd_vel is received
use_stamped_vel: false # Set to True if using TwistStamped.

# Debug
publish_ackermann_command: true # Publishes AckermannDrive. The speed does not comply to the msg definition, it the wheel angular speed in rad/s.
42 changes: 0 additions & 42 deletions hunter_description/description/gazebo_control.xacro

This file was deleted.

17 changes: 0 additions & 17 deletions hunter_description/description/hunter.ros2_control.xacro

This file was deleted.

16 changes: 0 additions & 16 deletions hunter_description/description/hunter.urdf.xacro

This file was deleted.

81 changes: 0 additions & 81 deletions hunter_description/description/hunter_core.urdf.xacro

This file was deleted.

Loading
Loading