-
Notifications
You must be signed in to change notification settings - Fork 43
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
MichaelFleming
wants to merge
8
commits into
uf-mil:master
Choose a base branch
from
MichaelFleming:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d697b02
broken sim
MichaelFleming 0fb7963
usless message
MichaelFleming a95f8a3
resolved merge confilcts
MichaelFleming 113c74a
Added floor/surface visualizer
MichaelFleming 697dc60
Improved capability, some optimization
MichaelFleming 8c888a0
Added some sim models
MichaelFleming 608bc5c
fixed build errors
MichaelFleming ff32f49
updated subviz
MichaelFleming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,6 @@ | |
air_density: 1.225 | ||
G: 9.81 | ||
</rosparam> | ||
|
||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_; | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?