From b3226f33b962196aaefec68229e43a58987497c2 Mon Sep 17 00:00:00 2001 From: Louis-Guillaume DUBOIS Date: Fri, 1 May 2015 23:22:13 +0200 Subject: [PATCH] node keyboard_cmd displays UTF-8 --- CMakeLists.txt | 8 ++++---- src/{curses.cpp => display.cpp} | 4 +--- src/{curses.h => display.h} | 0 src/keyboard_cmd.cpp | 31 +++++++------------------------ src/test.cpp | 2 +- 5 files changed, 13 insertions(+), 32 deletions(-) rename src/{curses.cpp => display.cpp} (89%) rename src/{curses.h => display.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 124337e..7fbe2d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ find_package( PkgConfig REQUIRED ) -pkg_check_modules ( ncurses REQUIRED ncurses ) +pkg_check_modules ( ncursesw REQUIRED ncursesw) add_message_files( FILES @@ -30,7 +30,7 @@ catkin_package() include_directories( ${catkin_INCLUDE_DIRS} - ${CURSES_INCLUDE_DIRS} + ${CURSESW_INCLUDE_DIRS} ) add_executable(filtre src/filtre.cpp) @@ -42,10 +42,10 @@ target_link_libraries(random_pcl_publisher ${catkin_LIBRARIES}) add_executable(pcl_displayer src/pcl_displayer.cpp) target_link_libraries(pcl_displayer ${catkin_LIBRARIES}) -add_library(curses src/curses.cpp src/curses.h) +add_library(display src/display.cpp) add_executable(keyboard_cmd src/keyboard_cmd.cpp) -target_link_libraries(keyboard_cmd ${catkin_LIBRARIES} ${ncurses_LIBRARIES} curses) +target_link_libraries(keyboard_cmd display ${catkin_LIBRARIES} ${ncursesw_LIBRARIES}) add_executable(normal_estimator src/normal_estimator.cpp) target_link_libraries(normal_estimator ${catkin_LIBRARIES}) diff --git a/src/curses.cpp b/src/display.cpp similarity index 89% rename from src/curses.cpp rename to src/display.cpp index cc96524..d4f048f 100644 --- a/src/curses.cpp +++ b/src/display.cpp @@ -1,5 +1,5 @@ #include -#include "curses.h" +#include "display.h" const int Curses::kbd_lines = 12; const int Curses::kbd_columns = 50; @@ -22,8 +22,6 @@ Curses::~Curses() { } void Curses::print_kbd() { - wprintw(kbd,"%s", L"tuiiaueakeoff>| t|⇑ y|↖ u|↑ i|↗ o|"); - wprintw(kbd,"%s", "tuiiaueakeoff>| t|⇑ y|↖ u|↑ i|↗ o|"); wmove(kbd, 0, 0); waddstr(kbd, " ---------------------"); wmove(kbd, 1, 0); waddstr(kbd, "takeoff>| t|⇑ y|↖ u|↑ i|↗ o|"); wmove(kbd, 2, 0); waddstr(kbd, " |---|---|---|---|---|----"); diff --git a/src/curses.h b/src/display.h similarity index 100% rename from src/curses.h rename to src/display.h diff --git a/src/keyboard_cmd.cpp b/src/keyboard_cmd.cpp index 577ceb9..a3805d0 100644 --- a/src/keyboard_cmd.cpp +++ b/src/keyboard_cmd.cpp @@ -5,8 +5,9 @@ #include #include #include - -#include "curses.h" +#include +#include +#include "display.h" #include #include @@ -30,9 +31,6 @@ class Run public: Run() : - n(), - empty(), - term(), loop_rate(30), x_speed(0.2), y_speed(0.3), @@ -46,23 +44,6 @@ class Run void operator()() { - - /* - std::cout - <<" ---------------------\n" - <<"takeoff>| t|⇑ y|↖ u|↑ i|↗ o|\n" - <<" |---|---|---|---|---|----\n" - <<" reset>| g|⇐ h|← j| k|→ l|⇒ m|\n" - <<" |---|---|---|---|---|----\n" - <<" land>| b|⇓ n|↙ ,|↓ ;|↘ :|\n" - <<" ---------------------\n" - <<"\n" - <<"a/w : increase/decrease linear `x` speeds by 10%\n" - <<"z/x : increase/decrease linear `y` speed by 10%\n" - <<"e/c : increase/decrease linear `z` speed by 10%\n" - <<"r/v : increase/decrease rotation speed by 10%\n"; - */ - while (ros::ok()) { geometry_msgs::Twist::Ptr msg(new geometry_msgs::Twist()); @@ -229,9 +210,11 @@ class Run int main(int argc, char** argv) { + setlocale(LC_ALL, ""); ros::init(argc, argv, "keyboard_cmd"); - Run run; - run(); + Curses terminal; + terminal.print_kbd(); + for(;;) ; return 0; } diff --git a/src/test.cpp b/src/test.cpp index 6f18229..bfe933b 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1,4 +1,4 @@ -#include "curses.h" +#include "display.h" #include "locale.h" int main() {