Skip to content

Commit c60a615

Browse files
committed
Merge branch 'master' into front-end-labyrinth
2 parents 35dd21e + fd2faa2 commit c60a615

File tree

11,216 files changed

+31361
-3569945
lines changed

Some content is hidden

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

11,216 files changed

+31361
-3569945
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Be sure to explain in details the context and the outcome that you are lookign f
2424

2525
## How to contribute in exercises documentation?
2626

27-
Take a look at our [documentation guide lines](https://jderobot.github.io/RoboticsAcademy/contribute/) to contribute in github pages related issues.
27+
Take a look at our [documentation guide lines](https://jderobot.github.io/RoboticsAcademy/developer_guide) to contribute in github pages related issues.
2828

2929
Thanks! :heart: :heart:
3030
RoboticsAcademy Team

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ Take a look at the [contributing](CONTRIBUTING.md) guide lines.
1616
- [Instructions for developers.][]
1717
- [Client side.][] (Robotics Academy architecture)
1818
- [Repository Architecture.][]
19+
- [Generate a mini RADI.][]
20+
- [Humble mini RADI structure.][]
21+
- [Develop using volume binding.][]
1922

2023
[Instructions for developers.]: ./docs/InstructionsForDevelopers.md
2124
[Client side.]: ./docs/clientside.md
2225
[Repository Architecture.]: ./docs/RepositoryArchitecture.md
23-
26+
[Generate a mini RADI.]: ./docs/generate_a_mini_radi.md
27+
[Humble mini RADI structure.]: ./scripts/mini_RADI/README.md
28+
[Develop using volume binding.]: ./docs/develop_binding_volumes.md

academy/settings.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
]
5151

5252
MIDDLEWARE = [
53+
'corsheaders.middleware.CorsMiddleware',
5354
'django.middleware.security.SecurityMiddleware',
5455
'django.contrib.sessions.middleware.SessionMiddleware',
5556
'django.middleware.common.CommonMiddleware',
@@ -158,15 +159,8 @@
158159
}
159160

160161

161-
CSRF_TRUSTED_ORIGINS = [
162-
"http://localhost:7000",
163-
"http://127.0.0.1:7000",
164-
]
162+
CORS_ORIGIN_ALLOW_ALL = True
165163

166-
CORS_ALLOWED_ORIGINS = [
167-
"http://localhost:7000",
168-
"http://127.0.0.1:7000",
169-
]
170164

171165
CORS_ALLOW_HEADERS = (
172166
'accept',
@@ -180,4 +174,5 @@
180174
'x-requested-with',
181175
)
182176

183-
CORS_ALLOW_CREDENTIALS = True
177+
CORS_ALLOW_CREDENTIALS = True
178+

db.sqlite3

52 KB
Binary file not shown.

docs/InstructionsForDevelopers.md

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,162 @@ The webserver is not connected with the RADI.
4747

4848
6) To connect the webserver with RADI, Run:
4949
```
50-
docker run --rm -it -p 8000:8000 -p 2303:2303 -p 1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 jderobot/robotics-academy --no-server
50+
docker run --rm -it -p 2303:2303 -p 1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 -p 7163:7163 jderobot/robotics-academy --no-server
5151
```
5252

5353
<a name="How-to-add-a-new-exercise"></a>
5454
## How to add a new exercise
55-
To include a new exercise, add the folder with the exercise contents in exercises/static/exercises following the file name conventions. Then, create the entry in db.sqlite3. A simple way to do this is by using the Django admin page:
55+
To include a new exercise, add the folder with the exercise contents in exercises/static/exercises following the file name conventions:
56+
- ```entry_point/ros_version```: used for the entrypoint of an exercise run by the RAM
57+
- ```launch/ros_version```: used for world launch files (.launch)
58+
- ```python_template/ros_version```: used for the python templates needed to compose the user code
59+
- ```react-components```: exercise specific react components
60+
61+
Then, create the entry in db.sqlite3. A simple way to do this is by using the Django admin page:
5662
1) Run ```python3.8 manage.py runserver```.
5763
2) Access http://127.0.0.1:8000/admin/ on a browser and log in with "user" and "pass".
58-
3) Click on "add exercise" and fill the fields: exercise id (folder name), name (name to display), state, language and description (description to display). Save and exit.
64+
3) Click on "add exercise" and fill the required fields specified below. Save and exit.
5965
4) Commit db.sqlite3 changes.
6066

