Commit fa01b5c7 authored by Patrick Holthaus's avatar Patrick Holthaus

load utterances at startup, too

parent bcbc7ea5
......@@ -16,6 +16,7 @@ exp_trial_list({"/safety_security/experiment_trials"}),
exp_condition_param({"/safety_security/experiment_condition"}),
utterance_param({"/script_server/utterances/"})
{
empty_list.append("<empty>");
notify_publisher = nh.advertise<safety_security::PopupMsg>(notify_topic, 1000);
cmd_publisher = nh.advertise<std_msgs::String>(cmd_topic, 1000);
rec_client = nh.serviceClient<record_ros::String_cmd>(rec_service);
......@@ -23,9 +24,24 @@ utterance_param({"/script_server/utterances/"})
&ROSControl::cmd_received,
this);
XmlRpc::XmlRpcValue filters;
bool params_loaded = nh.getParam(utterance_param, filters);
if (params_loaded)
{
ROS_ASSERT(filters.getType() == XmlRpc::XmlRpcValue::TypeStruct);
QStringList new_list;
for(XmlRpc::XmlRpcValue::ValueStruct::const_iterator it = filters.begin(); it != filters.end(); ++it) {
new_list.append(QString::fromStdString((std::string)(it->first)));
}
setMsgList(new_list);
}
else
{
ROS_WARN("[CTRLIF] Utterance parameters could not be loaded from '%s', using an empty list for now.", utterance_param.c_str());
setMsgList(empty_list);
}
empty_list.append("<empty>");
setMsgList(empty_list);
setSoundEnabled(true);
setRunning(false);
}
......@@ -57,7 +73,6 @@ void ROSControl::cmd_received(const std_msgs::String::ConstPtr& msg)
system(("rosparam dump " + trial_data_file + " /safety_security").c_str());
setRunning(false);
setMsgList(empty_list);
}
}
}
......@@ -270,7 +285,6 @@ void ROSControl::stop_exp(const QString experiment_id, const QString experiment_
system(("rosparam dump " + trial_data_file + " /safety_security").c_str());
setRunning(false);
setMsgList(empty_list);
}
std::string ROSControl::get_sound_file(std::string name) {
......
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