forked from space-ros/demos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added wheel velocity and mast position control
- Loading branch information
1 parent
51c8225
commit 3ea77e8
Showing
7 changed files
with
229 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import rclpy | ||
from rclpy.node import Node | ||
from builtin_interfaces.msg import Duration | ||
|
||
from std_msgs.msg import String, Float64 | ||
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint | ||
|
||
class MastArm(Node): | ||
|
||
def __init__(self): | ||
super().__init__('mast_node') | ||
self.mast_publisher_ = self.create_publisher(JointTrajectory, '/mast_joint_trajectory_controller/joint_trajectory', 10) | ||
timer_period = 0.5 # seconds | ||
self.timer = self.create_timer(timer_period, self.timer_callback) | ||
|
||
|
||
def timer_callback(self): | ||
traj = JointTrajectory() | ||
traj.joint_names = ["mast_p_joint", "mast_02_joint", "mast_cameras_joint"] | ||
|
||
point = JointTrajectoryPoint() | ||
point.positions = [0.0,0.0,0.0] | ||
point.time_from_start = Duration(sec=1) | ||
|
||
traj.points.append(point) | ||
self.mast_publisher_.publish(traj) | ||
|
||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
|
||
mast_node = MastArm() | ||
|
||
rclpy.spin(mast_node) | ||
|
||
# Destroy the node explicitly | ||
# (optional - otherwise it will be done automatically | ||
# when the garbage collector destroys the node object) | ||
mast_node.destroy_node() | ||
rclpy.shutdown() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import rclpy | ||
from rclpy.node import Node | ||
from builtin_interfaces.msg import Duration | ||
|
||
from std_msgs.msg import String, Float64 | ||
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint | ||
|
||
class MoveWheel(Node): | ||
|
||
def __init__(self): | ||
super().__init__('wheel_node') | ||
self.wheel_publisher_ = self.create_publisher(JointTrajectory, '/wheel_velocity_controller/joint_trajectory', 10) | ||
timer_period = 0.5 # seconds | ||
self.timer = self.create_timer(timer_period, self.timer_callback) | ||
|
||
|
||
def timer_callback(self): | ||
traj = JointTrajectory() | ||
traj.joint_names = ["front_wheel_L_joint", | ||
"middle_wheel_L_joint", | ||
"back_wheel_L_joint", | ||
"front_wheel_R_joint", | ||
"middle_wheel_R_joint", | ||
"back_wheel_R_joint"] | ||
|
||
point = JointTrajectoryPoint() | ||
point.positions = [0.0,0.0,0.0,0.0,0.0,0.0] | ||
point.time_from_start = Duration(sec=1) | ||
|
||
traj.points.append(point) | ||
self.wheel_publisher_.publish(traj) | ||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
|
||
wheel_node = MoveWheel() | ||
|
||
rclpy.spin(wheel_node) | ||
|
||
# Destroy the node explicitly | ||
# (optional - otherwise it will be done automatically | ||
# when the garbage collector destroys the node object) | ||
wheel_node.destroy_node() | ||
rclpy.shutdown() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters