Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autonomy integration rostest back with new simulator #650

Merged
merged 20 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: . /opt/ros/noetic/setup.sh && catkin init && catkin profile set ci
- name: Build
if: github.event.pull_request.draft == false
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && catkin build
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && catkin build -DMROVER_CI=ON
- name: Test
if: github.event.pull_request.draft == false
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test -j1
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test && rostest mrover integration.test --text
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "deps/libde265"]
path = deps/libde265
url = git@github.com:strukturag/libde265.git
url = https://github.com/strukturag/libde265.git
shallow = true
branch = 0.1-20240106
[submodule "deps/dawn"]
Expand Down
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (MROVER_CI)
list(APPEND MROVER_CPP_COMPILE_OPTIONS -Werror)
endif ()

if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/dawn/out/Release)
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/dawn/out/Release OR EXISTS /usr/include/dawn)
set(MROVER_BUILD_SIM ON)
else ()
set(MROVER_BUILD_SIM OFF)
Expand Down Expand Up @@ -232,15 +232,16 @@ catkin_add_gtest(example-cpp-test test/example/cpp_test.cpp)

# Python unit tests
catkin_add_nosetests(test/navigation/drive_test.py)
catkin_add_nosetests(test/teleop/teleop_test.py)
catkin_add_nosetests(test/util/SE3_test.py)
catkin_add_nosetests(test/util/SO3_test.py)

# Integration tests (python and c++)
find_package(rostest REQUIRED)
add_rostest(test/example/basic_integration_test.test)
add_rostest(test/integration/integration.test)
add_rostest(test/util/SE3_tf_test.test)
# Note(quintin): Commented these out because they ignore the Python virtual environment
# Most of our code relies on newer Python features so they fail to initialize
#find_package(rostest REQUIRED)
#add_rostest(test/example/basic_integration_test.test)
#add_rostest(test/integration/integration.test)
#add_rostest(test/util/SE3_tf_test.test)

## Install

Expand Down
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM ros:noetic
FROM ubuntu:focal

# DEBIAN_FRONTEND=noninteractive and keyboard-configuration are needed to prevent stdin prompting later on
# This was super annoying to figure out because otherwise the build would hang
# software-properties-common is needed for apt-add-repository
RUN apt-get update -y && apt-get upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common keyboard-configuration -y
RUN apt-add-repository ppa:ansible/ansible -y
RUN apt-add-repository ppa:git-core/ppa -y
# RUN apt-add-repository ppa:git-core/ppa -y
RUN apt-get install -y ansible git git-lfs

RUN useradd --create-home --groups sudo --shell /bin/zsh mrover
Expand All @@ -17,16 +17,21 @@ RUN mkdir -p /home/mrover/catkin_ws/src/mrover
WORKDIR /home/mrover/catkin_ws/src/mrover
# Defines the APT packages that need to be installed
# rosdep is called from Ansible to install them
ADD ./package.xml .
ADD --chown=mrover:mrover ./package.xml .
# Defines the Python packages that need to be installed
# pip is called from Ansible to install them
ADD ./pyproject.toml .
ADD --chown=mrover:mrover ./pyproject.toml .
# Define the NPM packages that need to be installed by Bun
ADD --chown=mrover:mrover ./src/teleoperation/frontend/package.json ./src/teleoperation/frontend/bun.lockb ./src/teleoperation/frontend/
# Copy over all Ansible files
ADD ./ansible ./ansible
ADD ./ansible.sh .
ADD --chown=mrover:mrover ./ansible ./ansible
ADD --chown=mrover:mrover ./ansible.sh .
RUN ./ansible.sh build.yml

USER root
# Dawn
ADD ./dawn.deb /tmp/
RUN apt-get install -f /tmp/dawn.deb -y && rm /tmp/dawn.deb
# Remove apt cache to free up space in the image
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/build/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@
- ros-{{ ros_distro }}-rosbash
- libbullet-dev
- libglfw3-dev
- xorg-dev
- libx11-xcb-dev
- libnl-3-dev
- libnl-route-3-dev
- libtbb-dev
- libopencv-dev

