-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathcall_pos_cmd.sh
More file actions
54 lines (51 loc) · 814 Bytes
/
call_pos_cmd.sh
File metadata and controls
54 lines (51 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Check if the correct number of arguments is provided
if [ "$#" -ne 3 ]; then
echo "Usage: ./control_drone.sh <x> <y> <z>"
exit 1
fi
# Assign input arguments to variables
X_POS=$1
Y_POS=$2
Z_POS=$3
# Publish the PositionCommand message to control the drone
rostopic pub /planning/pos_cmd quadrotor_msgs/PositionCommand "header:
seq: 1
stamp: {secs: 0, nsecs: 0}
frame_id: 'base_link'
position:
x: $X_POS
y: $Y_POS
z: $Z_POS
velocity:
x: 0.0
y: 0.0
z: 0.0
acceleration:
x: 0.0
y: 0.0
z: 0.0
jerk:
x: 0.0
y: 0.0
z: 0.0
angular_velocity:
x: 0.0
y: 0.0
z: 0.0
attitude:
x: 0.0
y: 0.0
z: 0.0
thrust:
x: 0.0
y: 0.0
z: 0.0
yaw: 0.0
yaw_dot: 0.0
vel_norm: 0.0
acc_norm: 0.0
kx: [0.0, 0.0, 0.0]
kv: [0.0, 0.0, 0.0]
trajectory_id: 1
trajectory_flag: 1" -1