67+
An exercise entry in the database must include the following data:
68+
- ```exercise id```: unique exercise identifier, must match the folder name
69+
- ```name```: name to display on the exercise list
70+
- ```description```: description to display on the exercise list
71+
- ```tags```: an exercise must include at least one ROS tag ("ROS1" or "ROS2"). The exercise will only be shown on the exercise list when the RADI ROS version installed is listed in the tags. Tags are also used by the search bar.
72+
- ```state```: changes the state indicator (active = green; prototype = yellow; inactive = red)
73+
- ```language```: programming language used
74+
- ```configuration```: available launch options to run the exercise written in JSON. If the generic react components are used, the exercise frontend will automatically request to launch the exercise using the first configuration that matches the key ROSX (X = ROS version detected by django). If the generic circuit selector react component is used, it will automatically display all the launch options items of the array that matches the key ROSX (X = ROS version detected by django), displaying the name stored under the key "name". Sample configuration JSON including 2 launch options for ROS1 and 1 launch option for ROS2:
75+
```
76+
{"ROS1":[
77+
{
78+
"application": {
79+
"type": "python",
80+
"entry_point": "$EXERCISE_FOLDER/entry_point/exercise.py",
81+
"params": { "circuit": "default"}
82+
83+
},
84+
"launch": {
85+
"0": {
86+
"type": "module",
87+
"module": "ros_api",
88+
"resource_folders": [
89+
"$EXERCISE_FOLDER/launch/ros1_noetic"
90+
],
91+
"model_folders": [
92+
"$CUSTOM_ROBOTS_FOLDER/f1/models"
93+
],
94+
"plugin_folders": [
95+
],
96+
"parameters": [],
97+
"launch_file": "$EXERCISE_FOLDER/launch/ros1_noetic/simple_line_follower_ros_headless_default.launch",
98+
"name": "Default"
99+
},
100+
"1": {
101+
"type": "module",
102+
"module": "console",
103+
"display": ":1",
104+
"internal_port": 5901,
105+
"external_port": 1108
106+
},
107+
"2": {
108+
"type": "module",
109+
"module": "gazebo_view",
110+
"display": ":0",
111+
"internal_port": 5900,
112+
"external_port": 6080,
113+
"height": 768,
114+
"width": 1024
115+
}
116+
}
117+
},
118+
{
119+
"application": {
120+
"type": "python",
121+
"entry_point": "$EXERCISE_FOLDER/entry_point/exercise.py",
122+
"params": { "circuit": "default"}
123+
124+
},
125+
"launch": {
126+
"0": {
127+
"type": "module",
128+
"module": "ros_api",
129+
"resource_folders": [
130+
"$EXERCISE_FOLDER/launch/ros1_noetic"
131+
],
132+
"model_folders": [
133+
"$CUSTOM_ROBOTS_FOLDER/f1/models"
134+
],
135+
"plugin_folders": [
136+
],
137+
"parameters": [],
138+
"launch_file": "$EXERCISE_FOLDER/launch/ros1_noetic/simple_line_follower_ros_headless_nbg.launch",
139+
"name": "Nürburgring"
140+
},
141+
"1": {
142+
"type": "module",
143+
"module": "console",
144+
"display": ":1",
145+
"internal_port": 5901,
146+
"external_port": 1108
147+
},
148+
"2": {
149+
"type": "module",
150+
"module": "gazebo_view",
151+
"display": ":0",
152+
"internal_port": 5900,
153+
"external_port": 6080,
154+
"height": 768,
155+
"width": 1024
156+
}
157+
}
158+
}],
159+
"ROS2":
160+
[
161+
{
162+
"application": {
163+
"type": "python",
164+
"entry_point": "$EXERCISE_FOLDER/entry_point/ros2_humble/exercise.py",
165+
"params": { "circuit": "default"}
166+
},
167+
"launch": {
168+
"0": {
169+
"type": "module",
170+
"module": "ros2_api",
171+
"resource_folders": [
172+
"$EXERCISE_FOLDER/launch/ros2_humble"
173+
],
174+
"model_folders": [
175+
"$CUSTOM_ROBOTS_FOLDER/f1/models"
176+
],
177+
"plugin_folders": [
178+
],
179+
"parameters": [],
180+
"launch_file": "$EXERCISE_FOLDER/launch/ros2_humble/simple_line_follower_default.launch.py",
181+
"name": "Default"
182+
183+
},
184+
"1": {
185+
"type": "module",
186+
"module": "console_ros2",
187+
"display": ":1",
188+
"internal_port": 5901,
189+
"external_port": 1108
190+
},
191+
"2": {
192+
"type": "module",
193+
"module": "gazebo_view_ros2",
194+
"display": ":0",
195+
"internal_port": 5900,
196+
"external_port": 6080,
197+
"height": 768,
198+
"width": 1024
199+
}
200+
}
201+
}
202+
]
203+
}
204+
```
205+
61206
<a name="How-to-update-static-files-version"></a>
62207
## How to update static files version
63208
Follow this steps after changing any js or css document in order to prevent the browser cache to be used:

docs/develop_binding_volumes.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Develop using volume binding
2+
A fast way of development and testing can be achieved using volume binding. This allows you to run a RADI including changes from your local file system without building the image. This method is only suitable when the changes are made on the repositories RoboticsAcademy or RoboticsApplicationManager. When modifying the dependencies on RoboticsInfrastructure, a new image should be built.
3+
4+
## Prerequisites
5+
- Developer environment installed. Follow the instructions on [How to set up the developer environment section.][]
6+
7+
## Instructions
8+
This method consists in replicating the folder /RoboticsAcademy that exists inside the RADI on your local drive. Then, a docker run option is used to replace the RADI folder with your local folder. By doing so, all the changes made on your local files are included in the container. Note that this is a shared volume, so all changes made to your shared volume even from inside the container are persistent.
9+
1. Replicate the folder RADI:/RoboticsAcademy inside your local file system. This can be achieved by cloning the repository [RoboticsAcademy][https://github.com/JdeRobot/RoboticsAcademy] and the repository [RoboticsApplicationManager][https://github.com/JdeRobot/RoboticsApplicationManager] inside the folder RoboticsAcademy/src (include the contents directly, not into a subfolder src/RoboticsApplicationManager).
10+
2. Run ``` yarn run dev ``` if there were any front-end changes
11+
3. Run the docker image mounting the volume with the instruction ``` docker run --rm -it --name radi -p 8000:8000 -p 2303:2303 -p 1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 -p 7163:7163 --mount type=bind,source="$(pwd)"/RoboticsAcademy,target=/RoboticsAcademy jderobot/robotics-academy ``` replacing the mount source path to your RoboticsAcademy path.
12+
13+
14+
[How to set up the developer environment section.]: /docs/InstructionsForDevelopers.md

docs/generate_a_mini_radi.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Creating a mini RADI (Robotics Application Docker Image)
2+
3+
The build.sh script is designed to build a Docker mini RADI image, from specific branches. It is customizable, allowing the user to choose the version of ROS (Robot Operating System) used, the branches of different repositories, and the tag of the Docker image. Below is a step-by-step guide on how to use the script.
4+
5+
## Prerequisites
6+
- Docker installed on your machine. You can download Docker from [here](https://www.docker.com/products/docker-desktop).
7+
- Git installed on your machine. You can download Git from [here](https://git-scm.com/downloads).
8+
9+
## Usage
10+
11+
1. **Navigate to the scripts directory**
12+
13+
```bash
14+
cd /scripts/mini_RADI
15+
```
16+
17+
2. **Build the Docker image**
18+
19+
Run the script using the following command:
20+
21+
```bash
22+
./build.sh -a [ROBOTICS_ACADEMY] -i [ROBOTICS_INFRASTRUCTURE] -m [RAM] -r [ROS_DISTRO] -t [IMAGE_TAG]
23+
24+
```
25+
26+
Each of the parameters is explained below:
27+
28+
`ROBOTICS_ACADEMY`: This is the branch name of the Robotics Academy repository to use. Default value is master.
29+
30+
`ROBOTICS_INFRASTRUCTURE`: This is the branch name of the Robotics Infrastructure repository to use. Default value is noetic-devel.
31+
32+
`RAM`: This is the branch name of the RoboticsApplicationManager repository to use. Default value is main.
33+
34+
`ROS_DISTRO`: This is the ROS distribution to use. The script currently supports `noetic` and `humble`. Default value is noetic.
35+
36+
`IMAGE_TAG`: This is the tag of the Docker image that will be created. Default value is `test`.
37+
## Example
38+
39+
For instance, to build a Docker image using the master branch of the Robotics Academy repository, the noetic-devel branch of the Robotics Infrastructure repository, the main branch of the RAM repository, the noetic ROS distribution, and tag the image as my_image, you would run:
40+
41+
```bash
42+
./build.sh -f -a master -i noetic-devel -m main -r noetic -t my_image
43+
```
44+
Use '-f' to force build the base image. If omitted, the base image is created only if it doesn't exist.
45+
## Troubleshooting
46+
47+
If an error occurs while running the script, ensure that:
48+
49+
- All the specified branches exist in their respective repositories.
50+
- The specified ROS distribution is either noetic or humble.
51+
- You have the necessary permissions to build Docker images on your machine. If not you can run:
52+
53+
```bash
54+
chmod +x build.sh
55+
```
56+
- For more information about the build script:
57+
58+
```bash
59+
./build.sh -h
60+
```
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Building the RADI Pre-base and Base Docker Images
2+
3+
This guide will walk you through the process of building two Docker images, RADI pre-base and RADI base, which are essential building blocks for creating the mini RADI. This steps are not necesary if you just made changes in the RoboticsAcademy repository.
4+
5+
## 1. RADI Pre-base Image
6+
The RADI pre-base Docker image includes all the necessary robotic dependencies for running robotic simulations, as well as the robot models within the CustomRobots directory. If you make any changes in the dependecies or the robot models (RoboticsInfrastructure repository), you will need to build the RADI pre-base image.
7+
8+
### Building the RADI Pre-base Image
9+
The Dockerfile required to build the RADI pre-base image is hosted on the RoboticsInfrastructure GitHub repository. Here are the steps to build the image:
10+
11+
1. **Clone the repository:**
12+
```bash
13+
git clone https://github.com/JdeRobot/RoboticsInfrastructure.git
14+
```
15+
16+
2. **Navigate to the Dockerfiles directory:**
17+
```bash
18+
cd RoboticsInfrastructure/scripts
19+
```
20+
21+
3. **Build the image:**
22+
23+
This step is critical as it dictates the generation of the pre-base Docker image that's compatible with either ROS1 or ROS2. This is contingent upon whether changes have been integrated into the main branches of the different versions.
24+
25+
If you're working from the main branches of ROS1 (`noteic-devel`) or ROS2 (`humble-devel`), simply run the Dockerfile from the corresponding branch. This will automatically generate the appropriate prebase image.
26+
27+
```bash
28+
docker build -t jderobot/robotics-applications:<tag> -f Dockerfile.pre-base .
29+
```
30+
31+
However, if you're working from an auxiliary branch, such as an issue branch, you'll need to substitute the $ROS_DISTRO-devel in the git clone command with the name of your current branch.
32+
33+
```dockerfile
34+
git clone -b <your-branch-name> --depth 1 https://github.com/JdeRobot/RoboticsInfrastructure.git /opt/jderobot
35+
```
36+
37+
Then you can run the dockerfile
38+
39+
```bash
40+
docker build -t jderobot/robotics-applications:<name-of-your-branch> -f Dockerfile.pre-base .
41+
```
42+
43+
Please note that the Docker image tag (jderobot/robotics-applications:name-of-your-branch) should reflect your branch name. This ensures that your Docker image is properly associated with your branch, and prevents any mix-up with Docker images from other branches.
44+
45+
Remember, this step is crucial for ensuring the successful generation of a Docker pre-base image compatible with the correct version of ROS. Be sure to double-check your branch name before running the Dockerfile.
46+
47+
## 2. RADI base Image
48+
49+
To generate the base Docker image, you simply need to execute the base Dockerfile. This process is generally straightforward and does not require many adjustments. However, there are some situations in which you will need to make modifications.
50+
51+
## Modifying the Robotics Application Manager (RAM)
52+
53+
If you have made changes to the Robotics Application Manager (RAM), which is quite uncommon, you will need to insert the name of your branch in the command that clones the RAM inside the Docker container. You can do this by adding your branch name when running the git clone command in the dockerfile.
54+
55+
```dockerfile
56+
RUN git clone https://github.com/JdeRobot/RoboticsApplicationManager.git -b your-branch-name /RoboticsApplicationManager
57+
```
58+
59+
## Building from a Custom Prebase Image
60+
61+
If you want to generate the base image from a prebase image that you created, you will need to modify the tag inside the Dockerfile so that it builds from the appropriate pre-base. The FROM command at the beginning of your Dockerfile should refer to your custom pre-base Docker image.
62+
63+
```dockerfile
64+
FROM jderobot/robotics-applications:<tag>
65+
```
66+
Remember to replace the tag with the tag of your custom pre-base Docker image. This ensures that your Docker base image builds from the correct pre-base image.
67+
68+
After making these modifications, you can proceed with building your base Docker image:
69+
70+
```bash
71+
docker build -t jderobot/robotics-applications:<tag> -f Dockerfile.base .
72+
```
73+
74+

0 commit comments

Comments
 (0)