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

Major Updates #4

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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ CMakeFiles/
CMakeCache.txt
Makefile
.vs/
out/
out/
.tile_cache/
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ target_include_directories(sackviz PUBLIC
${pubsub_INCLUDE_DIRS}
${librucksack_INCLUDE_DIRS})
target_link_libraries(sackviz GWEN_opengl GWEN_static ${pubsub_LIBRARIES}
debug ${librucksack_DEBUG_LIBRARIES}
debug ${librucksack_LIBRARIES}
optimized ${librucksack_LIBRARIES})
set_property(TARGET sackviz PROPERTY CXX_STANDARD 11)

Expand Down
27 changes: 0 additions & 27 deletions CMakeSettings.json

This file was deleted.

Binary file modified DefaultSkin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions LocalXY.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LocalXYUtil
rho_lon_ = (rho_n - depth) * cos(origin_lat_);
}

void ToLatLon(double x, double y, double& lat, double& lon)
void ToLatLon(double x, double y, double& lat, double& lon) const
{
double dLon = 1.0 * x - 0.0 * y;
double dLat = 0.0 * x + 1.0 * y;
Expand All @@ -61,7 +61,7 @@ class LocalXYUtil
lon = RadiansToDegrees(rlon);
}

void FromLatLon(double lat, double lon, double& x, double& y)
void FromLatLon(double lat, double lon, double& x, double& y) const
{
double rLat = DegreesToRadians(lat);
double rLon = DegreesToRadians(lon);
Expand All @@ -72,25 +72,25 @@ class LocalXYUtil
y = -0.0 * dLon + 1.0 * dLat;
}

inline double OriginLatitude()
inline double OriginLatitude() const
{
return RadiansToDegrees(origin_lat_);
}

inline double OriginLongitude()
inline double OriginLongitude() const
{
return RadiansToDegrees(origin_lon_);
}

inline double DegreesToRadians(double angle)
inline double DegreesToRadians(double angle) const
{
return angle * M_PI / 180.0;
}

inline double RadiansToDegrees(double radians)
inline double RadiansToDegrees(double radians) const
{
return (180.0 / M_PI) * radians;
}
};

#endif
#endif
35 changes: 32 additions & 3 deletions Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ namespace pubviz
// Returns info about a selected item including bounds (todo)
virtual std::map<std::string, std::string> Select(uint32_t index, AABB& size) { return {}; }

// Applies only for 2d. Return true if event is handled.
virtual bool OnMapDoubleClick(double x, double y) { return false; }

// Called on right click to add items to a context menu
virtual std::vector<std::pair<std::string, std::function<void()>>> ContextMenu(double x, double y) { return {}; }

// Returns if the plugin is enabled and should be rendered
bool Enabled()
{
Expand All @@ -89,6 +95,7 @@ namespace pubviz
// Indicate that we want a redraw
void Redraw()
{
// todo add a rate limit here
props_->Redraw();
}

Expand All @@ -104,8 +111,14 @@ namespace pubviz
out += tree_node_->GetToggleButton()->GetToggleState() ? "false" : "true";
// lets just write it as CSV
int i = 0;
for (auto& prop : properties_)

for (const auto& prop : properties_)
{
// skip ButtonProperties
if (dynamic_cast<ButtonProperty*>(prop.second))
{
continue;
}
out += ",";
out += prop.first;
out += ",";
Expand Down Expand Up @@ -195,9 +208,9 @@ namespace pubviz
}

TopicProperty* AddTopicProperty(Gwen::Controls::Properties* tree, const char* name, std::string topic,
const std::string& description = "", const std::string& type = "", bool use_for_title = true)
const std::string& description = "", const std::string& type = "", bool use_for_title = true, bool published = true)
{
auto prop = new TopicProperty(tree, name, topic, description, type);
auto prop = new TopicProperty(tree, name, topic, description, type, published);
properties_[name] = prop;
auto p = (Gwen::Controls::PropertyTreeNode*)tree->GetParent();
if (use_for_title)
Expand All @@ -218,13 +231,29 @@ namespace pubviz
return prop;
}

FileProperty* AddFileProperty(Gwen::Controls::Properties* tree, const char* name, std::string val,
const std::string& description = "")
{
auto prop = new FileProperty(tree, name, val, description);
properties_[name] = prop;
return prop;
}

EnumProperty* AddEnumProperty(Gwen::Controls::Properties* tree, const char* name, std::string def, std::vector<std::string> enums,
const std::string& description = "")
{
auto prop = new EnumProperty(tree, name, def, enums, description);
properties_[name] = prop;
return prop;
}

ButtonProperty* AddButtonProperty(Gwen::Controls::Properties* tree, const char* name,
const std::string& description = "")
{
auto prop = new ButtonProperty(tree, name, description);
properties_[name] = prop;
return prop;
}
};
}
#endif
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ This repository contains three tools:

A tool for visualizing incoming data in both 2D and 3D. Largely uses immediate mode OpenGL for rendering for ease of implementation.

![Example screenshot of pubviz.](pubviz_screenshot.png)
![Example screenshot of a 2D view in pubviz.](pubviz_2d.png)

![Example screenshot of a 3D view in pubviz.](pubviz_3d.png)

It supports visualizing:

* Point Clouds
* Costmaps
* Basic Markers (to be further improved)
* Various Markers (to be further improved)
* Grids
* Images
* Time series plots of individual data fields
Expand All @@ -27,7 +29,7 @@ It supports visualizing:

# Sackviz

A tool for introspecting and playing back Rucksack files. Also supports both time series and scatter plots of data.
A tool for introspecting and playing back Rucksack files. Supports viewing both time series and scatter plots of data.

![Example screenshot of sackviz.](sackviz_screenshot.png)

Expand Down
3 changes: 1 addition & 2 deletions controls/GraphCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ GraphSubscriber::GraphSubscriber(const std::string& topic)
ps_subscriber_options_init(&options);
options.skip = 0;
options.queue_size = 0;
options.want_message_def = true;
options.allocator = 0;
options.ignore_local = false;
options.preferred_transport = false ? 1 : 0;
Expand Down Expand Up @@ -156,7 +155,7 @@ GWEN_CONTROL_CONSTRUCTOR( GraphCanvas )
ps_node_init_ex(&node, "pubviz", "", false, false);
//ps_node_init(&node, "pubviz", "", false);

node.adv_cb = [](const char* topic, const char* type, const char* node, const ps_advertise_req_t* data)
node.adv_cb = [](const char* topic, const char* type, const char* node, const ps_advertise_req_t* data, void* cb_data)
{
// check if we already have the topic
if (_graph_topics.find(topic) != _graph_topics.end())
Expand Down
Loading
Loading