2 basic_move_controller.py 3 LICENSE : BSD - https://raw.github.com/yujinrobot/yujin_ocs/license/LICENSE 9 import nav_msgs.msg
as nav_msgs
10 import geometry_msgs.msg
as geometry_msgs
13 def __init__(self, odom_topic='odom', cmd_vel_topic='cmd_vel'):
15 self.
_pub_cmd_vel = rospy.Publisher(cmd_vel_topic, geometry_msgs.Twist, queue_size=5)
20 self.
_odom = copy.deepcopy(msg)
23 vel = geometry_msgs.Twist()
27 self._pub_cmd_vel.publish(vel)
37 raise NotImplementedError()
53 quaternion = (self._odom.pose.pose.orientation.x, self._odom.pose.pose.orientation.y, self._odom.pose.pose.orientation.z, self._odom.pose.pose.orientation.w)
54 roll, pitch, yaw = tf.transformations.euler_from_quaternion(quaternion)
64 pos0 = copy.deepcopy(self._odom.pose.pose.position)
66 while(self.
_distance2d(pos0, self._odom.pose.pose.position) < distance):
70 pos0 = copy.deepcopy(self._odom.pose.pose.position)
72 while(self.
_distance2d(pos0, self._odom.pose.pose.position) < distance):
77 computes distance between two points 79 return math.sqrt(math.pow((p2.x - p1.x), 2) + math.pow((p2.y -p1.y), 2))
def process_odometry(self, msg)
def turn_counter_clockwise(self)
def move_at(self, v, w, t)
def __init__(self, odom_topic='odom', cmd_vel_topic='cmd_vel')
def _distance2d(self, p1, p2)
def backward(self, distance)
def forward(self, distance)