color=Color.pickFromPalette(2), transform=PyKDL.Frame(PyKDL.Vector(-2.0, 0, 0)) ) # Cone2 Frame cone_2_frame = PyKDL.Frame(PyKDL.Vector(2.0, 0, 0)) while node.isActive(): # Update Cone2 Pose getting stored Object cone_2_frame.M.DoRotZ(0.02) scene.getObjectByName("cone2").setTransform(cone_2_frame) # Update Cone1 Pose overwriting old Object scene.createCone(name="cone1", transform=PyKDL.Frame( PyKDL.Vector( 0.0, 0.0, math.sin(1.0+2*math.pi*1.0*node.getCurrentTimeInSecs()) ) )) # Publish World Frame node.broadcastTransform(PyKDL.Frame(), "world", "base", node.getCurrentTime()) # Update Scene scene.show() # Node Forward node.tick()
#!/usr/bin/env python # -*- encoding: utf-8 -*- from superros.comm import RosNode from std_msgs.msg import Float32 import math node = RosNode("sin") node.setHz(node.setupParameter("hz", 30)) node.createPublisher("in", Float32) node.createPublisher("in2", Float32) node.createPublisher("in3", Float32) while node.isActive(): data = Float32(math.sin(2 * 3.14 * 1.0 * node.getCurrentTimeInSecs())) data2 = Float32(math.sin(2 * 3.14 * 2.0 * node.getCurrentTimeInSecs())) data3 = Float32(math.sin(2 * 3.14 * 3.0 * node.getCurrentTimeInSecs())) node.getPublisher("in").publish(data) node.getPublisher("in2").publish(data2) node.getPublisher("in3").publish(data3) node.tick()
#!/usr/bin/env python # -*- encoding: utf-8 -*- from superros.comm import RosNode from std_msgs.msg import Float32 import math node = RosNode("math_publisher_sin") node.setHz(node.setupParameter("hz", 30)) topic_name = node.setupParameter("topic_name", "math_publisher_sin") frequency = node.setupParameter("frequency", 1.0) node.createPublisher(topic_name, Float32) while node.isActive(): data = Float32( math.sin(2 * math.pi * frequency * node.getCurrentTimeInSecs())) node.getPublisher(topic_name).publish(data) node.tick()