now = rospy.Time.now()
now = rospy.get_rostime()
rospy.loginfo("Current time %i %i", now.secs, now.nsecs)
now = rospy.get_time()
rospy.loginfo("Current time %s", now)
# sleep for 10 seconds
rospy.sleep(10.)
# sleep for duration
d = rospy.Duration(10, 0)
rospy.sleep(d)
all_names = rospy.get_param_names()
global_name = rospy.get_param("/global_name")
relative_name = rospy.get_param("relative_name")
private_param = rospy.get_param('~private_name')
default_param = rospy.get_param('default_param', 'default_value')
# fetch a group (dictionary) of parameters
gains = rospy.get_param('gains')
p, i, d = gains['P'], gains['I'], gains['D']
def my_callback(event):
print 'Timer called at ' + str(event.current_real)
rospy.Timer(rospy.Duration(2), my_callback)
rospy.wait_for_service('add_two_ints')
add_two_ints = rospy.ServiceProxy('add_two_ints', AddTwoInts)
try:
resp1 = add_two_ints(x, y)
except rospy.ServiceException as exc:
print("Service did not process request: " + str(exc))
#type(pose) = geometry_msgs.msg.Pose
quaternion = (
pose.orientation.x,
pose.orientation.y,
pose.orientation.z,
pose.orientation.w)
euler = tf.transformations.euler_from_quaternion(quaternion)
roll = euler[0]
pitch = euler[1]
yaw = euler[2]
quaternion = tf.transformations.quaternion_from_euler(roll, pitch, yaw)
#type(pose) = geometry_msgs.msg.Pose
pose.orientation.x = quaternion[0]
pose.orientation.y = quaternion[1]
pose.orientation.z = quaternion[2]
pose.orientation.w = quaternion[3]