Skip to content

Commit 8f76293

Browse files
authored
Jkeller/jetson 36.4 (#195) (#196)
* Jkeller/jetson 36.4 (#195) * updating docker for l4t 36.4.0, added gui option to robot launch file * added calculation of ROS_DOMAIN_ID and ROBOT_NAME to bashrc for real robot, added sim argument to robot launch file for setting use_sime_time and launching guis, added behavior tree visualization topic to domain bridge * created sim and real ground-control-station extending from same base. they just have differences in their networks. configured some topics for domain bridge * added mavros to robot launch for real drone. tested communication is working between desktop and drone. commands set from the gui are getting to mavros * fixed slow moving trajetory controller bug, cleaned up robot launch and tested that it works in sim and on the real drone * incremented version * adding sim:=false argument to real robot launch
1 parent 9c9a7f0 commit 8f76293

File tree

13 files changed

+153
-78
lines changed

13 files changed

+153
-78
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PROJECT_NAME="airstack"
2-
PROJECT_VERSION="1.0.3"
2+
PROJECT_VERSION="1.0.4"
33
# can replace with your docker hub username
44
PROJECT_DOCKER_REGISTRY="airlab-storage.andrew.cmu.edu:5001/shared"
55
DEFAULT_ISAAC_SCENE="omniverse://airlab-storage.andrew.cmu.edu:8443/Projects/AirStack/fire_academy.scene.usd"
Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,24 @@
11
services:
22
ground-control-station:
3-
image: &gcs_image ${PROJECT_DOCKER_REGISTRY}/${PROJECT_NAME}:v${PROJECT_VERSION}_gcs
4-
build:
5-
context: ../
6-
dockerfile: docker/Dockerfile.gcs
7-
tags:
8-
- *gcs_image
9-
container_name: ground-control-station
10-
entrypoint: ""
11-
command: >
12-
bash -c "ssh service restart;
13-
tmux new -d -s gcs_bringup
14-
&& tmux send-keys -t gcs_bringup
15-
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
16-
ros2 launch gcs_bringup gcs.launch.xml' ENTER
17-
&& sleep infinity"
18-
# Interactive shell
19-
stdin_open: true # docker run -i
20-
tty: true # docker run -t
21-
# Needed to display graphical applications
22-
# ipc: host
23-
privileged: true
3+
profiles:
4+
- ""
5+
- sitl
6+
extends:
7+
file: ./ground-control-station-base-docker-compose.yaml
8+
service: ground-control-station-base
249
networks:
2510
- airstack_network
26-
environment:
27-
- DISPLAY
28-
- QT_X11_NO_MITSHM=1
29-
deploy:
30-
# let it use the GPU
31-
resources:
32-
reservations:
33-
devices:
34-
- driver: nvidia # https://stackoverflow.com/a/70761193
35-
count: 1
36-
capabilities: [gpu]
3711
ports:
3812
- 2222:22 # for ssh
39-
volumes:
40-
# display stuff
41-
- $HOME/.Xauthority:/root/.Xauthority
42-
- /tmp/.X11-unix:/tmp/.X11-unix
43-
# developer stuff
44-
- .bashrc:/root/.bashrc:rw # bash config
45-
- /var/run/docker.sock:/var/run/docker.sock # access docker API for container name
46-
# autonomy stack stuff
47-
- ../../common/ros_packages:/root/ros_ws/src/common:rw # common ROS packages
48-
- ../ros_ws:/root/ros_ws:rw # gcs-specific ROS packages
49-
- ../../common/ros_packages/fastdds.xml:/root/ros_ws/fastdds.xml:rw # fastdds.xml
13+
14+
ground-control-station-real:
15+
profiles:
16+
- hitl
17+
- deploy
18+
extends:
19+
file: ./ground-control-station-base-docker-compose.yaml
20+
service: ground-control-station-base
21+
network_mode: host
5022

5123
# include:
5224
# - ./tak-docker-compose.yaml
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# docker compose file
2+
services:
3+
ground-control-station-base:
4+
image: &gcs_image ${PROJECT_DOCKER_REGISTRY}/${PROJECT_NAME}:v${PROJECT_VERSION}_gcs
5+
build:
6+
context: ../
7+
dockerfile: docker/Dockerfile.gcs
8+
tags:
9+
- *gcs_image
10+
container_name: ground-control-station
11+
entrypoint: ""
12+
command: >
13+
bash -c "ssh service restart;
14+
tmux new -d -s gcs_bringup
15+
&& tmux send-keys -t gcs_bringup
16+
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
17+
ros2 launch gcs_bringup gcs.launch.xml' ENTER
18+
&& sleep infinity"
19+
# Interactive shell
20+
stdin_open: true # docker run -i
21+
tty: true # docker run -t
22+
# Needed to display graphical applications
23+
# ipc: host
24+
privileged: true
25+
environment:
26+
- DISPLAY
27+
- QT_X11_NO_MITSHM=1
28+
deploy:
29+
# let it use the GPU
30+
resources:
31+
reservations:
32+
devices:
33+
- driver: nvidia # https://stackoverflow.com/a/70761193
34+
count: 1
35+
capabilities: [gpu]
36+
volumes:
37+
# display stuff
38+
- $HOME/.Xauthority:/root/.Xauthority
39+
- /tmp/.X11-unix:/tmp/.X11-unix
40+
# developer stuff
41+
- .bashrc:/root/.bashrc:rw # bash config
42+
- /var/run/docker.sock:/var/run/docker.sock # access docker API for container name
43+
# autonomy stack stuff
44+
- ../../common/ros_packages:/root/ros_ws/src/common:rw # common ROS packages
45+
- ../ros_ws:/root/ros_ws:rw # gcs-specific ROS packages
46+
- ../../common/ros_packages/fastdds.xml:/root/ros_ws/fastdds.xml:rw # fastdds.xml
Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
name: my_bridge
2-
from_domain: 0
3-
to_domain: 1
42
topics:
53
/robot_1/behavior/behavior_tree_commands:
64
type: behavior_tree_msgs/msg/BehaviorTreeCommands
5+
from_domain: 0
6+
to_domain: 1
7+
/robot_2/behavior/behavior_tree_commands:
8+
type: behavior_tree_msgs/msg/BehaviorTreeCommands
9+
from_domain: 0
10+
to_domain: 2
11+
/robot_3/behavior/behavior_tree_commands:
12+
type: behavior_tree_msgs/msg/BehaviorTreeCommands
13+
from_domain: 0
14+
to_domain: 3
715
/robot_1/fixed_trajectory_generator/fixed_trajectory_command:
816
type: airstack_msgs/msg/FixedTrajectory
9-
/robot_1/behavior/behavior_tree_graphviz:
10-
type: std_msgs/msg/String
11-
reversed: True
17+
from_domain: 0
18+
to_domain: 1
19+
/robot_2/fixed_trajectory_generator/fixed_trajectory_command:
20+
type: airstack_msgs/msg/FixedTrajectory
21+
from_domain: 0
22+
to_domain: 2
23+
/robot_3/fixed_trajectory_generator/fixed_trajectory_command:
24+
type: airstack_msgs/msg/FixedTrajectory
25+
from_domain: 0
26+
to_domain: 3

robot/docker/.bashrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,18 @@ CONTAINER_PREFIX="airstack-"
176176
export ROBOT_NAME=$(echo "$container_name" | sed "s#/$CONTAINER_PREFIX##" | sed 's#-#_#')
177177
export ROS_DOMAIN_ID=$(echo "$ROBOT_NAME" | awk -F'_' '{print $NF}')
178178

179+
if [ "$ROBOT_NAME" == "null" ]; then
180+
num=$(hostname | awk -F'-' '{print $2}') # get number from hostname
181+
num=$((num)) #remove leading zeros
182+
183+
if [[ "$num" == 0 ]]; then
184+
export ROBOT_NAME="ERROR"
185+
export ROS_DOMAIN_ID="ERROR"
186+
else
187+
export ROBOT_NAME="robot_$num"
188+
export ROS_DOMAIN_ID=$num
189+
fi
190+
fi
191+
179192
export RCUTILS_COLORIZED_OUTPUT=1 # get colored output from ROS2 tools
180193

robot/docker/Dockerfile.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ RUN apt remove -y libopenvdb*; \
110110
cd ..; rm -rf /opt/openvdb/build
111111

112112
# Add ability to SSH
113-
RUN apt-get update && apt-get install -y openssh-server
113+
RUN apt-get update && apt-get install -y openssh-server libimath-dev
114114
RUN mkdir /var/run/sshd
115115

116116
# Password is airstack

robot/docker/docker-compose.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ services:
1717
BASE_IMAGE: ubuntu:22.04
1818
tags:
1919
- *desktop_image
20+
# we use tmux send-keys so that the session stays alive
21+
command: >
22+
bash -c "ssh service restart;
23+
tmux new -d -s robot_bringup
24+
&& tmux send-keys -t robot_bringup
25+
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
26+
ros2 launch robot_bringup robot.launch.xml' ENTER
27+
&& sleep infinity"
2028
# assumes you're connected to work internet, so creates a network to isolate from other developers on your work internet
2129
networks:
2230
- airstack_network
@@ -38,8 +46,17 @@ services:
3846
build:
3947
dockerfile: ./Dockerfile.robot
4048
args:
41-
BASE_IMAGE: nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3
49+
BASE_IMAGE: nvcr.io/nvidia/l4t-jetpack:r36.4.0
4250
tags:
4351
- *l4t_image
52+
# we use tmux send-keys so that the session stays alive
53+
command: >
54+
bash -c "ssh service restart;
55+
tmux new -d -s robot_bringup
56+
&& tmux send-keys -t robot_bringup
57+
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
58+
ros2 launch robot_bringup robot.launch.xml sim:="false" ' ENTER
59+
&& sleep infinity"
60+
runtime: nvidia
4461
# assumes network isolation via a physical router, so uses network_mode=host
4562
network_mode: host

robot/docker/robot-base-docker-compose.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
services:
33
robot_base:
44
entrypoint: ""
5-
# we use tmux send-keys so that the session stays alive
6-
command: >
7-
bash -c "ssh service restart;
8-
tmux new -d -s robot_bringup
9-
&& tmux send-keys -t robot_bringup
10-
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
11-
ros2 launch robot_bringup robot.launch.xml' ENTER
12-
&& sleep infinity"
135
# Interactive shell
146
stdin_open: true # docker run -i
157
tty: true # docker run -t

robot/ros_ws/src/autonomy/3_local/b_planners/trajectory_library/src/trajectory_library.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,12 @@ bool Trajectory::get_waypoint_sphere_intersection(double initial_time, double ah
483483
wp_end = wp_start.interpolate(
484484
wp_end, (ahead_distance - current_path_distance) / segment_distance);
485485
if (end_waypoint != NULL) *end_waypoint = wp_end;
486-
} else if (wp_end.get_time() > time_end) {
486+
}/* else if (wp_end.get_time() > time_end) {
487487
should_break = true;
488488
wp_end = wp_start.interpolate(wp_end, (time_end - wp_start.get_time()) /
489489
(wp_end.get_time() - wp_start.get_time()));
490490
if (end_waypoint != NULL) *end_waypoint = wp_end;
491-
} else
491+
}*/ else
492492
current_path_distance += segment_distance;
493493

494494
// sphere line intersection equations:

robot/ros_ws/src/autonomy/3_local/local_bringup/launch/local.launch.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<param name="tracking_point_distance_limit" value="10.5" />
6161
<param name="velocity_look_ahead_time" value="0.9" />
6262
<!-- look ahead time controls the speed, greater is faster -->
63-
<param name="look_ahead_time" value="2.0" />
63+
<param name="look_ahead_time" value="1.0" />
6464
<param name="virtual_tracking_ahead_time" value="0.5" />
6565
<param name="min_virtual_tracking_velocity" value="0.1" />
6666
<param name="sphere_radius" value="1." />
@@ -83,4 +83,4 @@
8383
output="screen" respawn="true" respawn_delay="1" />
8484
?>
8585

86-
</launch>
86+
</launch>

robot/ros_ws/src/autonomy/5_behavior/behavior_bringup/launch/behavior.launch.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<launch>
2-
<!-- GUI interface -->
32
<group>
43
<push-ros-namespace namespace="behavior" />
5-
<node pkg="rqt_gui" exec="rqt_gui"
6-
args="--perspective-file $(find-pkg-share robot_bringup)/config/core.perspective">
7-
<remap from="fixed_trajectory_command"
8-
to="/$(env ROBOT_NAME)/fixed_trajectory_generator/fixed_trajectory_command" />
9-
</node>
104

115
<!-- Behavior Tree -->
126
<node pkg="behavior_tree" exec="behavior_tree_implementation">
Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
<!-- ROBOT -->
22
<launch>
3+
4+
<arg name="sim" default="true" />
5+
36
<push_ros_namespace namespace="$(env ROBOT_NAME)" />
47

5-
<!-- TODO: parameterize this -->
6-
<set_parameter name="use_sim_time" value="true" />
8+
<set_parameter name="use_sim_time" value="true" if="$(var sim)" />
9+
10+
<!-- Sim -->
11+
<group if="$(var sim)">
12+
<!-- GUI -->
13+
<node pkg="rviz2" exec="rviz2"
14+
args="-d $(find-pkg-share robot_bringup)/rviz/robot.rviz --ros-args --log-level INFO"
15+
output="screen" respawn="true" respawn_delay="1" />
16+
17+
<push-ros-namespace namespace="behavior" />
18+
<node pkg="rqt_gui" exec="rqt_gui"
19+
args="--perspective-file $(find-pkg-share robot_bringup)/config/core.perspective">
20+
<remap from="fixed_trajectory_command"
21+
to="/$(env ROBOT_NAME)/fixed_trajectory_generator/fixed_trajectory_command" />
22+
</node>
23+
</group>
24+
<!-- Real -->
25+
<group unless="$(var sim)">
26+
<push-ros-namespace namespace="interface" />
27+
<include file="$(find-pkg-share mavros)/launch/apm.launch">
28+
<arg name="fcu_url" value="/dev/ttyTHS1:115200" />
29+
</include>
30+
</group>
31+
32+
733

834
<!-- Static TFs -->
935
<include file="$(find-pkg-share robot_bringup)/launch/static_transforms.launch.xml" />
@@ -14,14 +40,9 @@
1440
<!-- Logging -->
1541
<include file="$(find-pkg-share logging_bringup)/launch/logging.launch.xml" />
1642

17-
<!-- GUI -->
18-
19-
<node pkg="rviz2" exec="rviz2"
20-
args="-d $(find-pkg-share robot_bringup)/rviz/robot.rviz --ros-args --log-level INFO"
21-
output="screen" respawn="true" respawn_delay="1" />
22-
43+
<!-- Domain Bridge -->
2344
<node pkg="domain_bridge" exec="domain_bridge"
2445
args="/root/ros_ws/src/robot_bringup/params/domain_bridge.yaml"
2546
output="screen" respawn="true" respawn_delay="1" />
2647

27-
</launch>
48+
</launch>

robot/ros_ws/src/robot_bringup/params/domain_bridge.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ topics:
4444
from_domain: 2
4545
to_domain: 1
4646

47+
/robot_3/behavior/behavior_tree_graphviz:
48+
type: std_msgs/msg/String
49+
from_domain: 3
50+
to_domain: 0
51+
4752
# Bridge "/clock" topic from doman ID 2 to domain ID 3,
4853
# Override durability to be 'volatile' and override depth to be 1
4954
clock:

0 commit comments

Comments
 (0)