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

Right_Click_Services #590

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a980c7f
added right click service
May 11, 2018
9827340
gps generic services
May 28, 2018
288da7f
Merge branch 'd4l' into kinetic-devel
May 28, 2018
1b66854
multi_res image of simulation map
Jun 4, 2018
50d5b45
efffeu setup
Jun 4, 2018
e208f2d
changed loc of tiles
Jun 8, 2018
c4759ab
tile move
Jun 8, 2018
15f144b
Merge branch 'tmp' into efffeu
Jun 8, 2018
937ce84
latest local d4l
Jul 27, 2018
b6f31e2
finished cleaning-merge request
Jul 27, 2018
fbe884a
Merge remote-tracking branch 'upstream/kinetic-devel' into efffeu
Jul 27, 2018
01655b1
l
Jul 27, 2018
44445c8
l2
Jul 27, 2018
94cd04b
removed dependency from d4l
Aug 1, 2018
66cc20c
Merge branch 'kinetic-devel' of https://github.com/swri-robotics/mapv…
Aug 24, 2018
aeb56b2
removed extraneous files
Aug 24, 2018
1411dd9
minor rempoved dependency
Aug 24, 2018
e0dce22
minor fixes
Aug 24, 2018
438f014
Merge branch 'd4l' into efffeu
Aug 24, 2018
3b5510e
Merge remote-tracking branch 'origin/master' into efffeu
pjreed Nov 13, 2018
3e10717
merge request fixes 14.11
Nov 14, 2018
14e3784
Merge branch 'tmp1411' into HEAD
Nov 19, 2018
6e4414b
19.11 changes workign
Nov 19, 2018
a2912c2
merged CMakeList
Nov 19, 2018
c3ef060
duplicate std_msgs
Nov 19, 2018
5b456f7
removed changes from test.geo
Nov 19, 2018
2e20f7c
rm changes from test.geo
Nov 19, 2018
d5e7bdd
added Readme description to include right click services
Nov 19, 2018
8560299
merged kinetic devel recent into efffeu
Nov 21, 2018
55e88c4
changed text fields to empty right click services
Dec 5, 2018
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
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Overlays a [sensor_msgs::Image](http://docs.ros.org/api/sensor_msgs/html/msg/Ima
* Height: Display height
* Units: (pixels | percent of window)

### LaserScan
### LaserScan

Projects a [sensor_msgs::LaserScan](http://docs.ros.org/api/sensor_msgs/html/msg/LaserScan.html) message into the scene.

Expand Down Expand Up @@ -135,7 +135,7 @@ This plugin allows the user to send goals to [move_base](wiki.ros.org/move_base)
* Abort: stop the execution of the current goal.

### Multi-res Image
Projects a geo-referenced multi-resolution image tile map into the scene. The concept is the same as the Google Maps style pan/zoom satellite imagery.
Projects a geo-referenced multi-resolution image tile map into the scene. The concept is the same as the Google Maps style pan/zoom satellite imagery.

![](https://github.com/swri-robotics/mapviz/wiki/multires2.png)

Expand All @@ -148,11 +148,11 @@ A custom format is currently used to store the map tiles and geo-reference. The
image_width: 29184 # The full pixel width of the map
image_height: 15872 # The full pixel height of the map
tile_size: 512 # The pixel size of the individual tiles

datum: "wgs84" # Datum is currently ignored
projection: "utm" # (utm|wgs84)
# At least 2 tie points are required for

# At least 2 tie points are required for
# scale, and 3 for orientation.
tiepoints: # [pixel x, pixel y, geo x, geo y]
- point: [4799, 209, 535674.5, 3258382.5]
Expand All @@ -162,7 +162,7 @@ A custom format is currently used to store the map tiles and geo-reference. The

The map tiles are stored in directories for each resolution starting with layer0, the full resolution. In subsequent layers the resolution is halved until the entire map fits within a single tile.

Tiles are named using the following format:
Tiles are named using the following format:

tile%05dx%05d.png % (row, column)

Expand Down Expand Up @@ -204,6 +204,15 @@ Publishes a [geometry_msgs::PointStamped](http://docs.ros.org/api/geometry_msgs/
* Topic: The topic to publish the point to
* Frame: The target frame to transform the point to before publishing it

### Right Click Services

Shows a Custom Context Menu with available services at this sepcific gps location.
**Parameters**
* Topic: The topic to publish gps point to
* Frame: The target frame to transform the point to before publishing it
* available services topic: Service topic for Mapviz to retreive available services From
* gps command topic: Service topic for Mapviz to request the chosen gps command to be executed

### Robot Image

Projects an image loaded from file into the scene to represent the robot platform.
Expand Down
1 change: 1 addition & 0 deletions mapviz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
)
add_dependencies(${PROJECT_NAME}
${PROJECT_NAME}_gencpp
${catkin_EXPORTED_TARGETS}
)

### Install mapviz ###
Expand Down
4 changes: 4 additions & 0 deletions mapviz/include/mapviz/map_canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ namespace mapviz
explicit MapCanvas(QWidget *parent = 0);
~MapCanvas();

std::string showCustomContextMenu(const QPoint &pos,std::vector<std::string> result);


void InitializeTf(boost::shared_ptr<tf::TransformListener> tf);

void AddPlugin(MapvizPluginPtr plugin, int order);
Expand Down Expand Up @@ -181,6 +184,7 @@ namespace mapviz
void mouseMoveEvent(QMouseEvent* e);
void keyPressEvent(QKeyEvent* e);


void Recenter();
void TransformTarget(QPainter* painter);
void Zoom(float factor);
Expand Down
47 changes: 45 additions & 2 deletions mapviz/src/map_canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>

#include <iostream>
Copy link
Contributor

Choose a reason for hiding this comment

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

This include is duplicated.

#include <mapviz/map_canvas.h>
#include <QMenu>
#include <QAction>
#include "ros/ros.h"
#include <vector>
#include <string>
#include <sstream>

// C++ standard libraries
#include <cmath>
Expand Down Expand Up @@ -90,6 +96,7 @@ MapCanvas::MapCanvas(QWidget* parent) :
setFrameRate(50.0);
frame_rate_timer_.start();
setFocusPolicy(Qt::StrongFocus);
this->setContextMenuPolicy(Qt::CustomContextMenu);
}

MapCanvas::~MapCanvas()
Expand Down Expand Up @@ -319,13 +326,15 @@ void MapCanvas::Zoom(float factor)

void MapCanvas::mousePressEvent(QMouseEvent* e)
{

mouse_x_ = e->x();
mouse_y_ = e->y();
mouse_previous_y_ = mouse_y_;
drag_x_ = 0;
drag_y_ = 0;
mouse_pressed_ = true;
mouse_button_ = e->button();

}

void MapCanvas::keyPressEvent(QKeyEvent* event)
Expand Down Expand Up @@ -614,4 +623,38 @@ double MapCanvas::frameRate() const
{
return 1000.0 / frame_rate_timer_.interval();
}
} // namespace mapviz

std::string MapCanvas::showCustomContextMenu(const QPoint &pos,std::vector<std::string> result){
QMenu contextMenu(this);
std::vector<QAction *> actions;

for(auto service : result)
{
QAction * act= new QAction(service.c_str(),this);
actions.push_back(act);
}
for(auto action: actions)
{
contextMenu.addAction(action);
}

QAction* selectedItem=contextMenu.exec(pos);
for(auto action: actions)
{
action->deleteLater();
}

if (selectedItem)
{
ROS_INFO("make call to %s",selectedItem->text().toStdString().c_str());
return selectedItem->text().toStdString().c_str();
}else{
ROS_ERROR("Please choose a service from the context menu by clicking on a displayed item");
return "";
}

}


}