- name: Initialize rosdep
become: True
Expand Down
181 changes: 13 additions & 168 deletions cmake/webgpu.cmake
Original file line number Diff line number Diff line change
@@ -1,170 +1,15 @@
add_library(webgpu SHARED IMPORTED)
if (APPLE)
set(WEBGPU_SHARED_LIB_NAME "libwebgpu_dawn.dylib")
if (EXISTS /usr/include/dawn)
# The Dawn Debian package installs to /usr/...
# CI has Dawn installed with this method
set(WEBGPU_SHARED_LIB /usr/lib/libwebgpu_dawn.so)
else()
set(WEBGPU_SHARED_LIB_NAME "libwebgpu_dawn.so")
endif()
set(WEBGPU_BUILD_DIR ${CMAKE_CURRENT_LIST_DIR}/../deps/dawn/out/Release)
set_property(TARGET webgpu PROPERTY IMPORTED_LOCATION ${WEBGPU_BUILD_DIR}/src/dawn/native/${WEBGPU_SHARED_LIB_NAME})
target_include_directories(webgpu INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../deps/dawn/include ${WEBGPU_BUILD_DIR}/gen/include)

#add_library(webgpu INTERFACE)
#
#target_link_libraries(webgpu INTERFACE webgpu_dawn)
# target_include_directories(webgpu INTERFACE
# "${CMAKE_CURRENT_SOURCE_DIR}/deps/dawn/include"
# )
#
# # This is used to advertise the flavor of WebGPU that this zip provides
# target_compile_definitions(webgpu INTERFACE WEBGPU_BACKEND_DAWN)
#
#include(FetchContent)
#
#FetchContent_Declare(
# dawn
# SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/dawn
# DOWNLOAD_COMMAND
# cd ${CMAKE_CURRENT_SOURCE_DIR}/deps/dawn &&
# git init &&
# git fetch --depth=1 https://dawn.googlesource.com/dawn chromium/6108 &&
# git reset --hard FETCH_HEAD
#)
#
#FetchContent_GetProperties(dawn)
#if (NOT dawn_POPULATED)
# FetchContent_Populate(dawn)
#
# # This option replaces depot_tools
# set(DAWN_FETCH_DEPENDENCIES ON)
#
# # A more minimalistic choice of backand than Dawn's default
# if (APPLE)
# set(USE_VULKAN OFF)
# set(USE_METAL ON)
# else()
# set(USE_VULKAN ON)
# set(USE_METAL OFF)
# endif()
# set(DAWN_ENABLE_D3D11 OFF)
# set(DAWN_ENABLE_D3D12 OFF)
# set(DAWN_ENABLE_METAL ${USE_METAL})
# set(DAWN_ENABLE_NULL OFF)
# set(DAWN_ENABLE_DESKTOP_GL OFF)
# set(DAWN_ENABLE_OPENGLES OFF)
# set(DAWN_ENABLE_VULKAN ${USE_VULKAN})
# set(TINT_BUILD_SPV_READER OFF)
#
# # Disable unneeded parts
# set(DAWN_BUILD_SAMPLES OFF)
# set(TINT_BUILD_TINT OFF)
# set(TINT_BUILD_SAMPLES OFF)
# set(TINT_BUILD_DOCS OFF)
# set(TINT_BUILD_TESTS OFF)
# set(TINT_BUILD_FUZZERS OFF)
# set(TINT_BUILD_SPIRV_TOOLS_FUZZER OFF)
# set(TINT_BUILD_AST_FUZZER OFF)
# set(TINT_BUILD_REGEX_FUZZER OFF)
# set(TINT_BUILD_BENCHMARKS OFF)
# set(TINT_BUILD_TESTS OFF)
# set(TINT_BUILD_AS_OTHER_OS OFF)
# set(TINT_BUILD_REMOTE_COMPILE OFF)
#
# add_subdirectory(${dawn_SOURCE_DIR} ${dawn_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL)
#endif ()
#
#set(AllDawnTargets
# core_tables
# dawn_common
# dawn_glfw
# dawn_headers
# dawn_native
# dawn_platform
# dawn_proc
# dawn_utils
# dawn_wire
# dawncpp
# dawncpp_headers
# emscripten_bits_gen
# enum_string_mapping
# extinst_tables
# webgpu_dawn
# webgpu_headers_gen
#
# tint_api
# tint_api_common
# tint_api_options
# tint_cmd_common
# tint_cmd_info_cmd
# tint_cmd_loopy_cmd
# tint_cmd_remote_compile_cmd
# tint_cmd_tint_cmd
# tint_lang_core
# tint_lang_core_constant
# tint_lang_core_intrinsic
# tint_lang_core_ir
# tint_lang_core_ir_transform
# tint_lang_core_type
# tint_lang_glsl_validate
# tint_lang_glsl_writer_raise
# tint_lang_hlsl_writer_common
# tint_lang_msl_writer_raise
# tint_lang_spirv
# tint_lang_spirv_intrinsic
# tint_lang_spirv_ir
# tint_lang_spirv_reader_common
# tint_lang_spirv_type
# tint_lang_spirv_writer
# tint_lang_spirv_writer_ast_printer
# tint_lang_spirv_writer_ast_raise
# tint_lang_spirv_writer_common
# tint_lang_spirv_writer_helpers
# tint_lang_spirv_writer_printer
# tint_lang_spirv_writer_raise
# tint_lang_wgsl
# tint_lang_wgsl_ast
# tint_lang_wgsl_ast_transform
# tint_lang_wgsl_helpers
# tint_lang_wgsl_inspector
# tint_lang_wgsl_intrinsic
# tint_lang_wgsl_ir
# tint_lang_wgsl_program
# tint_lang_wgsl_reader
# tint_lang_wgsl_reader_lower
# tint_lang_wgsl_reader_parser
# tint_lang_wgsl_reader_program_to_ir
# tint_lang_wgsl_resolver
# tint_lang_wgsl_sem
# tint_lang_wgsl_writer
# tint_lang_wgsl_writer_ast_printer
# tint_lang_wgsl_writer_ir_to_program
# tint_lang_wgsl_writer_raise
# tint_lang_wgsl_writer_syntax_tree_printer
# tint_utils_cli
# tint_utils_command
# tint_utils_containers
# tint_utils_debug
# tint_utils_diagnostic
# tint_utils_file
# tint_utils_generator
# tint_utils_ice
# tint_utils_id
# tint_utils_macros
# tint_utils_math
# tint_utils_memory
# tint_utils_reflection
# tint_utils_result
# tint_utils_rtti
# tint_utils_socket
# tint_utils_strconv
# tint_utils_symbol
# tint_utils_text
# tint_utils_traits
# tint-format
# tint-lint
#)
#
#foreach (Target ${AllDawnTargets})
# if (TARGET ${Target})
# set_property(TARGET ${Target} PROPERTY FOLDER "Dawn")
# endif()
#endforeach()
set(WEBGPU_BUILD_DIR ${CMAKE_CURRENT_LIST_DIR}/../deps/dawn/out/Release)
if (APPLE)
set(WEBGPU_SHARED_LIB ${WEBGPU_BUILD_DIR}/libwebgpu_dawn.dylib)
else()
set(WEBGPU_SHARED_LIB ${WEBGPU_BUILD_DIR}/libwebgpu_dawn.so)
endif()
target_include_directories(webgpu INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../deps/dawn/include ${WEBGPU_BUILD_DIR}/gen/include)
endif ()
set_property(TARGET webgpu PROPERTY IMPORTED_LOCATION ${WEBGPU_SHARED_LIB})
36 changes: 20 additions & 16 deletions launch/simulator.launch
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<launch>
<arg name="run_rviz" default="true" />
<rosparam command="load" file="$(find mrover)/config/simulator/simulator.yaml" />
<arg name="headless" default="false"/>
<arg name="run_rviz" default="true"/>

