RTT::types::TypeInfo* Task::getType(::std::string const & type_name){
	/* Check if port type is known */
	RTT::types::TypeInfoRepository::shared_ptr ti =
					RTT::types::TypeInfoRepository::Instance();
	RTT::types::TypeInfo* type = ti->type(type_name);
	if (!type)
	{
			log(Info) << "Cannot find port type " << type_name <<
							" in the type info repository, loading additional typekits." << endlog();


			std::string path (getenv("LD_LIBRARY_PATH"));
			path = path + ";" + path + "/orocos/";
			RTT::plugin::PluginLoader::Instance()->loadTypekits(path.c_str());

			type = ti->type(type_name);

			if (!type){
				log(Info) << "Cannot find port type " << type_name << " in the updated type info repository" << endlog();
				return 0;
			}

	}
	return type;
}
示例#2
0
void loadTorquesType() {
    const std::string NAME("rstrt.dynamics.Torques");

    RTT::types::TypeInfoRepository::shared_ptr repository = RTT::types::Types();

    repository->addType(new RTT::types::StructTypeInfo<rstrt::dynamics::Torques,
                                                       true>
                        (NAME));
    RTT::types::TypeInfo* typeInfo = repository->type(NAME);
    typeInfo->addConstructor(RTT::types::newConstructor(&createTorques_Values));

    repository->addType(
        new RTT::types::SequenceTypeInfo<std::vector<rstrt::dynamics::Torques> >
        (NAME + "[]"));
}
示例#3
0
void loadTwistType() {
	const std::string NAME("rstrt.kinematics.Twist");

	RTT::types::TypeInfoRepository::shared_ptr repository = RTT::types::Types();

	repository->addType(
			new RTT::types::StructTypeInfo<rstrt::kinematics::Twist, true>(
					NAME));
	RTT::types::TypeInfo* typeInfo = repository->type(NAME);
	typeInfo->addConstructor(RTT::types::newConstructor(&createTwist_Values));

	typeInfo->addConstructor(
			RTT::types::newConstructor(&createTwist_NestedTypes));

	repository->addType(
			new RTT::types::SequenceTypeInfo<
					std::vector<rstrt::kinematics::Twist> >(NAME + "[]"));
}
示例#4
0
bool Logger::createLoggingPort(const std::string& portname, const std::string& typestr, std::vector<logger::StreamMetadata> const& metadata)
{
    RTT::types::TypeInfoRepository::shared_ptr ti = RTT::types::TypeInfoRepository::Instance();
    RTT::types::TypeInfo* type = ti->type(typestr);
    if (! type)
    {
	cerr << "cannot find " << typestr << " in the type info repository" << endl;
	return false;
    }
    
    RTT::base::PortInterface *pi = ports()->getPort(portname);
    if(pi) {
	cerr << "port with name " << portname << " already exists" << endl;
	return false;
    }

    RTT::base::InputPortInterface *ip= type->inputPort(portname);
    return addLoggingPort(ip, portname, metadata);
}