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

Sonar sim + ground visualizer + #410

Open
wants to merge 8 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
12 changes: 10 additions & 2 deletions command/sub8_launch/launch/tf.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
<launch>
<include file="$(find sub8_launch)/launch/upload_urdf.launch" />
<node pkg="robot_state_publisher" name="robot_state_publisher" type="robot_state_publisher">
<param name="use_tf_static" value="false" />
<param name="use_tf_static" value="true" />
</node>
<node pkg="sub8_launch" type="tf_republisher.py" name="tf_republisher" />

<node pkg="joint_state_publisher" name="joint_state_publisher" type="joint_state_publisher">
Copy link
Member

Choose a reason for hiding this comment

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

what does this do? and use_tf_static?

<param name="robot_description" textfile="$(find sub8_gazebo)/urdf/sub8.urdf" />
<param name="publish_default_velocities" value="True"/>
<param name="publish_default_efforts" value="True" />
</node>

<node pkg="sub8_launch" type="tf_republisher.py" name="tf_replublisher" />

<node pkg="nodelet" type="nodelet" args="standalone odometry_utils/odometry_to_tf" name="odometry_to_tf"/>
</launch>
2 changes: 2 additions & 0 deletions command/sub8_launch/launch/upload_urdf.launch
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
air_density: 1.225
G: 9.81
</rosparam>


</launch>
1 change: 1 addition & 0 deletions command/sub8_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<build_depend>roslaunch</build_depend>
<run_depend>roslaunch</run_depend>
<run_depend>robot_state_publisher</run_depend>
<run_depend>joint_state_publisher</run_depend>
<run_depend>nodelet</run_depend>
<run_depend>c3_trajectory_generator</run_depend>
<run_depend>rise_6dof</run_depend>
Expand Down
334 changes: 0 additions & 334 deletions docs/high_level_architecture.svg

This file was deleted.

237 changes: 237 additions & 0 deletions perception/sub8_mapping/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
cmake_minimum_required(VERSION 2.8.3)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
project(sub8_mapping)

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
image_transport
cv_bridge
std_msgs
message_generation
tf2
tf2_eigen
tf2_geometry_msgs
tf2_kdl
tf2_msgs
tf2_py
tf2_ros
tf2_sensor_msgs
pcl_conversions
pcl_ros
mil_blueview_driver
c3_trajectory_generator
gazebo_plugins
gazebo_ros
)


catkin_package(
INCLUDE_DIRS include
LIBRARIES map_lib
)

find_package(OpenCV REQUIRED)
find_package(PCL REQUIRED)
find_package(gazebo REQUIRED)
link_directories(${GAZEBO_LIBRARY_DIRS})

add_library(map_lib src/Mapping.cpp)
target_link_libraries(map_lib
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
${roslib_LIBRARIES}
${GAZEBO_LIBRARIES}
)

include_directories(include ${roslib_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})


add_executable(map_generator src/Mapping.cpp)
add_dependencies(map_generator map_lib ${catkin_EXPORTED_TARGETS})
target_link_libraries(map_generator map_lib ${catkin_LIBRARIES})

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

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

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES sub8_map
# CATKIN_DEPENDS roscpp rospy std_msgs
# DEPENDS system_lib
)

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

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/sub8_map.cpp
# )

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/sub8_map_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )

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

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

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

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_sub8_map.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
95 changes: 95 additions & 0 deletions perception/sub8_mapping/include/Mapping.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#pragma once
#include <geometry_msgs/Point.h>
#include <mil_blueview_driver/BlueViewPing.h>
#include <nav_msgs/OccupancyGrid.h>
#include <ros/ros.h>

#include <tf/transform_listener.h>
#include <tf2/convert.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2_msgs/TFMessage.h>
#include <tf2_ros/transform_listener.h>
#include <tf2_sensor_msgs/tf2_sensor_msgs.h>

#include <opencv2/core/core.hpp>
#include <opencv2/core/types.hpp>
#include <stdexcept>
#include "opencv2/opencv.hpp"
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>

#include <pcl/common/common.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl_ros/point_cloud.h>
#include <sensor_msgs/PointCloud2.h>
#include "pcl_ros/point_cloud.h"
#include <visualization_msgs/Marker.h>
#include <visualization_msgs/MarkerArray.h>

#include <boost/circular_buffer.hpp>

#include <sub8_msgs/Bounds.h>

#include <waypoint_validity.hpp>

#include <mil_msgs/ObjectDBQuery.h>
#include <mil_msgs/PerceptionObject.h>
#include <mil_msgs/PerceptionObjectArray.h>
#include <mil_msgs/RangeStamped.h>
#include <std_srvs/Trigger.h>
#include <ros_alarms/listener.hpp>

#include <string>
#include <boost/filesystem.hpp>

extern struct map_param
{
bool map_pc; // Show the point cloud
bool use_sonar; // Weather or not to use sonar's world data
bool map_objects;
bool show_markers; // Display latest DVL depth marker in Rviz
float max_depth; // maximum depth in meters to map
int pcl_buffer;

} params;


class Mapping

{
public:
Mapping();
void dvl_callback(const mil_msgs::RangeStampedConstPtr &dvl);
//void sonar_callback(const sub8_gazebo::simulated_sonar_pingPtr &ping_msg);
//void object_callback(const mil_msgs::PerceptionObjectArray &objects);
void process_image(std::string frame_id, int id, cv::Mat& pic, tf::StampedTransform transform_);

private:
ros::NodeHandle nh_;
tf::TransformListener listener_;
tf::StampedTransform transform_;
tf::StampedTransform transform2_;
ros_alarms::AlarmListener<> kill_listener_;
bool was_killed_;

ros::Subscriber sub_dvl_;
//ros::Subscriber sub_imaging_sonar_;
//ros::Subscriber sub_ogrid_objs_;

// Publishers
ros::Publisher pub_surface_;
ros::Publisher pub_floor_;


double dvl_depth_;
pcl::PointCloud<pcl::PointXYZI>::Ptr pointCloud_;
cv::Mat surface_image_;
cv::Mat floor_image_;

std::string floor_img_path_;
std::string surface_img_path_;
bool use_image_;
bool surface_marker_;
bool use_down_cam_;
};
Binary file added perception/sub8_mapping/include/seaFloor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added perception/sub8_mapping/include/surface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions perception/sub8_mapping/launch/map.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<launch>
<node pkg="sub8_mapping" type="map_generator" name="sub8_mapping" >
<rosparam>
# Show the pointcloud
map_pc: true

# Weather or not to use sonar's world data
use_sonar: true

#
map_objects: true

# Display latest DVL depth marker in Rviz
show_markers: true

# Maximum depth in meters to map
max_depth: 37

# Max amount of pcl to have in buffer
pcl_buffer: 5000

</rosparam>
</node>
</launch>
Loading