12 changes: 12 additions & 0 deletions mapviz_plugins/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
Changelog for package mapviz_plugins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.3.0 (2018-11-16)
------------------
* Merge all -devel branches into a single master branch
* Don't transform laser scans twice (`#544 <https://github.com/swri-robotics/mapviz/issues/544>`_)
* Improving point_drawing plugins and bug fix of tf_plugin (`#557 <https://github.com/swri-robotics/mapviz/issues/557>`_)
* OpenGL rendering of PointClouds (2X speedup) (`#558 <https://github.com/swri-robotics/mapviz/issues/558>`_)
* Occupancy grid (new plugin) (`#568 <https://github.com/swri-robotics/mapviz/issues/568>`_)
* Bug fix in image plugin (`#563 <https://github.com/swri-robotics/mapviz/issues/563>`_)
* Fix Indigo build, clean up warnings (`#597 <https://github.com/swri-robotics/mapviz/issues/597>`_)
* Create Coordinate Picker plugin (`#593 <https://github.com/swri-robotics/mapviz/issues/593>`_)
* Contributors: Davide Faconti, Ed Venator, Edward Venator, Elliot Johnson, Jerry Towler, Marc Alban, Matthew, Matthew Bries, Mikael Arguedas, Neal Seegmiller, Nicholas Alton, P. J. Reed, Vincent Rousseau

