Class Duration

ROS data class to handle time intervals and durations

Metamethods

Duration:__init (_1[, _2]) Construct a time duration

Methods

Duration:cdata () Get the underlying data structure
Duration:clone () Creates a deep copy of the object
Duration:set (_1[, _2]) Set the time value
Duration:get () Get the time value as seconds and nanoseconds
Duration:assign (other) Assign operation
Duration:get_sec () Get the seconds part of the stored duration
Duration:set_sec (sec) Set duration in seconds
Duration:get_nsec () Get the nanoseconds part of the stored duration
Duration:set_nsec (nsec) Set the nanoseconds part of the duration
Duration:add (other[, result]) Add two durations and return the result
Duration:sub (other[, result]) Substract a duration from this and return the result
Duration:mul (factor[, result]) Multiply a duration to this and return the result
Duration:toSec () Converts the stored duration to seconds with fractional part
Duration:fromSec (sec) Stores a (fractional) number of seconds in this data structure
Duration:isZero () Check if the Duration is zero
Duration:sleep () Sleep for the (fractional) number of seconds stored in this data structure


Metamethods

Duration:__init (_1[, _2])
Construct a time duration

Parameters:

  • _1 number or ros.Duration If number: time duration in secons, fractional number possible
  • _2 number If present, _1 represends the seconds and _2 represends the nanoseconds (optional)

Methods

Duration:cdata ()
Get the underlying data structure

Returns:

Duration:clone ()
Creates a deep copy of the object

Returns:

    A copy of the object
Duration:set (_1[, _2])
Set the time value

Parameters:

  • _1 number or ros.Duration If number: time duration in secons, fractional number possible
  • _2 number If present, _1 represends the seconds and _2 represends the nanoseconds (optional)
Duration:get ()
Get the time value as seconds and nanoseconds

Returns:

  1. number seconds
  2. number nanoseconds
Duration:assign (other)
Assign operation

Parameters:

  • other ros.Duration Instance to set the values from
Duration:get_sec ()
Get the seconds part of the stored duration

Returns:

    number seconds
Duration:set_sec (sec)
Set duration in seconds

Parameters:

  • sec number seconds
Duration:get_nsec ()
Get the nanoseconds part of the stored duration

Returns:

    number nanoseconds
Duration:set_nsec (nsec)
Set the nanoseconds part of the duration

Parameters:

  • nsec number nanoseconds
Duration:add (other[, result])
Add two durations and return the result

Parameters:

  • other number or ros:Duration The value to add, either the number of seconds (fractional numbers possible) or a ros:Duration
  • result ros:Duration If presend, the sum is assigned to result. Otherwise the operation is performed inplace. (optional)
Duration:sub (other[, result])
Substract a duration from this and return the result

Parameters:

  • other number or ros:Duration The value to substract, either the number of seconds (fractional numbers possible) or a ros:Duration
  • result ros:Duration If presend, the difference is assigned to result. Otherwise the operation is performed inplace. (optional)
Duration:mul (factor[, result])
Multiply a duration to this and return the result

Parameters:

  • factor number or ros:Duration The value to multiply with, either the number of seconds (fractional numbers possible) or a ros:Duration
  • result ros:Duration If presend, the product is assigned to result. Otherwise the operation is performed inplace. (optional)
Duration:toSec ()
Converts the stored duration to seconds with fractional part

Returns:

    number Number of seconds
Duration:fromSec (sec)
Stores a (fractional) number of seconds in this data structure

Parameters:

  • sec number Number of seconds
Duration:isZero ()
Check if the Duration is zero

Returns:

    bool
Duration:sleep ()
Sleep for the (fractional) number of seconds stored in this data structure
generated by LDoc 1.4.3 Last updated 2016-06-18 21:52:32