<include file="$(find mrover)/launch/autonomy.launch">
<arg name="sim" value="true" />
<arg name="ekf_start_delay" value="1" />
</include>
<rosparam command="load" file="$(find mrover)/config/simulator/simulator.yaml"/>

<node pkg="nodelet" type="nodelet" name="nodelet_manager" required="true"
args="manager" output="screen" />
<include file="$(find mrover)/launch/autonomy.launch">
<arg name="sim" value="true"/>
<arg name="ekf_start_delay" value="1"/>
</include>

<node pkg="nodelet" type="nodelet" name="simulator_nodelet"
args="load mrover/SimulatorNodelet nodelet_manager" output="screen" />
<node pkg="nodelet" type="nodelet" name="nodelet_manager" required="true"
args="manager" output="screen"/>

<node name="arm_controller" pkg="mrover" type="arm_controller" output="screen" />
<node pkg="nodelet" type="nodelet" name="simulator_nodelet"
args="load mrover/SimulatorNodelet nodelet_manager" output="screen">
<param name="headless" value="$(arg headless)"/>
</node>

<group if="$(arg run_rviz)">
<arg name="rvizconfig" default="$(find mrover)/config/rviz/auton_sim.rviz" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" />
</group>
</launch>
<node name="arm_controller" pkg="mrover" type="arm_controller" output="screen"/>

