# Transfer of a msg to gazebo from ROS to control the simulated turtlebot3 [closed]

Hey,

I am new to ROS and Gazebo and just try to understand how I can control and command the turtlebot3. I followed the instructions of the common tutorial website and everything went nice. I also built up new worlds etc. Also, when I roslaunch the gazebo world and the corresponding dqn file (for Reinforcement Learning and controlling), a cmd_vel topic is used which is published by the dqn node and subscribed by Gazebo.

Node Overview: C:\fakepath\Bildschirmfoto vom 2019-06-12 13-28-26.png

Here I get two questions. The topic only contains data for linear and angular position

self.pub_cmd_vel = rospy.Publisher('cmd_vel', Twist, queue_size=5)


Twist contains:

marcel@marcel-macbookpro:~\$ rosmsg show geometry_msgs/Twist
geometry_msgs/Vector3 linear
float64 x
float64 y
float64 z
geometry_msgs/Vector3 angular
float64 x
float64 y
float64 z


Anyway, this topic is filled with velocity informations and subscribed by gazebo to control the robot:

def cmd_vel(self, action):
max_angular_vel = 1.5
ang_vel = ((self.action_size - 1)/2 - action) * max_angular_vel * 0.5

vel_cmd = Twist()
vel_cmd.linear.x = 0.15
vel_cmd.angular.z = ang_vel
self.pub_cmd_vel.publish(vel_cmd)


My two big questions are now, how can Twist be filled with velocity information and how is gazebo using this information to control the turtlebot. I mean, there is no node between the dqn_node and gazebo that translates those linear and angular information in roation for the wheels i.e.. Is Gazebo doing this by itself?

Thanks for your help!

edit retag reopen merge delete