node keyboard_cmd displays UTF-8

This commit is contained in:
Louis-Guillaume DUBOIS 2015-05-01 23:22:13 +02:00
parent e237bfd695
commit b3226f33b9
5 changed files with 13 additions and 32 deletions

View file

@ -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})

View file

@ -1,5 +1,5 @@
#include <ncurses.h>
#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, " |---|---|---|---|---|----");

View file

@ -5,8 +5,9 @@
#include <string>
#include <ros/ros.h>
#include <ros/time.h>
#include "curses.h"
#include <locale.h>
#include <ncurses.h>
#include "display.h"
#include <std_msgs/Empty.h>
#include <geometry_msgs/Twist.h>
@ -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;
}

View file

@ -1,4 +1,4 @@
#include "curses.h"
#include "display.h"
#include "locale.h"
int main()
{