Skip to content

Commit e7f0a77

Browse files
authored
Add MuJoCo simulation and general refactoring
* Restructure package structure Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Refactor docker Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Add mujoco Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Fix internal collisions in Mujoco model Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Refactor isaac dockerfile Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Minor fixes Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Update docker/docker-compose.yml Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Address review comments Signed-off-by: Gerardo Puga <glpuga@gmail.com> * Update README Signed-off-by: Gerardo Puga <glpuga@gmail.com> --------- Signed-off-by: Gerardo Puga <glpuga@gmail.com>
1 parent 0b9273c commit e7f0a77

File tree

116 files changed

+2218
-531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2218
-531
lines changed

.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ ColumnLimit: 120
66
AlignAfterOpenBracket: AlwaysBreak
77
QualifierAlignment: Left
88
---
9+
Language: Json
10+
BasedOnStyle: llvm
11+
---
912
BasedOnStyle: Chromium
1013
Language: JavaScript
1114
...

README.md

Lines changed: 85 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,118 @@
1-
# AR4
1+
# AR4 ROS 2 Software
22

3-
The [Annin Robotics AR4](https://www.anninrobotics.com/) robot is a 6DOF desktop size industrial robot that is a free, open plan low cost robot. This repository contains the necessary ROS 2 packages to plan and execute motions in Gazebo sim. It provides the arm description, simulation controllers and Moveit configuration needed to command it.
3+
The [Annin Robotics AR4](https://www.anninrobotics.com/) robot is a 6DOF desktop size industrial robot that is a free, open plan low cost robot.
44

5-
<p align="center">
6-
<img src="docs/ar4.png" width=500 />
7-
</p>
5+
This package is a ROS 2 software stack for the AR4 robot. It contains both the necessary packages to control the robot in real hardware and in simulation environments based on [Gazebo](https://gazebosim.org/home), [Isaac Sim](https://docs.isaacsim.omniverse.nvidia.com/latest/index.html), and [MuJoCo](https://mujoco.org/).
86

9-
## Package Summary
7+
https://github.com/user-attachments/assets/0edf4c30-70d1-4992-a5ee-e3e813877bb5
108

11-
- [`ar4_gazebo`](./ar4_gazebo): Gazebo simulation for the ar4 arm.
12-
- [`ar4_description`](./ar4_description): Contains the URDF of the arm.
13-
- [`ar4_hardware_interface`](./ar4_hardware_interface): Contains the software required to connect the computer with the real robot.
14-
- [`ar4_moveit_config`](./ar4_moveit_config): Contains configuration and launch files to run and command the arm.
9+
10+
## Package summary
11+
12+
These are the main packages providing launch files for the different use cases:
13+
14+
- [`ar4_description`](./ar4_description): Contains the platform-agnostic parts of the URDF robot description.
15+
- [`ar4_gazebo_bringup`](./ar4_gazebo): Launch a Gazebo Sim simulation of AR4.
16+
- [`ar4_isaac_bringup`](./ar4_gazebo): **Not yet available.** Launch an Isaac Sim simulation of AR4.
17+
- [`ar4_mujoco_bringup`](./ar4_gazebo): **Not yet available.** Launch a MuJoCo-based simulation of AR4.
18+
- [`ar4_realbot_bringup`](./ar4_gazebo): Launch drivers and control software for the real AR4 robot.
1519
- [`ar4_isaac`](./ar4_isaac): Isaac simulation for the ar4 arm.
1620

17-
## Installation
1821

19-
### Prerequisites
22+
```mermaid
23+
graph TD
24+
A[**ar4_moveit_config** <br> main.launch.py]
25+
B[**ar4_common** <br> main.launch.py]
26+
C[**ar4_description** <br> main.launch.py]
27+
D[**ar4_gazebo_sim** <br> main.launch.py]
28+
E[**ar4_gazebo_bringup** <br> main.launch.py]
29+
F[**ar4_hardware_interface** <br> main.launch.py]
30+
G[**ar4_realbot_bringup** <br> main.launch.py]
2031
21-
It is a requirement to have `docker engine` with the `docker compose plugin` already installed in the host machine.
32+
A --> F
33+
C --> F
2234
23-
See: [Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/)
35+
H[**ar4_isaac_bringup** <br> main.launch.py]
36+
I[**ar4_isaac_sim** <br> main.launch.py]
2437
25-
### Running the dev container
38+
B --> H
39+
I --> H
2640
27-
Build and run the container for the use case you are interested in
41+
J[**ar4_mujoco_bringup** <br> main.launch.py]
42+
K[**ar4_mujoco_sim** <br> main.launch.py]
2843
29-
#### Gazebo
30-
```bash
31-
./docker/run.sh -s ar4_gazebo
32-
```
44+
B --> J
45+
K --> J
3346
34-
#### Hardware
3547
36-
* [Hardware Interface Instructions](ar4_hardware_interface/README.md)
48+
A --> B
3749
38-
## Build the packages
50+
C --> D
51+
C --> A
3952
40-
Build the packages
53+
B --> E
54+
D --> E
4155
42-
```
43-
colcon build
56+
B --> G
57+
F --> G
4458
```
4559

46-
Source the built packages
60+
## Prerequisites
4761

48-
```
49-
source install/setup.bash
62+
You need a working ROS 2 environment to be able to build and run the packages in this repository. The exact details of the environment will depend on the specific package you are trying to run (realbot, Gazebo, Isaac Sim, or MuJoCo).
63+
64+
To help you get started and to provide a reference environment, we provide development docker images that contain all the necessary dependencies to run the contents of this repository.
65+
66+
To be able to use the development docker images, you need to have `docker` and `docker-compose` installed in your host machine.
67+
68+
You can find the Docker installation instructions for Ubuntu [here](https://docs.docker.com/engine/install/ubuntu/).
69+
70+
## Running on simulated environments
71+
72+
The AR4 robot can be run using different simulators. The following sections describe how to launch the AR4 robot in Gazebo, Isaac Sim, and MuJoCo.
73+
74+
### Gazebo
75+
76+
To run the AR4 robot in Gazebo Sim use the `ar4_gazebo` version of the development docker image.
77+
78+
```bash
79+
./docker/run.sh -s ar4_gazebo --build
5080
```
5181

52-
---
82+
See further instructions in [the Gazebo bringup package README file](ar4_gazebo_bringup/README.md)
5383

54-
### Launch
84+
![Ar4 Gazebo](media/ar4_gazebo.png)
5585

56-
After building and sourcing the packages, run the specific launch file for your use case:
86+
### Isaac sim
5787

58-
#### Gazebo
88+
To run the AR4 robot in Isaac Sim use the `ar4_isaac` version of the development docker image.
5989

90+
```bash
91+
./docker/run.sh -s ar4_isaac --build
6092
```
61-
ros2 launch ar4_gazebo moveit.launch.py
93+
94+
See further instructions in [the Isaac Sim bringup package README file](ar4_isaac/README.md)
95+
96+
![Ar4 Isaac](media/ar4_isaac.png)
97+
98+
### MuJoCo
99+
100+
To run the AR4 robot in MuJoCo use the `ar4_mujoco` version of the development docker image.
101+
102+
```bash
103+
./docker/run.sh -s ar4_mujoco --build
62104
```
63105

64-
![Ar4 Gazebo](docs/ar4.png)
106+
See further instructions in [the MuJoCo bringup package README file](ar4_mujoco_bringup/README.md)
65107

66-
---
108+
![Ar4 MuJoCo](media/ar4_mujoco.png)
67109

68-
### Controlling the AR4 with MoveIt
110+
111+
## Using on real hardware
112+
113+
See further instructions in [the Realbot bringup package README file](ar4_realbot_bringup/README.md)
114+
115+
## Controlling the AR4 with MoveIt
69116

70117
To plan and command the arm to execute a motion, this launch file will also start MoveIt automatically. Once launched, you should see RViz showing the robot visualization and the MotionPlanning panel on the left.
71118

@@ -80,18 +127,11 @@ This will select a random position for the arm that would not cause a collision
80127
[Random valid position video](https://github.com/user-attachments/assets/ec926968-8952-4ccf-ba63-5423e94f61cd)
81128

82129

83-
#### 2. Moving end effector to a desired position
130+
### 2. Moving end effector to a desired position
84131
This allows you to select a goal position for the end effector, which is currently the last link in the arm as no gripper is being used. This is done by dragging and dropping where the end effector should move to.
85132

86133
[User selected position video](https://github.com/user-attachments/assets/04dbb11c-bca4-4c05-95ae-251d70f41931)
87134

88-
89-
## Isaac sim
90-
91-
![Ar4 Isaac](docs/ar4_isaac.png)
92-
93-
See: [Isaac Sim Instructions](ar4_isaac/README.md)
94-
95135
## Licenses
96136

97137
All packages in this repository except for `ar4_description` and `ar4_hardware_interface` are distributed under a **BSD 3-Clause** License.

ar4_common/CMakeLists.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# BSD 3-Clause License
2+
#
3+
# Copyright 2025 Ekumen, Inc.
4+
# All rights reserved.
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions are met:
8+
#
9+
# 1. Redistributions of source code must retain the above copyright notice, this
10+
# list of conditions and the following disclaimer.
11+
#
12+
# 2. Redistributions in binary form must reproduce the above copyright notice,
13+
# this list of conditions and the following disclaimer in the documentation
14+
# and/or other materials provided with the distribution.
15+
#
16+
# 3. Neither the name of the copyright holder nor the names of its
17+
# contributors may be used to endorse or promote products derived from
18+
# this software without specific prior written permission.
19+
#
20+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
cmake_minimum_required(VERSION 3.7)
32+
project(ar4_common)
33+
34+
find_package(ament_cmake REQUIRED)
35+
36+
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/)
37+
38+
ament_package()
File renamed without changes.
Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,28 @@
3131
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232

3333

34-
import os
35-
from ament_index_python.packages import get_package_share_directory
3634
from launch import LaunchDescription
37-
from launch.actions import ExecuteProcess
35+
from launch.actions import IncludeLaunchDescription
36+
from launch.launch_description_sources import PythonLaunchDescriptionSource
37+
from launch.substitutions import PathJoinSubstitution
38+
from launch_ros.substitutions import FindPackageShare
3839

3940

4041
def generate_launch_description():
41-
pkg_ar4_gazebo = get_package_share_directory('ar4_gazebo')
42-
bridge_config_file_path = os.path.join(pkg_ar4_gazebo, 'config', 'bridge.yaml')
43-
44-
bridge_process = ExecuteProcess(
45-
cmd=[
46-
'ros2',
47-
'run',
48-
'ros_gz_bridge',
49-
'parameter_bridge',
50-
'--ros-args',
51-
'-p',
52-
f'config_file:={bridge_config_file_path}',
53-
],
54-
shell=True,
55-
output='screen',
42+
moveit_planning_include = IncludeLaunchDescription(
43+
PythonLaunchDescriptionSource(
44+
PathJoinSubstitution(
45+
[
46+
FindPackageShare("ar4_moveit_config"),
47+
"launch",
48+
"demo.launch.py",
49+
]
50+
)
51+
)
5652
)
5753

58-
ld = LaunchDescription()
59-
ld.add_action(bridge_process)
60-
61-
return ld
54+
return LaunchDescription(
55+
[
56+
moveit_planning_include,
57+
]
58+
)

ar4_common/package.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<package format="3">
3+
<name>ar4_common</name>
4+
<version>0.0.1</version>
5+
<description>Package containint launcher for HAL-independent parts of the stack</description>
6+
<author email="santiago.mendez@creativa77.com.ar">Santiago Lopez mendez</author>
7+
<maintainer email="steven.desvars@creativa77.com.ar">Steven Desvars</maintainer>
8+
<maintainer email="santiago.mendez@creativa77.com.ar">Santiago Lopez mendez</maintainer>
9+
<maintainer email="glpuga@ekumenlabs.com">Gerardo Puga</maintainer>
10+
<license file="LICENSE">BSD-3-Clause</license>
11+
12+
<buildtool_depend>ament_cmake</buildtool_depend>
13+
14+
<exec_depend>ar4_moveit_config</exec_depend>
15+
<exec_depend>ros2launch</exec_depend>
16+
17+
<export>
18+
<build_type>ament_cmake</build_type>
19+
</export>
20+
</package>

ar4_description/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ install(
77
DIRECTORY config
88
launch
99
meshes
10+
rviz
1011
urdf
1112
DESTINATION share/${PROJECT_NAME}/)
1213

ar4_description/launch/ar4.launch.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)