mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
microRTPS: delete run() functions as they are not needed
This commit is contained in:
@@ -150,55 +150,6 @@ void @(topic)_Publisher::PubListener::onPublicationMatched(Publisher* pub, Match
|
||||
}
|
||||
}
|
||||
|
||||
void @(topic)_Publisher::run()
|
||||
{
|
||||
while(m_listener.n_matched == 0)
|
||||
{
|
||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
||||
eClock::my_sleep(250); // Sleep 250 ms;
|
||||
@[else]@
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250)); // Sleep 250 ms
|
||||
@[end if]@
|
||||
}
|
||||
|
||||
// Publication code
|
||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
||||
@[ if ros2_distro]@
|
||||
@(package)::msg::dds_::@(topic)_ st;
|
||||
@[ else]@
|
||||
@(topic)_ st;
|
||||
@[ end if]@
|
||||
@[else]@
|
||||
@[ if ros2_distro]@
|
||||
@(package)::msg::@(topic) st;
|
||||
@[ else]@
|
||||
@(topic) st;
|
||||
@[ end if]@
|
||||
@[end if]@
|
||||
|
||||
/* Initialize your structure here */
|
||||
|
||||
int msgsent = 0;
|
||||
char ch = 'y';
|
||||
do
|
||||
{
|
||||
if(ch == 'y')
|
||||
{
|
||||
mp_publisher->write(&st); ++msgsent;
|
||||
std::cout << "Sending sample, count=" << msgsent << ", send another sample?(y-yes,n-stop): ";
|
||||
}
|
||||
else if(ch == 'n')
|
||||
{
|
||||
std::cout << "Stopping execution " << std::endl;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Command " << ch << " not recognized, please enter \"y/n\":";
|
||||
}
|
||||
}while(std::cin >> ch);
|
||||
}
|
||||
|
||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
||||
@[ if ros2_distro]@
|
||||
void @(topic)_Publisher::publish(@(package)::msg::dds_::@(topic)_* st)
|
||||
|
||||
@@ -179,13 +179,6 @@ void @(topic)_Subscriber::SubListener::onNewDataMessage(Subscriber* sub)
|
||||
}
|
||||
}
|
||||
|
||||
void @(topic)_Subscriber::run()
|
||||
{
|
||||
std::cout << "Waiting for Data, press Enter to stop the Subscriber. "<<std::endl;
|
||||
std::cin.ignore();
|
||||
std::cout << "Shutting down the Subscriber." << std::endl;
|
||||
}
|
||||
|
||||
bool @(topic)_Subscriber::hasMsg()
|
||||
{
|
||||
if (m_listener.n_matched > 0) {
|
||||
|
||||
Reference in New Issue
Block a user