rospy Gripper/command in python
how can I implement this command line into my python code?
rostopic pub gripper/command std_msgs/Float64 "data: 1.0"
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
how can I implement this command line into my python code?
rostopic pub gripper/command std_msgs/Float64 "data: 1.0"
Have you read the following tutorial? http://wiki.ros.org/ROS/Tutorials/Wri...
It has not been tested, but it works the same as rostopic pub gripper/command std_msgs/Float64 "data: 1.0"
, which is the following code
#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import Float64
def talker():
pub = rospy.Publisher('gripper/command', Float64, queue_size=10)
rospy.init_node('sample', anonymous=True)
rate = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
msg_data = 1.0
pub.publish(msg_data)
rate.sleep()
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass
Asked: 2020-12-07 08:49:04 -0500
Seen: 256 times
Last updated: Dec 08 '20
How can I check what middleware I am using in ros2?
How do you set namespace in a Python program?
SMACC or any other state machine for ROS2
[ROS2] CMake Error When Building the Package
Rviz ViewController 'CurrentView' unavailable
How to debug ROS2 Code with an IDE?
ROS 2 SLAM not working, 'queue is full'