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

Au core/migration #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
log/
install/
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
# auri_v2000
# auri_v2000
In progress:
au_core

TODO:
au_control
au_geometry
au_localization
au_mapping
au_missioncontrol
au_motionplanner
au_planner
au_sensors
au_sonar
au_vision

# Installation
Second link is for debian packages but come back to first link for complete installation
https://index.ros.org/doc/ros2/Installation/Crystal/Linux-Install-Binary/
https://index.ros.org/doc/ros2/Installation/Crystal/Linux-Install-Debians/

# Building packages
https://index.ros.org/doc/ros2/Tutorials/Colcon-Tutorial/
Colcon is used instead of catkin for ROS2. Run colcon build in the root directory to build it.

# Migrating ROS1 source code
https://index.ros.org/doc/ros2/Contributing/Migration-Guide/
this article gives a general look into how CMakeLists and the build system are different and how to change them accordingly. It also gives a good intro into source code conversion with pubsub equivalents.

All packages used in au_core are currently supported in ROS2.
131 changes: 131 additions & 0 deletions src/au_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
cmake_minimum_required(VERSION 3.10.2)

project(au_core)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
#set(CMAKE_CXX_EXTENSIONS OFF)
#add_compile_options(-Wall -Wextra -Werror)\
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()


find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
#find_package(message_generation REQUIRED)
find_package(tf2 REQUIRED)
find_package(angles REQUIRED)
find_package(rosidl_default_generators REQUIRED)

include_directories(include)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include_directories(${Eigen_INCLUDE_DIRS})
find_package(Eigen REQUIRED)
find_package(yaml-cpp)



#catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################




#rosidl_generate_interfaces(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have dead code like this. If it's not necessary, it should be removed.

# DEPENDENCIES
# std_msgs
# geometry_msgs
#)



#ament_export_dependencies(message_runtime roslib)
#ament_export_include_directories(include)
#ament_export_libraries(utils)
#catkin_package(
# INCLUDE_DIRS include
# LIBRARIES utils
# CATKIN_DEPENDS message_runtime roslib
#)

###########
## Build ##
###########

#include_directories(
# include
#)

#Build for utils library
add_library(utils
src/camera_info.cpp
src/loader_util.cpp
src/rolling_stats.cpp
src/vision_util.cpp
src/timeout_guard.cpp
src/math_util.cpp)
ament_target_dependencies(utils
"rclcpp"
"rclcpp_components")

#add_dependencies(utils
# ${catkin_EXPORTED_TARGETS}
#)
target_link_libraries(utils
yaml-cpp
)

#############
## Tests ##
#############

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
ament_add_gtest(rolling_stats_tests
test/rolling_stats_tests.cpp)
ament_target_dependencies(rolling_stats_tests
"rclcpp"
"std_msgs")
target_link_libraries(rolling_stats_tests utils)

ament_add_gtest(math_utils_tests
test/math_utils_tests.cpp)
target_link_libraries(math_utils_tests utils)

ament_add_gtest(loader_util_tests
test/loader_util_tests.cpp)
target_link_libraries(loader_util_tests utils)

#ament_add_gtest(test/loader_util_tests.py)
endif()

#############
## Install ##
#############

install(TARGETS utils
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.h|*.hpp"
PATTERN ".svn" EXCLUDE
)

ament_export_include_directories(include)
ament_export_dependencies(std_msgs)
ament_package()
174 changes: 174 additions & 0 deletions src/au_core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# au_core

## Messages
Custom ros messages for the auv.

### Motors (msg/MC*.msg)
Message to transfer motor data.

#### Raw Motor Speed (msg/MCRaw.msg)
Feedback from the motor node

##### Format
```
std_msgs/Header header
uint32 seq
time stamp
string frame_id
float32 horLeft
float32 horRight
float32 verLeft
float32 verRight
float32 strFront
float32 strBack
```

#### Setting Relative Motor Speed (msg/MCBaseSpeed.msg | msg/MCDiff.msg)

Set the base speed of the motor using `MCBaseSpeed`

