ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Reulix's profile - activity

2018-10-12 02:51:10 -0500 received badge  Famous Question (source)
2018-09-06 04:47:17 -0500 commented answer How can I publish Twist messages to /gazebo node(amcl_demo.launch)

I did it!😄

2018-09-06 04:39:54 -0500 marked best answer How can I publish Twist messages to /gazebo node(amcl_demo.launch)

Hello! I'm runnning TurtleBot on rviz, and I want to publish Twist messages to the "/gazebo" node in order to control robot's velocity.

I wrote a publisher as below but it didn't work.
How can I solve this ploblem? Could you tell me please?

my code↓↓

#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
def callback(data):
    pub=rospy.Publisher("/gazebo",Twist,queue_size=10)
    vel_msg=Twist()
    print(data.linear.x,data.angular.z)
    vel_msg.linear.x=0
    vel_msg.angular.z=0
    pub.publish(vel_msg)

def main():
    rospy.init_node("GetVelocity")
    sub=rospy.Subscriber("/mobile_base/commands/velocity",Twist,callback)
    rospy.spin()

if __name__== "__main__":
    try:
        main()
    except rospy.ROSInterruptException:
        pass

rqt_graph Image↓↓(while running "amcl_demo.launch"&"rviz"&"turtlebot_world.launch"&"above code")
rqt_graph(red arrow in this picture shows what I want to do)

2018-09-06 04:39:54 -0500 received badge  Scholar (source)
2018-09-06 04:05:17 -0500 received badge  Notable Question (source)
2018-09-06 04:05:13 -0500 commented answer How can I publish Twist messages to /gazebo node(amcl_demo.launch)

I made a Publisher in main function, set it to publish Twist topics to /mobile_base/commands velocity as you said, and I

2018-09-06 03:35:13 -0500 commented answer How can I publish Twist messages to /gazebo node(amcl_demo.launch)

Thank you for your quick reply!! Yes, subscriber isn't needed for this purpose, but I just wanted to check how TurtleBot

2018-09-06 03:35:02 -0500 commented answer How can I publish Twist messages to /gazebo node(amcl_demo.launch)

Thank you for your quick reply!! Yes, subscriber isn't needed for this purpose, but I just wanted to check how TurtleBot

2018-09-06 03:32:32 -0500 commented answer How can I publish Twist messages to /gazebo node(amcl_demo.launch)

Thank you for your quick reply!! Yes, subscriber isn't needed for this purpose, but I just wanted to check code would wo

2018-09-06 03:23:13 -0500 received badge  Popular Question (source)
2018-09-06 03:21:29 -0500 commented question How can I publish Twist messages to /gazebo node(amcl_demo.launch)

Yes, sure. Here you are! all nodes

2018-09-06 02:02:05 -0500 asked a question How can I publish Twist messages to /gazebo node(amcl_demo.launch)

How can I publish Twist messages to /gazebo node(amcl_demo.launch) Hello! I'm runnning TurtleBot on rviz, and I want to