<group if="$(arg run_rviz)">
<arg name="rvizconfig" default="$(find mrover)/config/rviz/auton_sim.rviz"/>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)"/>
</group>
</launch>
2 changes: 0 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
<build_depend>message_generation</build_depend>
<exec_depend>xacro</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>joint_state_publisher</exec_depend>
<exec_depend>joint_state_publisher_gui</exec_depend>
<exec_depend>message_runtime</exec_depend>

<!-- Visualization -->
Expand Down
4 changes: 3 additions & 1 deletion scripts/build_dawn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ CC=clang CXX=clang++ cmake \
-D DAWN_ENABLE_INSTALL=ON \
-D BUILD_SHARED_LIBS=ON \
-D DAWN_USE_GLFW=OFF \
-D TINT_BUILD_CMD_TOOLS=OFF
-D TINT_BUILD_CMD_TOOLS=OFF \
-D TINT_BUILD_DOCS=OFF \
-D TINT_BUILD_TESTS=OFF
cmake --build out/Release
2 changes: 1 addition & 1 deletion src/esw/motor_library/brushed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace mrover {
}
}

auto BrushedController::calibrateServiceCallback(std_srvs::Trigger::Request& req, std_srvs::Trigger::Response& res) -> bool {
auto BrushedController::calibrateServiceCallback([[maybe_unused]] std_srvs::Trigger::Request& req, std_srvs::Trigger::Response& res) -> bool {
if (!mhasLimit) {
res.success = false;
res.message = mControllerName + " does not have limit switches, cannot calibrate";
Expand Down
1 change: 0 additions & 1 deletion src/esw/motor_library/brushless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ namespace mrover {

private:
moteus::Controller mController{moteus::Controller::Options{}};
double mMeasuredEffort{};
bool limitSwitch0Present{};
bool limitSwitch1Present{};
bool limitSwitch0Enabled{true};
Expand Down
4 changes: 2 additions & 2 deletions src/navigation/approach_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def on_loop(self, context) -> State:
:param ud: State machine user data
:return: Next state
"""
fid_pos = context.env.current_fid_pos()
fid_pos = context.env.current_tag_pos()
if fid_pos is None:
return search.SearchState()

Expand All @@ -38,7 +38,7 @@ def on_loop(self, context) -> State:
)
if arrived:
context.env.arrived_at_post = True
context.env.last_post_location = context.env.current_fid_pos(odom_override=False)
context.env.last_post_location = context.env.current_tag_pos(odom_override=False)
context.course.increment_waypoint()
return waypoint.WaypointState()
context.rover.send_drive_command(cmd_vel)
Expand Down
Loading