Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSMTransportのパラメータの情報を設定する #1024

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/ext/transport/SSMTransport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ project (SSMTransport
LANGUAGES CXX)


set(SSM_ROOT ${SSM_ROOT} CACHE PATH "set SSM_ROOT")



link_directories(${ORB_LINK_DIR})
if(SSM_ROOT)
link_directories(${SSM_ROOT}/lib ${SSM_ROOT}/lib64)
endif()
add_definitions(${ORB_C_FLAGS_LIST})

if(WIN32)
Expand All @@ -29,6 +36,9 @@ if(VXWORKS AND NOT RTP)
openrtm_set_link_props_shared(${target})
openrtm_include_rtm(${target})
target_link_libraries(${target} ${libs} ssm)
if(SSM_ROOT)
target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include)
endif()

install(TARGETS ${target} LIBRARY DESTINATION ${INSTALL_RTM_EXT_DIR}/transport
ARCHIVE DESTINATION ${INSTALL_RTM_EXT_DIR}/transport
Expand All @@ -43,6 +53,9 @@ else()
openrtm_include_rtm(${target})
openrtm_set_link_props_shared(${target})
target_link_libraries(${target} PRIVATE ${libs} ${RTM_LINKER_OPTION} ssm)
if(SSM_ROOT)
target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include)
endif()
set_target_properties(${target} PROPERTIES PREFIX "")

set_target_properties(${target} PROPERTIES
Expand All @@ -65,3 +78,10 @@ if(VXWORKS)
endif(RTP)
endif(VXWORKS)

set(INSTALL_SSMTRANSPORT_DIR ${INSTALL_RTM_EXT_DIR}/transport)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/rtc.ssm.conf.in ${PROJECT_BINARY_DIR}/rtc.ssm.conf @ONLY)
install(
FILES ${PROJECT_BINARY_DIR}/rtc.ssm.conf
DESTINATION ${INSTALL_RTM_ETC_DIR}/transport
COMPONENT ext)
2 changes: 1 addition & 1 deletion src/ext/transport/SSMTransport/SSMOutPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace RTC
RTC_PARANOID(("SSMOutPort::init()"));

m_stream_name = prop.getProperty("ssm.stream_name", "sensor_test");
std::string stream_id_str = prop.getProperty("stream_id", "0");
std::string stream_id_str = prop.getProperty("ssm.stream_id", "0");
if(!coil::stringTo(m_stream_id, stream_id_str.c_str()))
{
RTC_ERROR(("stream_id is invalid value"));
Expand Down
38 changes: 35 additions & 3 deletions src/ext/transport/SSMTransport/SSMTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@

namespace SSMRTM
{
static const char* const ssm_inport_option[] =
{
"stream_name.__value__", "sensor_test",
"stream_name.__widget__", "text",
"stream_id.__value__", "0",
"stream_id.__widget__", "spin",
"stream_id.__constraint__", "0 <= x <= 10000",
""
};
static const char* const ssm_outport_option[] =
{
"stream_name.__value__", "sensor_test",
"stream_name.__widget__", "text",
"stream_id.__value__", "0",
"stream_id.__widget__", "spin",
"stream_id.__constraint__", "0 <= x <= 10000",
"stream_size.__value__", "0",
"stream_size.__widget__", "spin",
"stream_size.__constraint__", "0 <= x <= 2147483647",
"life_ssm_time.__value__", "5.0",
"life_ssm_time.__widget__", "slider.0.01",
"life_ssm_time.__constraint__", "0.00 <= x <= 1000.00",
"cycle_ssm_time.__value__", "0.05",
"cycle_ssm_time.__widget__", "slider.0.01",
"cycle_ssm_time.__constraint__", "0.00 <= x <= 1000.00",
""
};


ManagerActionListener::ManagerActionListener()
{
Expand Down Expand Up @@ -69,25 +97,29 @@ extern "C"
{
if(!initSSM())
{
return;
throw;
}

{
coil::Properties prop(SSMRTM::ssm_inport_option);
RTC::OutPortConsumerFactory& factory(RTC::OutPortConsumerFactory::instance());
factory.addFactory("ssm",
::coil::Creator< ::RTC::OutPortConsumer,
::RTC::SSMInPort>,
::coil::Destructor< ::RTC::OutPortConsumer,
::RTC::SSMInPort>);
::RTC::SSMInPort>,
prop);
}

{
coil::Properties prop(SSMRTM::ssm_outport_option);
RTC::InPortConsumerFactory& factory(RTC::InPortConsumerFactory::instance());
factory.addFactory("ssm",
::coil::Creator< ::RTC::InPortConsumer,
::RTC::SSMOutPort>,
::coil::Destructor< ::RTC::InPortConsumer,
::RTC::SSMOutPort>);
::RTC::SSMOutPort>,
prop);
}


Expand Down
10 changes: 10 additions & 0 deletions src/ext/transport/SSMTransport/rtc.ssm.conf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
logger.enable: YES
logger.log_level: DEBUG
#logger.file_name: stdout

manager.modules.load_path: @CMAKE_INSTALL_PREFIX@/@INSTALL_SSMTRANSPORT_DIR@
manager.preload.modules: SSMTransport@CMAKE_SHARED_LIBRARY_SUFFIX@

manager.components.preactivation: ConsoleOut0, ConsoleIn0
manager.components.preconnect: ConsoleOut0.in?interface_type=ssm&ssm.stream_name=test_stream&dataflow_type=pull, ConsoleIn0.out?interface_type=ssm&ssm.stream_name=test_stream