Multi-Robot Setup
This commit is contained in:
parent
bc48e0c35a
commit
d5e7768d90
45 changed files with 4519 additions and 861 deletions
47
rbs_skill_servers/scripts/test_cartesian_controller.py
Normal file
47
rbs_skill_servers/scripts/test_cartesian_controller.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
import rclpy
|
||||
from rclpy.node import Node
|
||||
import argparse
|
||||
|
||||
from geometry_msgs.msg import PoseStamped
|
||||
|
||||
class CartesianControllerPublisher(Node):
|
||||
|
||||
def __init__(self, robot_name: str):
|
||||
super().__init__("cartesian_controller_pose_publisher")
|
||||
self.publisher_ = self.create_publisher(
|
||||
PoseStamped,
|
||||
"/" + robot_name + "/cartesian_motion_controller/target_frame", 10)
|
||||
timer_period = 0.5 # seconds
|
||||
self.timer = self.create_timer(timer_period, self.timer_callback)
|
||||
|
||||
def timer_callback(self):
|
||||
msg = PoseStamped()
|
||||
msg.header.stamp = self.get_clock().now().to_msg()
|
||||
msg.header.frame_id = "base_link"
|
||||
msg.pose.position.x = 0.7
|
||||
msg.pose.position.y = 0.0
|
||||
msg.pose.position.z = 0.45
|
||||
msg.pose.orientation.x = 0.0
|
||||
msg.pose.orientation.y = 0.707
|
||||
msg.pose.orientation.z = 0.0
|
||||
msg.pose.orientation.w = 0.707
|
||||
|
||||
self.publisher_.publish(msg)
|
||||
|
||||
|
||||
def main(args=None):
|
||||
rclpy.init(args=args)
|
||||
|
||||
parser = argparse.ArgumentParser(description='ROS2 Minimal Publisher')
|
||||
parser.add_argument('--robot-name', type=str, default='arm0', help='Specify the robot name')
|
||||
args = parser.parse_args()
|
||||
minimal_publisher = CartesianControllerPublisher(args.robot_name)
|
||||
|
||||
rclpy.spin(minimal_publisher)
|
||||
|
||||
minimal_publisher.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue