Skip to content

Commit 102c91d

Browse files
committed
Project update to aerostack2 v1.1
1 parent 3d88bbb commit 102c91d

Some content is hidden

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

44 files changed

+2030
-367
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
rosbags/*
2-
psdk_authentication.yaml
1+
rosbags/*

AUTHORS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Rafael Pérez Seguí
2-
Miguel Fernández Cortizas
32
Pedro Arias Pérez
4-
David Pérez Saura
5-
Javier Melero Deza
3+
Javier Melero Deza
4+
Miguel Fernández Cortizas
5+
David Pérez Saura

README.md

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,143 @@
1-
# project_dji_psdk
1+
# Project DJI PSDK
2+
3+
<!-- Please refer to https://aerostack2.github.io/_02_examples/dji/project_dji_psdk/index.html for more information. -->
4+
5+
## Installation
6+
7+
You need to clone and build [as2_platform_dji_psdk](https://github.com/aerostack2/as2_platform_dji_psdk).
8+
<!-- refer to https://aerostack2.github.io/_03_aerial_platforms/_dji/index.html for more information. -->
9+
10+
To install this project, clone the repository:
11+
12+
```bash
13+
git clone https://github.com/aerostack2/project_dji_psdk.git
14+
```
15+
16+
To start using this project, please go to the root folder of the project.
17+
18+
## Execution
19+
20+
### 0. Pre-requisites
21+
For this drones, aerostack2 nodes must be launched in the onboard computer of each drone, and the ground station can be launched in both the onboard computer of the drone or in an external computer.
22+
23+
For configure the onboard computer udev rules, you can execute the following command:
24+
25+
```bash
26+
./utils/configure_onboard_computer.bash
27+
```
28+
29+
Also, you need to configure *config/psdk_authentication.yaml* file before launch the nodes, and customize the *config/link_config.json* with your connection settings.
30+
31+
### 1. Launch aerostack2 nodes for each drone
32+
To launch aerostack2 nodes for each drone, execute once the following command:
33+
34+
```bash
35+
./launch_as2.bash -n drone0
36+
```
37+
38+
Re-launch the command for each drone you want to launch, changing the drone namespace with the flag `-n`.
39+
40+
The flags for the components launcher are:
41+
42+
- **-n**: drone namespace. Default is 'drone0'
43+
- **-b**: launch behavior tree
44+
- **-r**: record rosbag. Default not launch
45+
- **-g**: launch using gnome-terminal instead of tmux
46+
47+
48+
### 2. Launch aerostack2 nodes for the ground station
49+
To launch aerostack2 nodes for the ground station, execute once the following command:
50+
51+
```bash
52+
./launch_ground_station.bash -n drone0
53+
```
54+
55+
The flags for the components launcher are:
56+
57+
- **-n**: drone namespaces, comma separated. Default is 'drone0'
58+
- **-t**: launch keyboard teleoperation. Default not launch
59+
- **-v**: open rviz. Default not launch
60+
- **-m**: launch mocap4ros2. Default not launch
61+
- **-r**: record rosbag. Default not launch
62+
- **-g**: launch using gnome-terminal instead of tmux
63+
64+
### 3. Launch a mission
65+
There are several missions that can be executed:
66+
67+
- **AS2 keyboard teleoperation control**: You can use the keyboard teleoperation launched with the ground station, using the flag `-t`:
68+
```bash
69+
./launch_ground_station.bash -t
70+
```
71+
- **AS2 Python API single drone mission**: You can execute a mission that used AS2 Python API, launching the mission with:
72+
```bash
73+
python3 mission.py -n drone0
74+
```
75+
- **AS2 Python API single drone mission using GPS**: You can execute a mission that used AS2 Python API with GPS, launching the mission with:
76+
```bash
77+
python3 mission_gps.py -n drone0
78+
```
79+
- **AS2 Mission Interpreter single drone mission**: You can execute a mission that used AS2 Mission Interpreter, launching the mission with:
80+
```bash
81+
python3 mission_interpreter.py -n drone0
82+
```
83+
- **AS2 Behavior Trees single drone mission**: You can execute a mission that used AS2 Behavior Trees, launching the mission with:
84+
```bash
85+
python3 mission_behavior_tree.py -n drone0
86+
```
87+
You must launch behavior trees with the flag `-b`, as:
88+
```bash
89+
./launch_as2.bash -n drone0 -b
90+
```
91+
92+
### 4. End the execution
93+
94+
If you are using tmux, you can end the execution with the following command:
95+
96+
- **End the execution of all nodes**:
97+
```bash
98+
./stop_tmuxinator_as2.bash drone0
99+
```
100+
- **End the execution of all nodes of the ground station**:
101+
```bash
102+
./stop_tmuxinator_ground_station.bash
103+
```
104+
- **End the execution of both**:
105+
```bash
106+
./stop_tmuxinator.bash drone0
107+
```
108+
109+
You can force the end of all tmux sessions with the command:
110+
```bash
111+
tmux kill-server
112+
```
113+
114+
If you are using gnome-terminal, you can end the execution by closing the terminal.
115+
116+
## Developers guide
117+
118+
All projects in aerostack2 are structured in the same way. The project is divided into the following directories:
119+
120+
- **tmuxinator**: Contains the tmuxinator launch file, which is used to launch all aerostack2 nodes.
121+
- **aerostack2.yaml**: Tmuxinator launch file for each drone. The list of nodes to be launched is defined here.
122+
- **ground_station.yaml**: Tmuxinator launch file for the ground station. The list of nodes to be launched is defined here.
123+
- **config**: Contains the configuration files for the launchers of the nodes in the drones.
124+
- **config_ground_station**: Contains the configuration files for the launchers of the nodes in the ground station.
125+
- **launch_as2.bash**: Script to launch nodes defined in *tmuxinator/aerostack2.yaml*.
126+
- **launch_ground_station.bash**: Script to launch nodes defined in *tmuxinator/ground_station.yaml*.
127+
- **mission_\*.py**: Differents python mission files that can be executed.
128+
- **stop_tmuxinator_as2.bash**: Script to stop all nodes launched by *launch_as2.bash*.
129+
- **stop_tmuxinator_ground_station.bash**: Script to stop all nodes launched by *launch_ground_station.bash*.
130+
- **stop_tmuxinator.bash**: Script to stop all nodes launched by *launch_as2.bash* and *launch_ground_station.bash*.
131+
- **rosbag/record_rosbag.bash**: Script to record a rosbag. Can be modified to record only the topics that are needed.
132+
- **trees\***: Contains the behavior trees that can be executed. They can be selected in the *aerostack2.yaml* file.
133+
- **utils**: Contains utils scripts for launchers.
134+
135+
Both python and bash scripts have a help message that can be displayed by running the script with the `-h` option. For example, `./launch_as2.bash -h` will display the help message for the `launch_as2.bash` script.
136+
137+
**Note**: For knowing all parameters for each launch, you can execute the following command:
138+
139+
```bash
140+
ros2 launch my_package my_launch.py -s
141+
```
142+
143+
Also, you can see them in the default config file of the package, in the *config* folder. If you want to modify the default parameters, you can add the parameter to the config file.

config/config.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**:
2+
# # Global Parameters
3+
# ros__parameters:
4+
# tf_timeout_threshold: 0.05
5+
6+
# Basic Robotics Functions
7+
# Platform
8+
platform:
9+
ros__parameters:
10+
enable_camera: false
11+
enable_gimbal: false
12+
13+
# State Estimator
14+
state_estimator:
15+
ros__parameters:
16+
# # Indoor Raw Odometry
17+
# plugin_name: "raw_odometry"
18+
# # Indoor Motion Capture
19+
# plugin_name: "mocap_pose"
20+
# mocap_topic: "/mocap/rigid_bodies"
21+
# twist_smooth_filter_cte: 0.1
22+
# orientation_smooth_filter_cte: 0.1
23+
# Outdoor (GPS) Raw Odometry
24+
plugin_name: "raw_odometry"
25+
use_gps: true
26+
set_origin_on_start: true
27+
28+
# Behaviors Motion
29+
TakeoffBehavior:
30+
ros__parameters:
31+
takeoff_plugin_name: "takeoff_plugin_platform"
32+
LandBehavior:
33+
ros__parameters:
34+
land_plugin_name: "land_plugin_platform"
35+
GoToBehavior:
36+
ros__parameters:
37+
go_to_plugin_name: "go_to_plugin_position"
38+
# go_to_plugin_name: "go_to_plugin_trajectory"
39+
FollowPathBehavior:
40+
ros__parameters:
41+
follow_path_plugin_name: "follow_path_plugin_position"
42+
# follow_path_plugin_name: "follow_path_plugin_trajectory"
43+
44+
# Behaviors Perception
45+
point_gimbal_behavior:
46+
ros__parameters:
47+
behavior_timeout: 10.0
48+
gimbal_name: gimbal
49+
gimbal_frame_id: gimbal
50+
gimbal_base_frame_id: gimbal_base
51+
gimbal_threshold: 0.01
52+
53+
# Specific Parameters for each drone
54+
# drone0:
55+
# # Motion Capture
56+
# state_estimator:
57+
# ros__parameters:
58+
# rigid_body_name: "1"
59+

real_config/link_config.json renamed to config/link_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"link_available": "use_only_uart/use_uart_and_usb_bulk_device/use_uart_and_network_device",
44
"link_select": "use_uart_and_usb_bulk_device",
55
"uart_config": {
6-
"uart1_device_name": "/dev/ttyUSB0",
6+
"uart1_device_name": "/dev/dji_serial",
77
"uart2_device_enable": "true",
8-
"uart2_device_name": "/dev/ttyACM0"
8+
"uart2_device_name": "/dev/dji_advanced_sensing"
99
},
1010
"network_config": {
1111
"network_device_name": "enxf8e43b7bbc2c",

real_config/pid_speed_controller.yaml renamed to config/pid_speed_controller.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
y: 0.0
1515
z: 0.0
1616
ki:
17-
x: 0.0
18-
y: 0.0
19-
z: 0.0
17+
x: 0.01
18+
y: 0.01
19+
z: 0.01
2020
speed_control:
2121
reset_integral: false
2222
antiwindup_cte : 1.0
@@ -73,4 +73,4 @@
7373
alpha: 0.3
7474
kp: 1.0
7575
kd: 0.001
76-
ki: 0.0
76+
ki: 0.0

config/psdk_params.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**:
2+
ros__parameters:
3+
num_of_initialization_retries: 3
4+
5+
imu_frame: "imu_link"
6+
body_frame: "base_link"
7+
map_frame: "psdk_map_enu"
8+
gimbal_base_frame: "gimbal_base"
9+
gimbal_frame: "gimbal"
10+
camera_frame: "camera_link"
11+
publish_transforms: true
12+
13+
file_path: "/logs/media/"
14+
15+
# Mandatory modules to be initialized. Mark with a true those which you
16+
# consider mandatory for your application, false otherwise. Be aware that
17+
# some modules might have inter-dependencies. Non mandatory modules will
18+
# still be initialized but if case of failure, the node will continue to run.
19+
mandatory_modules:
20+
telemetry: true
21+
flight_control: true
22+
camera: false
23+
gimbal: false
24+
liveview: false
25+
hms: false
26+
perception: false
27+
28+
data_frequency: # Options are: 1, 5, 10, 50, 100, 200, 400 Hz
29+
imu: 1
30+
attitude: 10
31+
acceleration: 10
32+
velocity: 50
33+
angular_velocity: 10
34+
position: 50
35+
altitude: 50
36+
gps_fused_position: 50
37+
gps_data: 1
38+
rtk_data: 50
39+
magnetometer: 1
40+
rc_channels_data: 1
41+
gimbal_data: 10
42+
flight_status: 1
43+
battery_level: 1
44+
control_information: 1
45+
esc_data_frequency: 1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**:
2+
ros__parameters:
3+
verbose: False
4+
speed_value: 0.5
5+
altitude_speed_value: 0.5
6+
turn_speed_value: 0.5
7+
position_value: 1.00
8+
altitude_value: 1.00
9+
turn_angle_value: 0.78
10+
speed_frame_id: "earth"
11+
pose_frame_id: "earth"
12+
initial_mode: "pose"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**:
2+
mocap4r2_optitrack_driver_node:
3+
ros__parameters:
4+
connection_type: "Unicast" # Unicast / Multicast
5+
server_address: "192.168.1.160"
6+
local_address: "0.0.0.0"
7+
multicast_address: "239.255.42.99"
8+
server_command_port: 1510
9+
server_data_port: 1511

0 commit comments

Comments
 (0)