Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/toolchain-2.9' into toolchain-2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerj committed Jan 30, 2020
2 parents 75eaee6 + c65cf80 commit b01f741
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
9 changes: 9 additions & 0 deletions rtt_actionlib/include/rtt_actionlib/rtt_action_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ namespace rtt_actionlib {
//! Check if the server is ready to be started
bool ready();

//! \brief Shutdown internal timer
void shutdown();

//! \brief Set up status publishing timers
virtual void initialize();

Expand Down Expand Up @@ -168,6 +171,12 @@ namespace rtt_actionlib {
return action_bridge_.allConnected();
}

template <class ActionSpec>
void RTTActionServer<ActionSpec>::shutdown()
{
status_timer_.killTimer(0);
}

template <class ActionSpec>
bool RTTActionServer<ActionSpec>::addPorts(
RTT::Service::shared_ptr service,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ template <class ActionSpec> class RTTSimpleActionServer


/**
* Start action server in given TskContext.
* @param publish_feedback if true publish feedback periodically
* Start action server in given TaskContext.
*/
bool start(bool publish_feedback = false);
bool start();

/**
* Stop action server.
Expand Down Expand Up @@ -174,11 +173,10 @@ template <class ActionSpec> class RTTSimpleActionServer
}
};

template <class ActionSpec> bool RTTSimpleActionServer<ActionSpec>::start(bool publish_feedback)
template <class ActionSpec> bool RTTSimpleActionServer<ActionSpec>::start()
{
if (ready()) {
action_server.start();
if (publish_feedback) action_server.initialize();
return true;
}
else return false;
Expand Down
12 changes: 8 additions & 4 deletions rtt_roscomm/scripts/create_boost_header.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env python

from __future__ import print_function
from __future__ import unicode_literals

import sys

import roslib
Expand All @@ -9,7 +13,7 @@
from roslib import packages,msgs
import os

from cStringIO import StringIO
from io import StringIO

import argparse

Expand Down Expand Up @@ -92,11 +96,11 @@ def generate_boost_serialization(package, msg_path, msg_type, boost_header_path)
(output_dir,filename) = os.path.split(boost_header_path)
try:
os.makedirs(output_dir)
except OSError, e:
except OSError as e:
pass

f = open(boost_header_path, 'w')
print >> f, s.getvalue()
print(s.getvalue(), file=f)

s.close()

Expand All @@ -115,7 +119,7 @@ def create_boost_headers(argv, stdout, stderr):
if __name__ == "__main__":
try:
create_boost_headers(sys.argv, sys.stdout, sys.stderr)
except Exception, e:
except Exception as e:
sys.stderr.write("Failed to generate boost headers: " + str(e))
raise
#sys.exit(1)
16 changes: 8 additions & 8 deletions tests/rtt_roscomm_tests/test/transport_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@ TEST(TransportTest, VectorTest)
EXPECT_FALSE(in.connected());
}

static int callback_called = 0;
static std::map<int,int> callback_called;
bool callback0(std_srvs::Empty::Request&, std_srvs::Empty::Response&)
{
++callback_called;
++callback_called[0];
return true;
}

bool callback1()
{
++callback_called;
++callback_called[1];
return true;
}

void callback2()
{
++callback_called;
++callback_called[2];
}

TEST(TransportTest, ServiceServerTest)
Expand Down Expand Up @@ -180,14 +180,14 @@ TEST(TransportTest, ServiceServerTest)
EXPECT_TRUE(service_caller2.ready());

// Call the service
EXPECT_EQ(0, callback_called);
EXPECT_TRUE(callback_called.empty());
std_srvs::Empty empty;
EXPECT_TRUE(service_caller0(empty.request, empty.response));
EXPECT_EQ(1, callback_called);
EXPECT_EQ(1, callback_called[0]);
EXPECT_TRUE(service_caller1(empty.request, empty.response));
EXPECT_EQ(2, callback_called);
EXPECT_EQ(1, callback_called[1]);
EXPECT_TRUE(service_caller2(empty.request, empty.response));
EXPECT_EQ(3, callback_called);
EXPECT_EQ(1, callback_called[2]);

// Disconnect the service
EXPECT_TRUE(rosservice.lock()->disconnect(service + "0"));
Expand Down

0 comments on commit b01f741

Please sign in to comment.