Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SophieZhao00 committed Sep 22, 2021
0 parents commit b326809
Show file tree
Hide file tree
Showing 58 changed files with 18,124 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode
build
bin
lib
data
61 changes: 61 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
PROJECT(reference_car)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

MESSAGE(STATUS "Compiling Reference Car Localization + Navigation")
MESSAGE(STATUS "Using compiler: ${CMAKE_CXX_COMPILER}")
MESSAGE(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "Arch: ${CMAKE_SYSTEM_PROCESSOR}")

SET(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror")

IF(${CMAKE_BUILD_TYPE} MATCHES "Release")
MESSAGE(STATUS "Additional Flags for Release mode")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -O2 -DNDEBUG")
ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
MESSAGE(STATUS "Additional Flags for Debug mode")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
ENDIF()

INCLUDE($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
ROSBUILD_INIT()
SET(ROS_BUILD_STATIC_LIBS true)
SET(ROS_BUILD_SHARED_LIBS false)

MESSAGE(STATUS "ROS-Overrride Build Type: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "CXX Flags: ${CMAKE_CXX_FLAGS}")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

SET(libs roslib roscpp rosbag glog gflags amrl-shared-lib boost_system lua5.1
pthread)

ADD_LIBRARY(shared_library
src/visualization/visualization.cc
src/vector_map/vector_map.cc)

ADD_SUBDIRECTORY(src/shared)
INCLUDE_DIRECTORIES(src/shared)
INCLUDE_DIRECTORIES(src)

ROSBUILD_ADD_EXECUTABLE(slam
src/slam/slam_main.cc
src/slam/slam.cc)
TARGET_LINK_LIBRARIES(slam shared_library ${libs})


ROSBUILD_ADD_EXECUTABLE(particle_filter
src/particle_filter/particle_filter_main.cc
src/particle_filter/particle_filter.cc)
TARGET_LINK_LIBRARIES(particle_filter shared_library ${libs})

ROSBUILD_ADD_EXECUTABLE(navigation
src/navigation/navigation_main.cc
src/navigation/navigation.cc)
TARGET_LINK_LIBRARIES(navigation shared_library ${libs})

ADD_EXECUTABLE(eigen_tutorial
src/eigen_tutorial.cc)

ADD_EXECUTABLE(simple_queue_test
src/navigation/simple_queue_test.cc)
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Clang is a good compiler to use during development due to its faster compile
# times and more readable output.
# C_compiler=/usr/bin/clang
# CXX_compiler=/usr/bin/clang++

# GCC is better for release mode due to the speed of its output, and its support
# for OpenMP.
C_compiler=/usr/bin/gcc
CXX_compiler=/usr/bin/g++

#acceptable build_types: Release/Debug/Profile
build_type=Release
# build_type=Debug

.SILENT:

all: build/CMakeLists.txt.copy
$(info Build_type is [${build_type}])
$(MAKE) --no-print-directory -C build

# Sets the build type to Debug.
set_debug:
$(eval build_type=Debug)

# Ensures that the build type is debug before running all target.
debug_all: | set_debug all

clean:
rm -rf build bin lib

build/CMakeLists.txt.copy: CMakeLists.txt Makefile
mkdir -p build
cd build && cmake -DCMAKE_BUILD_TYPE=$(build_type) \
-DCMAKE_CXX_COMPILER=$(CXX_compiler) \
-DCMAKE_C_COMPILER=$(C_compiler) ..
cp CMakeLists.txt build/CMakeLists.txt.copy
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# cs393r_starter

## Using this Repo
You will be using a duplicate of this repo for all development in the class. This repo provides starter code for the ROS subscriptions, publishers and control loops you will be using.

### Prerequisites

Please refer to the [UT AUTOmata reference manual]() for instructions on setting up the dependencies:
* [ROS](http://wiki.ros.org/ROS/Installation)
* [amrl_msgs](https://github.com/ut-amrl/amrl_msgs)
* [amrl_maps](https://github.com/ut-amrl/amrl_maps)
* [ut_automata](https://github.com/ut-amrl/ut_automata)

### Duplicate the Repo
1. Make sure you're logged into your GitHub account.
2. Create a new repo with the same name under your GitHub account. Dont initialize that with anything.
3. `git clone <this repository url>` (found in the upper right)
4. `cd <cloned_repo>`
5. `git push --mirror <your new repository url>`

### Clone and Build
1. `git clone <your repository url>` (found in the upper right)
2. After you have cloned the repo, add it to your ROS path by adding the following line to the end of `~/.bashrc`:
```
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:[Local path to your repo]
```
For example:
```
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/joydeepb/cs393r_starter
```
3. Reload `.bashrc` so that the path is updated:
```
source ~/.bashrc
```
4. `cd <cloned_repo>`
5. `make -j`
### Code Overview
There are three main executables: `navigation`, `particle_filter`, and `slam`. Each executable has a corresponding `.h` and `.cc` file that defines the class for the implementation. An associated `*_main.cc` file abstracts away ROS-specific details. For example, the `particle_filter` executable consists of three files:
```
src
└── particle_filter
   ├── particle_filter.cc
   ├── particle_filter.h
   └── particle_filter_main.cc
```
Every header file includes documentation in comments for the variables and subroutines.
The project compiles with [Eigen](https://eigen.tuxfamily.org/) for linear algebra and coordinate geometry, the [amrl_shared_lib](https://github.com/ut-amrl/amrl_shared_lib) for commonly used robotics subroutines, and a custom simple priority queue implementation. Some useful references on how to use the libraries:
* See the included [`eigen_tutorial.cc`](src/eigen_tutorial.cc) file for example most common Eigen usage, and the [official Eigen tutorials](https://eigen.tuxfamily.org/dox/GettingStarted.html) for more extensive documentation.
* See the included [`simple_queue_test.cc`](src/navigation/simple_queue_test.cc) for usage of the simple priority queue.
### Running the Code
Make sure you recompile your code between changes.
* To run navigation:
```
./bin/navigation
```
* To run the particle filter:
```
./bin/particle_filter
```
* To run SLAM:
```
./bin/slam
```
4 changes: 4 additions & 0 deletions config/particle_filter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
map = "maps/GDC1.txt"
init_x = 14.7
init_y = 14.24
init_r = 0
25 changes: 25 additions & 0 deletions manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<package>
<description brief="cs378_starter">

Starter code for cs378 Autonomous Driving

</description>
<name>cs378_starter</name>
<author>Joydeep Biswas</author>
<license>MIT</license>
<review status="unreviewed" notes=""/>
<url></url>
<depend package="std_msgs"/>
<depend package="nav_msgs"/>
<depend package="geometry_msgs"/>
<depend package="visualization_msgs"/>
<depend package="sensor_msgs"/>
<depend package="roscpp"/>
<depend package="rosbag"/>
<depend package="tf"/>
<depend package="ut_automata"/>
<depend package="amrl_msgs"/>

</package>


Loading

0 comments on commit b326809

Please sign in to comment.