##### Format
```
std_msgs/Header header
uint32 seq
time stamp
string frame_id
float32 baseSpeed
```

Set the differential between the two motors using `MCDiff`

##### Format
```
std_msgs/Header header
uint32 seq
time stamp
string frame_id
float32 differential
```

### Kill Switch (msg/KillSig.msg)

Status of the kill switch

##### Format
```
uint8 KILL_ENGAGE=0
uint8 KILL_DISENGAGE=1
uint8 kill
```

### Depth Sensor (msg/Depth.msg)

Data published from the MS5837 depth sensor. Absolute pressure is in Pascals and depth is in metres.

##### Format
```
std_msgs/Header header
uint32 seq
time stamp
string frame_id
float32 abs_pressure
float32 depth
```

### Regions of Interest (msg/Roi*.msg)
Messages containing ROIs for the tracker

#### Single Region of Interest (msg/Roi.msg)

##### Format
```
# Identification information about the tracked ROI
string[] tags
float32 confidence
float32 actualHeight
float32 actualWidth

# Pixel locations in image as a complex polygon
geometry_msgs/Point[] polygon

# Bounding box for the polygon
geometry_msgs/Point topLeft # Aligned to the image
uint32 width # Bounding box width in pixels
uint32 height # Bounding box height in pixels

# Estimated position in real coordinates relative to the robot
# Displacement is represented in meters
# hasOrientation Indicates if there an orientation is specified
# in the pose
geometry_msgs/Pose poseEstimate
uint8 hasOrientation
```

#### Array of Regions of Interest (msg/RoiArray.msg)

##### Format
```
Roi[] regionsOfInterest
```

---

#### Camera rules file
###### 40-firefly.rules
```
SUBSYSTEM=="usb", ATTRS{idVendor}=="1e10", ATTRS{idProduct}=="2002", GROUP="plug dev", SYMLINK+="firefly", MODE:="0666"
```
## laptopGitStart.sh
Pulls or clones au_core, au_vision, and au_missioncontrol

##### Format
```
To use (while in scripts folder):
chmod u+x laptopGitStart.sh
./laptopGitStart.sh
```
## odroidGitStart.sh / tegraGitStart.sh
```
For pulling repos on the tegra/odroid
Usage is the same as laptopGitStart.sh

```

## all.sh
The fastest way fetch all of the ARVP code. Pulls all repos and installs all system dependencies. Usage: make sure you have [setup ssh keys on github](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) then execute the following:
```
$ cd ~/catkin_ws/src/
$ git clone git@github.com:arvpUofA/au_core.git
$ ./au_core/scripts/all.sh
```


## ROS Bag
The `record_bag.launch` file is setup to save cameras and sensor
topics into separate bag files. Splits the camera bag files into
3 GB bags. The following args can be set
* *record_cameras*: true to enable bagging camera feeds
* *bag_name*: the name to assign the bag file. Bag files are automatically
prefixed with the current timestamp
* *path*: directory to store the bag files eg. /path/to/usb/drive

Example usage:

`roslaunch au_core record_bag.launch path:=/media/usb bag_name:=2017_07_30`

The defaults are intended for logging on the TX2 using an external
SSD drive mounted at `/media/ssd`. To mount the ssd run:
```
sudo mount /dev/sda1 /media/ssd
```

The `extract_images_from_bag.launch` file is to extract images from a bag
file into a both a video, and a folder of images.
The following args can be set:
* *bag*: bag file (absolute or relative to cwd)
* *fps*: fps for the video file. Leave blank for similar rate to bag file
* *image*: image topic
* *output_dir*: directory images and video should be output. images are saved
to ${output_dir}/images/ . Video is saved to ${output_dir}/
* *image_name*: Name prefix for the image. Defaults to the name of the bag file
Images are saved as ${image_name}%05d.jpg

Example usage:
Please take a look at the [launch file](https://github.com/arvpUofA/au_everything/tree/master/catkin_ws/src/au_core/launch/extract_images_from_bag.launch) for example usage/more info
Loading