Der Name des default branch ist ab jetzt für neue Repositories main. The name of the default branch for new repositories is from now on main.

Commit e26db99d authored by Michael Kingston's avatar Michael Kingston Committed by Daniel Müller
Browse files

Added ms time param for interface and cleanup

parent ef649a97
......@@ -4,5 +4,5 @@ Iris Color : 1.0, 0.0, 1.0
Outline Color : 0.0, 0.0, 0.0
Voice: voice_cmu_us_slt_cg
Window Width : 800
Window Height : 1000
Window Height : 1000 #this breaks when it is larger than 1067...
Window Rotation : 0
......@@ -78,8 +78,8 @@ private slots:
private:
int initialized_;
float windowHeight_;
float windowWidth_;
int windowWidth_;
int windowHeight_;
std::shared_ptr<TalkingHead> talking_head_;
......
......@@ -27,28 +27,10 @@ MainWindow::MainWindow(QWidget* parent)
{
ROS_INFO("Creating MainWindow..");
// TODO FIXME
windowHeight_ = 1000; //1000!
windowWidth_ = 800; //800!
int width = windowWidth_;
int height = windowHeight_;
windowWidth_ = 800; //800! //will be overriden 10 lines later anyway
windowHeight_ = 1000; //1270!
int window_rotation = 0;
int max_width = width;
int max_height = height;
int min_width = width;
int min_height = height;
// ImageStreamDisplay
image_stream_display_
= std::make_shared<ImageDisplay>(window_rotation, windowWidth_, windowHeight_, this);
//image_stream_display_->setMinimumSize(width, height);
//image_stream_display_->setMaximumSize(min_width, min_height);
try
{
std::vector<std::vector<float>> material_colors;
......@@ -56,15 +38,19 @@ MainWindow::MainWindow(QWidget* parent)
const char* cfgFilename = filename.c_str();
Config cfg(cfgFilename);
width = cfg.get("Window Width");
height = cfg.get("Window Height");
windowWidth_ = cfg.get("Window Width");
windowHeight_ = cfg.get("Window Height");
std::string mesh_filename = cfg.get("Mesh Filename");
material_colors.push_back(cfg.get("Head Color"));
material_colors.push_back(cfg.get("Iris Color"));
material_colors.push_back(cfg.get("Outline Color"));
window_rotation = cfg.get("Window Rotation");
assert(window_rotation == 0 || window_rotation == 90 || window_rotation == 180
|| window_rotation == 270);
assert(window_rotation == 0 || window_rotation == 90 || window_rotation == 180 || window_rotation == 270);
image_stream_display_ = std::make_shared<ImageDisplay>(window_rotation, windowWidth_, windowHeight_, this);
// image_stream_display_->setMinimumSize(windowWidth_, windowHeight_); //setting this will push any text off the screen
// image_stream_display_->setMaximumSize(windowWidth_, windowHeight_);
talking_head_ = std::make_unique<TalkingHead>(this, mesh_filename, material_colors, window_rotation, image_stream_display_);
std::cout << "Mesh Filename : " << mesh_filename << std::endl;
......@@ -74,10 +60,14 @@ MainWindow::MainWindow(QWidget* parent)
std::cerr << e.what() << std::endl;
}
center_layout = new QVBoxLayout();
main_layout = new QVBoxLayout();
h_layout = new QVBoxLayout();
// NOW THE LAYOUT HORROR BEGINS
center_layout = new QVBoxLayout();
main_layout = new QVBoxLayout();
h_layout = new QVBoxLayout();
// START WITH SOME UNSPECTACULAR width/height NAMES
int width = windowWidth_;
int height = windowHeight_;
if (window_rotation == 0 || window_rotation == 180)
{
......@@ -91,10 +81,11 @@ MainWindow::MainWindow(QWidget* parent)
setMinimumSize(width, height);
}
max_width = width / 4;
max_height = height / 4;
min_width = (width * 3) / 4;
min_height = (height * 3) / 4;
// AND DO THINGS NOBODY CAN UNDERSTAND
int max_width = width / 4;
int max_height = height / 4;
int min_width = (width * 3) / 4;
int min_height = (height * 3) / 4;
if (window_rotation == 0 || window_rotation == 180)
{
......
......@@ -20,15 +20,18 @@ class RobotFaceInterface:
bridge = CvBridge()
@staticmethod
def display_image_on_front_display(image, displayTime=1000):
def display_image_on_front_display(image, displayTime=1, displayTimeMsecs=0):
"""This method displays an image on Lisas face.\
:image: Image to be displayed, can be `ROS Image` or `Numpy array`
:displayTime: Duration in milliseconds that image should be displayed for. \
:displayTime: Duration in seconds that image should be displayed for. \
If 0 then will be displayed for max of 2 secs or until new image is recieved
:displayTimeMsecs: Duration in milliseconds that image should be displayed for.
:returns: `None`
"""
dtime = displayTime * 1000 + displayTimeMsecs
if (type(image) == numpy.ndarray):
imageTemp = image
if image.dtype == numpy.dtype('float64'):
......@@ -38,7 +41,7 @@ If 0 then will be displayed for max of 2 secs or until new image is recieved
RobotFaceInterface.imagePublisher.publish(
DisplayImage(
time = displayTime,
time = dtime,
Image = imageP
)
)
......@@ -46,7 +49,7 @@ If 0 then will be displayed for max of 2 secs or until new image is recieved
elif (type(image) == Image):
RobotFaceInterface.imagePublisher.publish(
DisplayImage(
time = displayTime,
time = dtime,
Image = image
)
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment