Skip to content

Commit

Permalink
Jkeller/jetson 36.4 (#195)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jfkeller authored Jan 28, 2025
1 parent 9c9a7f0 commit d6c768b
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 69 deletions.
58 changes: 15 additions & 43 deletions ground_control_station/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,24 @@
services:
ground-control-station:
image: &gcs_image ${PROJECT_DOCKER_REGISTRY}/${PROJECT_NAME}:v${PROJECT_VERSION}_gcs
build:
context: ../
dockerfile: docker/Dockerfile.gcs
tags:
- *gcs_image
container_name: ground-control-station
entrypoint: ""
command: >
bash -c "ssh service restart;
tmux new -d -s gcs_bringup
&& tmux send-keys -t gcs_bringup
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
ros2 launch gcs_bringup gcs.launch.xml' ENTER
&& sleep infinity"
# Interactive shell
stdin_open: true # docker run -i
tty: true # docker run -t
# Needed to display graphical applications
# ipc: host
privileged: true
profiles:
- ""
- sitl
extends:
file: ./ground-control-station-base-docker-compose.yaml
service: ground-control-station-base
networks:
- airstack_network
environment:
- DISPLAY
- QT_X11_NO_MITSHM=1
deploy:
# let it use the GPU
resources:
reservations:
devices:
- driver: nvidia # https://stackoverflow.com/a/70761193
count: 1
capabilities: [gpu]
ports:
- 2222:22 # for ssh
volumes:
# display stuff
- $HOME/.Xauthority:/root/.Xauthority
- /tmp/.X11-unix:/tmp/.X11-unix
# developer stuff
- .bashrc:/root/.bashrc:rw # bash config
- /var/run/docker.sock:/var/run/docker.sock # access docker API for container name
# autonomy stack stuff
- ../../common/ros_packages:/root/ros_ws/src/common:rw # common ROS packages
- ../ros_ws:/root/ros_ws:rw # gcs-specific ROS packages
- ../../common/ros_packages/fastdds.xml:/root/ros_ws/fastdds.xml:rw # fastdds.xml

ground-control-station-real:
profiles:
- hitl
- deploy
extends:
file: ./ground-control-station-base-docker-compose.yaml
service: ground-control-station-base
network_mode: host

# include:
# - ./tak-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# docker compose file
services:
ground-control-station-base:
image: &gcs_image ${PROJECT_DOCKER_REGISTRY}/${PROJECT_NAME}:v${PROJECT_VERSION}_gcs
build:
context: ../
dockerfile: docker/Dockerfile.gcs
tags:
- *gcs_image
container_name: ground-control-station
entrypoint: ""
command: >
bash -c "ssh service restart;
tmux new -d -s gcs_bringup
&& tmux send-keys -t gcs_bringup
'if [ ! -f "/root/ros_ws/install/setup.bash" ]; then bws && sws; fi;
ros2 launch gcs_bringup gcs.launch.xml' ENTER
&& sleep infinity"
# Interactive shell
stdin_open: true # docker run -i
tty: true # docker run -t
# Needed to display graphical applications
# ipc: host
privileged: true
environment:
- DISPLAY
- QT_X11_NO_MITSHM=1
deploy:
# let it use the GPU
resources:
reservations:
devices:
- driver: nvidia # https://stackoverflow.com/a/70761193
count: 1
capabilities: [gpu]
volumes:
# display stuff
- $HOME/.Xauthority:/root/.Xauthority
- /tmp/.X11-unix:/tmp/.X11-unix
# developer stuff
- .bashrc:/root/.bashrc:rw # bash config
- /var/run/docker.sock:/var/run/docker.sock # access docker API for container name
# autonomy stack stuff
- ../../common/ros_packages:/root/ros_ws/src/common:rw # common ROS packages
- ../ros_ws:/root/ros_ws:rw # gcs-specific ROS packages
- ../../common/ros_packages/fastdds.xml:/root/ros_ws/fastdds.xml:rw # fastdds.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
name: my_bridge
from_domain: 0
to_domain: 1
topics:
/robot_1/behavior/behavior_tree_commands:
type: behavior_tree_msgs/msg/BehaviorTreeCommands
from_domain: 0
to_domain: 1
/robot_2/behavior/behavior_tree_commands:
type: behavior_tree_msgs/msg/BehaviorTreeCommands
from_domain: 0
to_domain: 2
/robot_3/behavior/behavior_tree_commands:
type: behavior_tree_msgs/msg/BehaviorTreeCommands
from_domain: 0
to_domain: 3
/robot_1/fixed_trajectory_generator/fixed_trajectory_command:
type: airstack_msgs/msg/FixedTrajectory
/robot_1/behavior/behavior_tree_graphviz:
type: std_msgs/msg/String
reversed: True
from_domain: 0
to_domain: 1
/robot_2/fixed_trajectory_generator/fixed_trajectory_command:
type: airstack_msgs/msg/FixedTrajectory
from_domain: 0
to_domain: 2
/robot_3/fixed_trajectory_generator/fixed_trajectory_command:
type: airstack_msgs/msg/FixedTrajectory
from_domain: 0
to_domain: 3
7 changes: 7 additions & 0 deletions robot/docker/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,12 @@ CONTAINER_PREFIX="airstack-"
export ROBOT_NAME=$(echo "$container_name" | sed "s#/$CONTAINER_PREFIX##" | sed 's#-#_#')
export ROS_DOMAIN_ID=$(echo "$ROBOT_NAME" | awk -F'_' '{print $NF}')

if [ "$ROBOT_NAME" == "null" ]; then
num=$(hostname | awk -F'-' '{print $2}') # get number from hostname
num=$((num)) #remove leading zeros
export ROBOT_NAME="robot_$num"
export ROS_DOMAIN_ID=$num
fi

export RCUTILS_COLORIZED_OUTPUT=1 # get colored output from ROS2 tools

2 changes: 1 addition & 1 deletion robot/docker/Dockerfile.robot
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ RUN apt remove -y libopenvdb*; \
cd ..; rm -rf /opt/openvdb/build

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

# Password is airstack
Expand Down
3 changes: 2 additions & 1 deletion robot/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ services:
build:
dockerfile: ./Dockerfile.robot
args:
BASE_IMAGE: nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3
BASE_IMAGE: nvcr.io/nvidia/l4t-jetpack:r36.4.0
tags:
- *l4t_image
runtime: nvidia
# assumes network isolation via a physical router, so uses network_mode=host
network_mode: host
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,12 @@ bool Trajectory::get_waypoint_sphere_intersection(double initial_time, double ah
wp_end = wp_start.interpolate(
wp_end, (ahead_distance - current_path_distance) / segment_distance);
if (end_waypoint != NULL) *end_waypoint = wp_end;
} else if (wp_end.get_time() > time_end) {
}/* else if (wp_end.get_time() > time_end) {
should_break = true;
wp_end = wp_start.interpolate(wp_end, (time_end - wp_start.get_time()) /
(wp_end.get_time() - wp_start.get_time()));
if (end_waypoint != NULL) *end_waypoint = wp_end;
} else
}*/ else
current_path_distance += segment_distance;

// sphere line intersection equations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<param name="tracking_point_distance_limit" value="10.5" />
<param name="velocity_look_ahead_time" value="0.9" />
<!-- look ahead time controls the speed, greater is faster -->
<param name="look_ahead_time" value="2.0" />
<param name="look_ahead_time" value="1.0" />
<param name="virtual_tracking_ahead_time" value="0.5" />
<param name="min_virtual_tracking_velocity" value="0.1" />
<param name="sphere_radius" value="1." />
Expand All @@ -83,4 +83,4 @@
output="screen" respawn="true" respawn_delay="1" />
?>

</launch>
</launch>
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<launch>
<!-- GUI interface -->
<group>
<push-ros-namespace namespace="behavior" />
<node pkg="rqt_gui" exec="rqt_gui"
args="--perspective-file $(find-pkg-share robot_bringup)/config/core.perspective">
<remap from="fixed_trajectory_command"
to="/$(env ROBOT_NAME)/fixed_trajectory_generator/fixed_trajectory_command" />
</node>

<!-- Behavior Tree -->
<node pkg="behavior_tree" exec="behavior_tree_implementation">
Expand Down
39 changes: 30 additions & 9 deletions robot/ros_ws/src/robot_bringup/launch/robot.launch.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
<!-- ROBOT -->
<launch>

<arg name="sim" default="true" />

<push_ros_namespace namespace="$(env ROBOT_NAME)" />

<!-- TODO: parameterize this -->
<set_parameter name="use_sim_time" value="true" />
<set_parameter name="use_sim_time" value="true" if="$(var sim)" />

<!-- Sim -->
<group if="$(var sim)">
<!-- GUI -->
<node pkg="rviz2" exec="rviz2"
args="-d $(find-pkg-share robot_bringup)/rviz/robot.rviz --ros-args --log-level INFO"
output="screen" respawn="true" respawn_delay="1" />

<push-ros-namespace namespace="behavior" />
<node pkg="rqt_gui" exec="rqt_gui"
args="--perspective-file $(find-pkg-share robot_bringup)/config/core.perspective">
<remap from="fixed_trajectory_command"
to="/$(env ROBOT_NAME)/fixed_trajectory_generator/fixed_trajectory_command" />
</node>
</group>
<!-- Real -->
<group unless="$(var sim)">
<push-ros-namespace namespace="interface" />
<include file="$(find-pkg-share mavros)/launch/apm.launch">
<arg name="fcu_url" value="/dev/ttyTHS1:115200" />
</include>
</group>



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

<!-- GUI -->

<node pkg="rviz2" exec="rviz2"
args="-d $(find-pkg-share robot_bringup)/rviz/robot.rviz --ros-args --log-level INFO"
output="screen" respawn="true" respawn_delay="1" />

<!-- Domain Bridge -->
<node pkg="domain_bridge" exec="domain_bridge"
args="/root/ros_ws/src/robot_bringup/params/domain_bridge.yaml"
output="screen" respawn="true" respawn_delay="1" />

</launch>
</launch>
5 changes: 5 additions & 0 deletions robot/ros_ws/src/robot_bringup/params/domain_bridge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ topics:
from_domain: 2
to_domain: 1

/robot_3/behavior/behavior_tree_graphviz:
type: std_msgs/msg/String
from_domain: 3
to_domain: 0

# Bridge "/clock" topic from doman ID 2 to domain ID 3,
# Override durability to be 'volatile' and override depth to be 1
clock:
Expand Down

0 comments on commit d6c768b

Please sign in to comment.