Skip to content

Commit

Permalink
moveit2 changes for jazzy
Browse files Browse the repository at this point in the history
test moveit2 only for now
  • Loading branch information
skpawar1305 committed Jun 10, 2024
1 parent 72d406d commit 6a31052
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 39 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test_ros2_jazzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,18 @@ jobs:
sudo rosdep init
rosdep update
sudo apt install -y libunwind-dev # Nav2 dependency
rosdep install --from-paths src --ignore-src -r -y
sudo apt install -y ros-jazzy-vision-msgs
rosdep install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y --skip-keys webots_ros2 --skip-keys moveit
vcs import --recursive src --skip-existing --input src/webots_ros2_spot/webots_ros2_spot.repos
chmod +x src/webots_ros2/webots_ros2_driver/webots_ros2_driver/ros2_supervisor.py
- name: MoveIt2 Dependencies
run: |
cd ~/ros2_ws/src
mkdir moveit
cd moveit
git clone https://github.com/moveit/moveit2.git -b main
for repo in moveit2/moveit2.repos $(f="moveit2/moveit2_$ROS_DISTRO.repos"; test -r $f && echo $f); do vcs import < "$repo"; done
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
- name: Build Packages
run: |
cd ~/ros2_ws
Expand Down
7 changes: 6 additions & 1 deletion launch/moveit_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ def load_yaml(filename):
# Check if moveit is installed
if "moveit" in get_packages_with_prefixes():
# Configuration
description = {"robot_description": load_file("spot.urdf")}
description = {"robot_description": load_file("spotarm.urdf")}
description_semantic = {
"robot_description_semantic": load_file("moveit_spot_arm.srdf")
}
description_kinematics = {
"robot_description_kinematics": load_yaml("moveit_kinematics.yaml")
}
description_joint_limits = {
"robot_description_planning": load_yaml("moveit_joint_limits.yaml")
}
sim_time = {"use_sim_time": True}

# Rviz node
Expand All @@ -71,6 +74,7 @@ def load_yaml(filename):
description,
description_semantic,
description_kinematics,
description_joint_limits,
sim_time,
],
condition=launch.conditions.IfCondition(use_rviz),
Expand All @@ -93,6 +97,7 @@ def load_yaml(filename):
description,
description_semantic,
description_kinematics,
description_joint_limits,
moveit_controllers,
movegroup,
sim_time,
Expand Down
47 changes: 47 additions & 0 deletions resource/moveit_joint_limits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# joint_limits.yaml allows the dynamics properties specified in the URDF to be overwritten or augmented as needed
# Specific joint properties can be changed with the keys [max_position, min_position, max_velocity, max_acceleration]
# Joint limits can be turned off with [has_velocity_limits, has_acceleration_limits, has_jerk_limits]

joint_limits:
spotarm_1_joint:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_2_joint:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_3_joint:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_4_joint:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
Slider11:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_5_joint:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_6_joint:
has_velocity_limits: true
max_velocity: 2.5
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
23 changes: 14 additions & 9 deletions resource/moveit_movegroup.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
planning_plugin: ompl_interface/OMPLPlanner
start_state_max_bounds_error: 0.1
planning_plugins:
- ompl_interface/OMPLPlanner
fix_start_state: True
jiggle_fraction: 0.05
request_adapters: >-
default_planner_request_adapters/AddTimeOptimalParameterization
default_planner_request_adapters/ResolveConstraintFrames
default_planner_request_adapters/FixWorkspaceBounds
default_planner_request_adapters/FixStartStateBounds
default_planner_request_adapters/FixStartStateCollision
default_planner_request_adapters/FixStartStatePathConstraints
# To optionally use Ruckig for jerk-limited smoothing, add this line to the request adapters below
# default_planning_request_adapters/AddRuckigTrajectorySmoothing
request_adapters:
- default_planning_request_adapters/ResolveConstraintFrames
- default_planning_request_adapters/ValidateWorkspaceBounds
- default_planning_request_adapters/CheckStartStateBounds
- default_planning_request_adapters/CheckStartStateCollision
response_adapters:
- default_planning_response_adapters/AddTimeOptimalParameterization
- default_planning_response_adapters/ValidateSolution
- default_planning_response_adapters/DisplayMotionPath
54 changes: 27 additions & 27 deletions tests/test_webots_nav2.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,33 +141,33 @@ def setUp(self):
self.__node = rclpy.create_node("driver_tester")
self.wait_for_clock(self.__node, messages_to_receive=20)

def testNav2Goal(self):
from nav2_msgs.action import NavigateToPose

# Delay before publishing goal position (navigation initialization can be long in the CI)
goal_action = ActionClient(self.__node, NavigateToPose, "navigate_to_pose")
goal_message = NavigateToPose.Goal()
goal_message.pose.header.stamp = self.__node.get_clock().now().to_msg()
goal_message.pose.header.frame_id = "map"
goal_message.pose.pose.position.x = 1.2
self.__node.get_logger().info(
"Server is ready, waiting 10 seconds to send goal position."
)
goal_action.wait_for_server()
self.wait_for_clock(self.__node, messages_to_receive=1000)
goal_action.send_goal_async(goal_message)
self.__node.get_logger().info("Goal position sent.")

def on_message_received(message):
return message.pose.pose.position.x > 0.5

self.wait_for_messages(
self.__node,
Odometry,
"/Spot/odometry",
condition=on_message_received,
timeout=60 * 5,
)
# def testNav2Goal(self):
# from nav2_msgs.action import NavigateToPose

# # Delay before publishing goal position (navigation initialization can be long in the CI)
# goal_action = ActionClient(self.__node, NavigateToPose, "navigate_to_pose")
# goal_message = NavigateToPose.Goal()
# goal_message.pose.header.stamp = self.__node.get_clock().now().to_msg()
# goal_message.pose.header.frame_id = "map"
# goal_message.pose.pose.position.x = 1.2
# self.__node.get_logger().info(
# "Server is ready, waiting 10 seconds to send goal position."
# )
# goal_action.wait_for_server()
# self.wait_for_clock(self.__node, messages_to_receive=1000)
# goal_action.send_goal_async(goal_message)
# self.__node.get_logger().info("Goal position sent.")

# def on_message_received(message):
# return message.pose.pose.position.x > 0.5

# self.wait_for_messages(
# self.__node,
# Odometry,
# "/Spot/odometry",
# condition=on_message_received,
# timeout=60 * 5,
# )

def tearDown(self):
self.__node.destroy_node()
2 changes: 1 addition & 1 deletion webots_spot/retract_manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def increment_count(_):
math.radians(179),
math.radians(170),
0.0,
0.0,
0.01,
math.radians(11),
0.0,
]
Expand Down

0 comments on commit 6a31052

Please sign in to comment.