![]() |
deepracer_offroad_launcher package from aws-deepracer-offroad-sample-project repoctrl_pkg deepracer_interfaces_pkg deepracer_offroad_launcher deepracer_offroad_navigation_pkg qr_detection_pkg webserver_pkg |
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/aws-deepracer/aws-deepracer-offroad-sample-project.git |
VCS Type | git |
VCS Version | main |
Last Updated | 2022-06-06 |
Dev Status | UNMAINTAINED |
CI status | No Continuous Integration |
Released | UNRELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- AWS DeepRacer
Authors
AWS DeepRacer Offroad launcher package
Overview
The AWS DeepRacer Offroad sample project is a sample application built on top of the existing AWS DeepRacer application to identify and navigate the AWS DeepRacer device through a path set up using QR codes to guide it. For detailed information about the DeepRacer Offroad sample project, see the AWS DeepRacer Offroad sample project Getting started section.
License
The source code is released under Apache 2.0.
Installation
Follow these instructions to install the AWS DeepRacer Offroad launcher package.
Prerequisites
The AWS DeepRacer device comes with all the prerequisite packages and libraries installed to run the DeepRacer Offroad sample project. For more information about the pre-installed set of packages and libraries on the AWS DeepRacer and about installing the required build systems, see Getting started with AWS DeepRacer OpenSource. The AWS DeepRacer Offroad sample project requires the AWS DeepRacer application to be installed on the device, as it leverages most of the packages from the core application.
The following are the additional software requirements to get the AWS DeepRacer Offroad sample project to work on the AWS DeepRacer device.
- Calibrate the AWS DeepRacer (optional): Follow the instructions to calibrate the mechanics of your AWS DeepRacer vehicle. This should be done so that the vehicle performance is optimal and it behaves as expected.
Downloading and building
Open a terminal on the AWS DeepRacer device and run the following commands as the root user.
-
Switch to the root user before you source the ROS 2 installation:
sudo su
-
Stop the
deepracer-core.service
that is currently running on the device:systemctl stop deepracer-core
-
Source the ROS 2 Foxy setup bash script:
source /opt/ros/foxy/setup.bash
-
Set the environment variables required to run Intel OpenVino scripts:
source /opt/intel/openvino_2021/bin/setupvars.sh
-
Create a workspace directory for the package:
mkdir -p ~/deepracer_ws cd ~/deepracer_ws
-
Clone the entire AWS DeepRacer Offroad sample project on the AWS DeepRacer device:
git clone https://github.com/aws-deepracer/aws-deepracer-offroad-sample-project.git cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/
-
Clone the
async_web_server_cpp
,web_video_server
,plidar_ros
, andpyzbar
dependency packages on the AWS DeepRacer device:cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/ && ./install_dependencies.sh
-
Fetch unreleased dependencies:
cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/ rosws update
-
Resolve the dependencies:
cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/ && rosdep install -i --from-path . --rosdistro foxy -y
-
Build the packages in the workspace
cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/ && colcon build
Usage
Follow these instructions to use the sample project.
Run the node
To launch the AWS DeepRacer Offroad sample application as the root user on the AWS DeepRacer device, open another terminal on the device and run the following commands as the root user:
-
Switch to the root user before you source the ROS 2 installation:
sudo su
-
Source the ROS 2 Foxy setup bash script:
source /opt/ros/foxy/setup.bash
-
Set the environment variables required to run Intel OpenVino scripts:
source /opt/intel/openvino_2021/bin/setupvars.sh
-
Source the setup script for the installed packages:
source ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/install/setup.bash
-
Launch the nodes required for the AWS DeepRacer Offroad sample project:
ros2 launch deepracer_offroad_launcher deepracer_offroad_launcher.py
Once the AWS DeepRacer Offroad sample application is launched, you can follow the steps here to open the AWS DeepRacer Vehicle’s Device Console and checkout the DeepRacer Offroad mode tab which will help you control the vehicle.
Enabling offroad
mode using the CLI
Once the deepracer_offroad_launcher
has been kicked off, open a adjacent new terminal as the root user:
-
Navigate to the AWS DeepRacer Offroad workspace:
cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/
-
Source the ROS 2 Foxy setup bash script:
source /opt/ros/foxy/setup.bash
-
Source the setup script for the installed packages:
source ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/install/setup.bash
-
Set the mode of the AWS DeepRacer via
ctrl_pkg
tooffroad
using the following ROS 2 service call:ros2 service call /ctrl_pkg/vehicle_state deepracer_interfaces_pkg/srv/ActiveStateSrv "{state: 3}"
-
Enable
offroad
mode using the following ROS 2 service call:ros2 service call /ctrl_pkg/enable_state deepracer_interfaces_pkg/srv/EnableStateSrv "{is_active: True}"
Changing the MAX_SPEED
scale of the AWS DeepRacer
The MAX_SPEED
scale of the AWS DeepRacer can be modified using a ROS 2 service call in case the car isn’t moving as expected. This can occur for multiple reasons, such as the vehicle battery percentage or the surface on which the car is being operated.
-
Switch to the root user before you source the ROS 2 installation:
sudo su
-
Navigate to the AWS DeepRacer Offroad workspace:
cd ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/
-
Source the ROS 2 Foxy setup bash script:
source /opt/ros/foxy/setup.bash
-
Source the setup script for the installed packages:
source ~/deepracer_ws/aws-deepracer-offroad-sample-project/deepracer_offroad_ws/install/setup.bash
-
Change the
MAX_SPEED
to xx% of theMAX
Scale:ros2 service call /deepracer_offroad_navigation_pkg/set_max_speed deepracer_interfaces_pkg/srv/SetMaxSpeedSrv "{max_speed_pct: 0.xx}"
Example: Change the
MAX_SPEED
to 75% of theMAX
Scale:ros2 service call /deepracer_offroad_navigation_pkg/set_max_speed deepracer_interfaces_pkg/srv/SetMaxSpeedSrv "{max_speed_pct: 0.75}"
Launch files
The deepracer_offroad_launcher.py
, included in this package, is the main launcher file that launches all the required nodes for the AWS DeepRacer Offroad sample project. This launcher file also includes the nodes from the AWS DeepRacer core application.
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
ld = LaunchDescription()
qr_detection_node = Node(
package='qr_detection_pkg',
namespace='qr_detection_pkg',
executable='qr_detection_node',
name='qr_detection_node'
)
deepracer_offroad_navigation_node = Node(
package='deepracer_offroad_navigation_pkg',
namespace='deepracer_offroad_navigation_pkg',
executable='deepracer_offroad_navigation_node',
name='deepracer_offroad_navigation_node'
)
camera_node = Node(
package='camera_pkg',
namespace='camera_pkg',
executable='camera_node',
name='camera_node',
parameters=[
{'resize_images': False}
]
)
ctrl_node = Node(
package='ctrl_pkg',
namespace='ctrl_pkg',
executable='ctrl_node',
name='ctrl_node'
)
deepracer_navigation_node = Node(
package='deepracer_navigation_pkg',
namespace='deepracer_navigation_pkg',
executable='deepracer_navigation_node',
name='deepracer_navigation_node'
)
software_update_node = Node(
package='deepracer_systems_pkg',
namespace='deepracer_systems_pkg',
executable='software_update_node',
name='software_update_node'
)
model_loader_node = Node(
package='deepracer_systems_pkg',
namespace='deepracer_systems_pkg',
executable='model_loader_node',
name='model_loader_node'
)
otg_control_node = Node(
package='deepracer_systems_pkg',
namespace='deepracer_systems_pkg',
executable='otg_control_node',
name='otg_control_node'
)
network_monitor_node = Node(
package='deepracer_systems_pkg',
namespace='deepracer_systems_pkg',
executable='network_monitor_node',
name='network_monitor_node'
)
deepracer_systems_scripts_node = Node(
package='deepracer_systems_pkg',
namespace='deepracer_systems_pkg',
executable='deepracer_systems_scripts_node',
name='deepracer_systems_scripts_node'
)
device_info_node = Node(
package='device_info_pkg',
namespace='device_info_pkg',
executable='device_info_node',
name='device_info_node'
)
battery_node = Node(
package='i2c_pkg',
namespace='i2c_pkg',
executable='battery_node',
name='battery_node'
)
inference_node = Node(
package='inference_pkg',
namespace='inference_pkg',
executable='inference_node',
name='inference_node'
)
model_optimizer_node = Node(
package='model_optimizer_pkg',
namespace='model_optimizer_pkg',
executable='model_optimizer_node',
name='model_optimizer_node'
)
rplidar_node = Node(
package='rplidar_ros2',
namespace='rplidar_ros',
executable='rplidar_scan_publisher',
name='rplidar_scan_publisher',
parameters=[{
'serial_port': '/dev/ttyUSB0',
'serial_baudrate': 115200,
'frame_id': 'laser',
'inverted': False,
'angle_compensate': True,
}]
)
sensor_fusion_node = Node(
package='sensor_fusion_pkg',
namespace='sensor_fusion_pkg',
executable='sensor_fusion_node',
name='sensor_fusion_node'
)
servo_node = Node(
package='servo_pkg',
namespace='servo_pkg',
executable='servo_node',
name='servo_node'
)
status_led_node = Node(
package='status_led_pkg',
namespace='status_led_pkg',
executable='status_led_node',
name='status_led_node'
)
usb_monitor_node = Node(
package='usb_monitor_pkg',
namespace='usb_monitor_pkg',
executable='usb_monitor_node',
name='usb_monitor_node'
)
webserver_publisher_node = Node(
package='webserver_pkg',
namespace='webserver_pkg',
executable='webserver_publisher_node',
name='webserver_publisher_node'
)
web_video_server_node = Node(
package='web_video_server',
namespace='web_video_server',
executable='web_video_server',
name='web_video_server'
)
ld.add_action(qr_detection_node)
ld.add_action(deepracer_offroad_navigation_node)
ld.add_action(camera_node)
ld.add_action(ctrl_node)
ld.add_action(deepracer_navigation_node)
ld.add_action(software_update_node)
ld.add_action(model_loader_node)
ld.add_action(otg_control_node)
ld.add_action(network_monitor_node)
ld.add_action(deepracer_systems_scripts_node)
ld.add_action(device_info_node)
ld.add_action(battery_node)
ld.add_action(inference_node)
ld.add_action(model_optimizer_node)
ld.add_action(rplidar_node)
ld.add_action(sensor_fusion_node)
ld.add_action(servo_node)
ld.add_action(status_led_node)
ld.add_action(usb_monitor_node)
ld.add_action(webserver_publisher_node)
ld.add_action(web_video_server_node)
return ld
Configuration file and parameters
Parameter name | Description |
---|---|
resize_images |
Set to True or False depending on if you want to resize the images in camera_pkg |
Resources
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
ament_cmake | |
ament_lint_auto | |
ament_lint_common | |
camera_pkg | |
ctrl_pkg | |
deepracer_navigation_pkg | |
deepracer_systems_pkg | |
device_info_pkg | |
i2c_pkg | |
inference_pkg | |
model_optimizer_pkg | |
rplidar_ros | |
sensor_fusion_pkg | |
servo_pkg | |
status_led_pkg | |
usb_monitor_pkg | |
webserver_pkg | |
web_video_server |