0.2.6 (2018-07-31)
------------------
* Fix timestamp interval (`#588 <https://github.com/swri-robotics/mapviz/issues/588>`_)
Expand Down
37 changes: 37 additions & 0 deletions mapviz_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(DEPENDENCIES
marti_visualization_msgs
move_base_msgs
nav_msgs
map_msgs
pluginlib
roscpp
sensor_msgs
Expand All @@ -28,6 +29,36 @@ set(DEPENDENCIES

find_package(catkin REQUIRED COMPONENTS ${DEPENDENCIES})

set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Widgets REQUIRED)
set(QT_LIBRARIES
${Qt5Core_LIBRARIES}
${Qt5Gui_LIBRARIES}
${Qt5OpenGL_LIBRARIES}
${Qt5Widgets_LIBRARIES}
)
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5OpenGL_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
)
add_definitions(
${Qt5Core_DEFINITIONS}
${Qt5Gui_DEFINITIONS}
${Qt5OpenGL_DEFINITIONS}
${Qt5Widgets_DEFINITIONS}
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")


add_service_files(FILES
GPSCommand.srv
)
generate_messages(DEPENDENCIES sensor_msgs std_msgs)
### QT ###
if("$ENV{ROS_DISTRO}" STRLESS "kinetic")
find_package(Qt4 COMPONENTS REQUIRED QtCore QtGui QtOpenGL)
Expand Down Expand Up @@ -97,10 +128,12 @@ set(UI_FILES
ui/marker_config.ui
ui/move_base_config.ui
ui/navsat_config.ui
ui/occupancy_grid_config.ui
ui/odometry_config.ui
ui/path_config.ui
ui/plan_route_config.ui
ui/point_click_publisher_config.ui
ui/right_click_services_config.ui
Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep the order of files in these lists alphabetized.

ui/pointcloud2_config.ui
ui/robot_image_config.ui
ui/route_config.ui
Expand All @@ -122,11 +155,13 @@ set(SRC_FILES
src/marker_plugin.cpp
src/move_base_plugin.cpp
src/navsat_plugin.cpp
src/occupancy_grid_plugin.cpp
src/odometry_plugin.cpp
src/path_plugin.cpp
src/placeable_window_proxy.cpp
src/plan_route_plugin.cpp
src/point_click_publisher_plugin.cpp
src/right_click_services_plugin.cpp
src/pointcloud2_plugin.cpp
src/point_drawing_plugin.cpp
src/robot_image_plugin.cpp
Expand All @@ -149,12 +184,14 @@ set(HEADER_FILES
include/${PROJECT_NAME}/marker_plugin.h
include/${PROJECT_NAME}/move_base_plugin.h
include/${PROJECT_NAME}/navsat_plugin.h
include/${PROJECT_NAME}/occupancy_grid_plugin.h
include/${PROJECT_NAME}/odometry_plugin.h
include/${PROJECT_NAME}/path_plugin.h
include/${PROJECT_NAME}/path_plugin.h
include/${PROJECT_NAME}/placeable_window_proxy.h
include/${PROJECT_NAME}/plan_route_plugin.h
include/${PROJECT_NAME}/point_click_publisher_plugin.h
include/${PROJECT_NAME}/right_click_services_plugin.h
include/${PROJECT_NAME}/pointcloud2_plugin.h
include/${PROJECT_NAME}/point_drawing_plugin.h
include/${PROJECT_NAME}/robot_image_plugin.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace mapviz_plugins
void setMaxClickMovement(qreal max_distance);

Q_SIGNALS:
void pointClicked(const QPointF&);
void pointClicked(const QPointF&, const Qt::MouseButton&);

protected:
bool eventFilter(QObject *object, QEvent* event);
Expand Down
2 changes: 1 addition & 1 deletion mapviz_plugins/include/mapviz_plugins/image_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace mapviz_plugins
int offset_y_;
double width_;
double height_;
QString transport_;
std::string transport_;

bool force_resubscribe_;
bool has_image_;
Expand Down
2 changes: 2 additions & 0 deletions mapviz_plugins/include/mapviz_plugins/laserscan_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace mapviz_plugins
void UseRainbowChanged(int check_state);
void UpdateColors();
void DrawIcon();
void ResetTransformedScans();

private:
struct StampedPoint
Expand Down Expand Up @@ -146,6 +147,7 @@ namespace mapviz_plugins
size_t prev_ranges_size_;
float prev_angle_min_;
float prev_increment_;
bool GetScanTransform(const Scan &scan, swri_transform_util::Transform& transform);
};
}

Expand Down
Loading