182 manager->setSimulationPeriod(dt);
224 bool use_sim_time =
false;
228 RTT::log(
RTT::Error) <<
"[rtt_rosclock] Did not enable ROS simulation clock because the ROS parameter '/use_sim_time' is not set to true." <<
RTT::endlog();
boost::shared_ptr< void const > VoidConstPtr
bool useManualClock()
Set the clock source to use a manual source, i.e. call updateClock() manually.
bool updateClockInternal(const ros::Time new_time)
Update the RTT clock and SimClockActivities with a new time (see updateClock() for manually updating)...
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
static Logger * Instance(std::ostream &str=std::cerr)
virtual bool initialize()
ticks ticksChange(ticks delta)
void resetTimeService()
Re-set the RTT::os::TimeService to zero and restart logging.
static boost::shared_ptr< SimClockThread > GetInstance()
Get an instance to the singleton SimClockThread or NULL.
bool useROSClockTopic()
Set the clock source to use the ROS /clock topic.
static boost::shared_ptr< SimClockActivityManager > GetInstance()
Get an instance of the singleton if it exists, null pointer otherwise.
bool systemClockEnabled() const
SimClockSource
Simulation clock sources.
ros::Subscriber clock_subscriber_
ROS /clock topic subscriber.
ros::NodeHandle nh_
ROS NodeHandle for communication.
ROSCPP_DECL bool get(const std::string &key, std::string &s)
virtual bool isActive() const
static boost::shared_ptr< SimClockThread > Instance()
Get an instance to the singleton SimClockThread or create one.
void enableSystemClock(bool yes_no)
static void Release()
Release the singleton SimClockThread.
ticks ticksSince(ticks relativeTime) const
bool updateClock(const ros::Time new_time)
virtual ~SimClockThread()
ros::CallbackQueue callback_queue_
Custom callback queue used in this thread.
void clockMsgCallback(const rosgraph_msgs::ClockConstPtr &clock)
ROS message callback for /clock topic.
bool simTimeEnabled() const
Check if simulation time is enabled.
static boost::shared_ptr< SimClockThread > singleton
SimClockThread singleton.
Thread(int scheduler, int priority, double period, unsigned cpu_affinity, const std::string &name)
bool setClockSource(SimClockSource clock_source)
Set the simulation clock source by ID (see ClockSource enum)
const ros::Time rtt_now()
Get the current time according to RTT.
bool process_callbacks_
Keep running the thread loop if this is set to true.
Seconds secondsChange(Seconds delta)
static Logger::LogFunction endlog()
SimClockThread()
Constructor is protected, use Instance() to create and get a singleton.
RTT::os::TimeService * time_service_
Convenient pointer to RTT time service.
SimClockSource clock_source_
Current clock source.