This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from pankhurivanjani/master
First release of camViz tool
- Loading branch information
Showing
194 changed files
with
35,712 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(camviz) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
# Default to C++14 | ||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 14) | ||
endif() | ||
|
||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic -Wunused-parameter) | ||
endif() | ||
|
||
SET(rosversion "1" CACHE STRING "Some user-specified option") | ||
message("THIS IS ROS1") | ||
SET( SOURCE_FILES camViz.cpp viewer.cpp) | ||
add_definitions(-DGLADE_DIR="${gladedir}") | ||
|
||
find_package(roscpp REQUIRED) | ||
find_package(std_msgs REQUIRED) | ||
find_package(image_transport REQUIRED) | ||
find_package(sensor_msgs REQUIRED) | ||
find_package(OpenCV REQUIRED) | ||
find_package(cv_bridge REQUIRED) | ||
find_package(yaml-cpp REQUIRED) | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(GTKMM gtkmm-3.0) | ||
|
||
#pkg_check_modules(libglademm libglademm-2.4) | ||
|
||
if(roscpp_FOUND) | ||
message("ROS1 found") | ||
add_definitions(-DROS1_H) | ||
add_definitions(-DROS1S_H) | ||
SET(ROS1_H ON) | ||
ELSE() | ||
message("ROS1 not found") | ||
SET(ROS1_H OFF) | ||
SET(ROS1S_H OFF) | ||
endif() | ||
SET( LIBS_EXTRA resourcelocator ) | ||
|
||
include_directories(${GTKMM_INCLUDE_DIRS} | ||
${resourcelocator_INCLUDE_DIRS} | ||
# ${libglademm_INCLUDE_DIRS} | ||
# ${gtkglextmm_INCLUDE_DIRS} | ||
${ZLIB_INCLUDE_DIRS} | ||
) | ||
|
||
include_directories(${roscpp_INCLUDE_DIRS} ${image_transport_INCLUDE_DIRS} ${sensor_msgs_INCLUDE_DIRS} ) | ||
include_directories( | ||
${std_msgs_INCLUDE_DIRS} | ||
${OpenCV_INCLUDE_DIRS} | ||
${cv_bridge_INCLUDE_DIRS} | ||
#${libglademm_INCLUDE_DIRS} | ||
${resourcelocator_INCLUDE_DIRS}) | ||
|
||
link_directories( | ||
${resourcelocator_LIBRARY_DIRS} | ||
${GTKMM_LIBRARY_DIRS} | ||
${resourcelocator_LIBRARY_DIRS} | ||
|
||
) | ||
|
||
add_executable (camViz ${SOURCE_FILES}) | ||
|
||
target_link_libraries(camViz | ||
${roscpp_LIBRARIES} | ||
${std_msgs_LIBRARIES} | ||
${image_transport_LIBRARIES} | ||
${OpenCV_LIBRARIES} | ||
${cv_bridge_LIBRARIES} | ||
${sensor_msgs_LIBRARIES} | ||
${YAML_CPP_LIBRARIES}) | ||
|
||
TARGET_LINK_LIBRARIES(camViz | ||
${GTKMM_LIBRARIES} | ||
# ${libglademm_LIBRARIES} | ||
${ZLIB_LIBRARIES} | ||
${CMAKE_THREAD_LIBS_INIT} | ||
${resourcelocator_LIBRARIES} | ||
${catkin_LIBRARIES} | ||
${GLOG_LIBRARIES} | ||
|
||
) | ||
install(TARGETS camViz | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/ | ||
COMPONENT camviz | ||
) | ||
|
||
|
||
INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/camViz.glade DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/glade COMPONENT camviz) | ||
INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/camViz.yml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/conf COMPONENT camviz) |
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 @@ | ||
colcon |
Empty file.
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,40 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> | ||
<!--*- mode: xml -*--> | ||
<interface> | ||
<object class="GtkWindow" id="mainwindow"> | ||
<property name="visible">True</property> | ||
<property name="title" translatable="yes">CamViz</property> | ||
<child> | ||
<object class="GtkTable" id="table1"> | ||
<property name="visible">True</property> | ||
<property name="n_rows">2</property> | ||
<property name="n_columns">1</property> | ||
<child> | ||
<object class="GtkLabel" id="fpslabel"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0</property> | ||
<property name="label" translatable="yes">0 fps</property> | ||
</object> | ||
<packing> | ||
<property name="top_attach">1</property> | ||
<property name="bottom_attach">2</property> | ||
<property name="x_options">GTK_FILL</property> | ||
<property name="y_options"></property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkImage" id="image"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0.68999999761581421</property> | ||
<property name="stock">gtk-missing-image</property> | ||
</object> | ||
<packing> | ||
<property name="x_options">GTK_FILL</property> | ||
<property name="y_options">GTK_FILL</property> | ||
</packing> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</interface> |
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,7 @@ | ||
Server: 1 # Deactivate, ROS , ROS2 | ||
Proxy: "cameraA:tcp -h localhost -p 9999" | ||
Format: RGB8 | ||
Topic: "/usb_cam/image_raw" | ||
Name: cameraA | ||
Fps: 30 | ||
NodeName: camViz |
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,45 @@ | ||
#include <iostream> | ||
#include <chrono> | ||
#include </opt/jderobot/include/jderobot/visionlib/colorspaces/colorspacesmm.h> | ||
#include "viewer.h" | ||
#include "comm/getCameraClientdef.hpp" | ||
#include </opt/jderobot/include/jderobot/types/image.h> | ||
#include <yaml-cpp/yaml.h> | ||
|
||
|
||
using namespace std; | ||
|
||
int main(int argc, char** argv){ | ||
|
||
camViz::Viewer viewer; | ||
|
||
|
||
std::string config_file_; | ||
config_file_.assign(argv[1]); | ||
|
||
YAML::Node config = YAML::LoadFile(config_file_); | ||
int server = config["Server"].as<int>(); | ||
|
||
std::string topic = config["Topic"].as<std::string>(); | ||
int fps = config["Fps"].as<int>(); | ||
std::string nodeName = config["Name"].as<std::string>(); | ||
|
||
|
||
// ***********Get from camera-interface************* | ||
camViz::CameraClient* camRGB; | ||
|
||
camRGB = camViz::getCameraClient(argc,argv,server,topic,nodeName); | ||
|
||
//////****************View in GUI****************************** | ||
JdeRobotTypes::Image rgb; | ||
std::cout << viewer.isVisible(); | ||
|
||
while(viewer.isVisible()){ | ||
rgb = camRGB->getImage(); | ||
viewer.display(rgb.data); | ||
viewer.displayFrameRate(1); | ||
|
||
} | ||
|
||
return 0; | ||
} |
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,40 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> | ||
<!--*- mode: xml -*--> | ||
<interface> | ||
<object class="GtkWindow" id="mainwindow"> | ||
<property name="visible">True</property> | ||
<property name="title" translatable="yes">CamViz</property> | ||
<child> | ||
<object class="GtkTable" id="table1"> | ||
<property name="visible">True</property> | ||
<property name="n_rows">2</property> | ||
<property name="n_columns">1</property> | ||
<child> | ||
<object class="GtkLabel" id="fpslabel"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0</property> | ||
<property name="label" translatable="yes">0 fps</property> | ||
</object> | ||
<packing> | ||
<property name="top_attach">1</property> | ||
<property name="bottom_attach">2</property> | ||
<property name="x_options">GTK_FILL</property> | ||
<property name="y_options"></property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkImage" id="image"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0.68999999761581421</property> | ||
<property name="stock">gtk-missing-image</property> | ||
</object> | ||
<packing> | ||
<property name="x_options">GTK_FILL</property> | ||
<property name="y_options">GTK_FILL</property> | ||
</packing> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</interface> |
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,7 @@ | ||
Server: 1 # Deactivate, ROS , ROS2 | ||
Proxy: "cameraA:tcp -h localhost -p 9999" | ||
Format: RGB8 | ||
Topic: "/usb_cam/image_raw" | ||
Name: cameraA | ||
Fps: 30 | ||
NodeName: camViz |
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,16 @@ | ||
#pragma once | ||
#include <iostream> | ||
#include </opt/jderobot/include/jderobot/types/image.h> | ||
|
||
namespace camViz { | ||
class CameraClient { | ||
public: | ||
virtual JdeRobotTypes::Image getImage() = 0; | ||
virtual int getRefreshRate() = 0; | ||
bool on = false; | ||
protected: | ||
JdeRobotTypes::Image image; | ||
int refreshRate; | ||
}; | ||
} | ||
|
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,8 @@ | ||
#include </opt/jderobot/include/jderobot/types/image.h> | ||
|
||
#include "CameraClient.hpp" | ||
|
||
namespace camViz { | ||
CameraClient* getCameraClient(int argc, char** argv, int server, std::string topic,std::string nodeName); | ||
|
||
} |
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,52 @@ | ||
#include <iostream> | ||
#include "sstream" | ||
#include <chrono> | ||
#include <memory> | ||
|
||
#include "mainsub.hpp" | ||
#include "getCameraClient.hpp" | ||
|
||
|
||
namespace camViz{ | ||
|
||
CameraClient* | ||
getCameraClient(int argc, char** argv, int server, std::string topic,std::string nodeName){ | ||
CameraClient* client = NULL; | ||
switch (server){ | ||
case 1: | ||
{ | ||
#ifdef ROS1S_H | ||
std::cout << "Receiving ROS1 messages" << std::endl; | ||
|
||
ListenerCamera* lc; | ||
lc = new ListenerCamera(0, nullptr, nodeName, topic); | ||
lc->start(); | ||
|
||
client = (camViz::CameraClient*) lc; | ||
//cv::destroyWindow("view"); | ||
|
||
#else | ||
throw "ERROR: ROS1 is not available"; | ||
#endif | ||
break; | ||
} | ||
case 2: | ||
{ | ||
std::cout << "This version supports only ROS1 messages" << std::endl; | ||
|
||
break; | ||
} | ||
default: | ||
{ | ||
printf("Select right distro of ROS"); | ||
break; | ||
} | ||
|
||
} | ||
|
||
return client; | ||
|
||
|
||
} | ||
|
||
} |
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,11 @@ | ||
#ifdef ROS1S_H | ||
#include "ros/ros.h" | ||
#include "std_msgs/String.h" | ||
#include <image_transport/image_transport.h> | ||
#include <opencv2/highgui/highgui.hpp> | ||
#include <cv_bridge/cv_bridge.h> | ||
#include "ros/listenercameraros.hpp" | ||
|
||
#endif | ||
|
||
|
Oops, something went wrong.