Skip to content
Snippets Groups Projects
Commit 3e10712a authored by Emil Harlan's avatar Emil Harlan
Browse files

a

parent 1c208e1e
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,6 @@ from rclpy.node import Node
from rclpy.node import Node
x, y, z = 0, 0, 0
ep_chassis = None
def quaternion_from_euler(ai, aj, ak):
......@@ -60,33 +59,18 @@ def sub_position_handler(position_info):
class vel_from_ros_node(Node):
def __init__(self):
def __init__(self, my_ep_chassis):
super().__init__("vel_from_ros")
self.my_ep_chassis = my_ep_chassis
self.get_vel_from_ros_ = self.create_subscription(
Twist, "/cmd_vel", self.pose_callback, 10)
def pose_callback(self, msg: Twist):
if(msg.angular.z == 0.0 and msg.linear.x == 0.0 and msg.linear.y == 0.0):
ep_chassis.drive_speed(x = 0, y = 0, z = 0.5)
self.my_ep_chassis.drive_speed(x = 0, y = 0, z = 0.5)
else:
ep_chassis.drive_speed(x = msg.linear.x, y = msg.linear.y, z = msg.angular.z)
if __name__ == '__main__':
ep_robot = robot.Robot()
ep_robot.initialize(conn_type="rndis")
ep_chassis = ep_robot.chassis
#ep_chassis.sub_position(freq=10, callback=sub_position_handler)
rclpy.init()
node = vel_from_ros_node()
rclpy.spin(node)
rclpy.shutdown()
ep_robot.close()
self.my_ep_chassis.drive_speed(x = msg.linear.x, y = msg.linear.y, z = msg.angular.z)
def main():
ep_robot = robot.Robot()
......@@ -96,7 +80,7 @@ def main():
ep_chassis.sub_position(freq=10, callback=sub_position_handler)
rclpy.init()
node = vel_from_ros_node()
node = vel_from_ros_node(ep_chassis)
rclpy.spin(node)
rclpy.shutdown()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment