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 93a1a69
Show file tree
Hide file tree
Showing 6 changed files with 253 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.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_2_joint:
has_velocity_limits: true
max_velocity: 2.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_3_joint:
has_velocity_limits: true
max_velocity: 2.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_4_joint:
has_velocity_limits: true
max_velocity: 2.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
Slider11:
has_velocity_limits: true
max_velocity: 2.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_5_joint:
has_velocity_limits: true
max_velocity: 2.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
spotarm_6_joint:
has_velocity_limits: true
max_velocity: 2.1750
has_acceleration_limits: true
max_acceleration: 3.75
has_jerk_limits: false
171 changes: 162 additions & 9 deletions resource/moveit_movegroup.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,163 @@
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

planner_configs:
SBLkConfigDefault:
type: geometric::SBL
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
ESTkConfigDefault:
type: geometric::EST
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0 setup()
goal_bias: 0.05 # When close to goal select goal, with this probability. default: 0.05
LBKPIECEkConfigDefault:
type: geometric::LBKPIECE
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
border_fraction: 0.9 # Fraction of time focused on boarder default: 0.9
min_valid_path_fraction: 0.5 # Accept partially valid moves above fraction. default: 0.5
BKPIECEkConfigDefault:
type: geometric::BKPIECE
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
border_fraction: 0.9 # Fraction of time focused on boarder default: 0.9
failed_expansion_score_factor: 0.5 # When extending motion fails, scale score by factor. default: 0.5
min_valid_path_fraction: 0.5 # Accept partially valid moves above fraction. default: 0.5
KPIECEkConfigDefault:
type: geometric::KPIECE
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability. default: 0.05
border_fraction: 0.9 # Fraction of time focused on boarder default: 0.9 (0.0,1.]
failed_expansion_score_factor: 0.5 # When extending motion fails, scale score by factor. default: 0.5
min_valid_path_fraction: 0.5 # Accept partially valid moves above fraction. default: 0.5
RRTkConfigDefault:
type: geometric::RRT
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability? default: 0.05
RRTConnectkConfigDefault:
type: geometric::RRTConnect
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
RRTstarkConfigDefault:
type: geometric::RRTstar
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability? default: 0.05
delay_collision_checking: 1 # Stop collision checking as soon as C-free parent found. default 1
TRRTkConfigDefault:
type: geometric::TRRT
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability? default: 0.05
max_states_failed: 10 # when to start increasing temp. default: 10
temp_change_factor: 2.0 # how much to increase or decrease temp. default: 2.0
min_temperature: 10e-10 # lower limit of temp change. default: 10e-10
init_temperature: 10e-6 # initial temperature. default: 10e-6
frountier_threshold: 0.0 # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()
frountierNodeRatio: 0.1 # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1
k_constant: 0.0 # value used to normalize expression. default: 0.0 set in setup()
PRMkConfigDefault:
type: geometric::PRM
max_nearest_neighbors: 10 # use k nearest neighbors. default: 10
PRMstarkConfigDefault:
type: geometric::PRMstar
FMTkConfigDefault:
type: geometric::FMT
num_samples: 1000 # number of states that the planner should sample. default: 1000
radius_multiplier: 1.1 # multiplier used for the nearest neighbors search radius. default: 1.1
nearest_k: 1 # use Knearest strategy. default: 1
cache_cc: 1 # use collision checking cache. default: 1
heuristics: 0 # activate cost to go heuristics. default: 0
extended_fmt: 1 # activate the extended FMT*: adding new samples if planner does not finish successfully. default: 1
BFMTkConfigDefault:
type: geometric::BFMT
num_samples: 1000 # number of states that the planner should sample. default: 1000
radius_multiplier: 1.0 # multiplier used for the nearest neighbors search radius. default: 1.0
nearest_k: 1 # use the Knearest strategy. default: 1
balanced: 0 # exploration strategy: balanced true expands one tree every iteration. False will select the tree with lowest maximum cost to go. default: 1
optimality: 1 # termination strategy: optimality true finishes when the best possible path is found. Otherwise, the algorithm will finish when the first feasible path is found. default: 1
heuristics: 1 # activates cost to go heuristics. default: 1
cache_cc: 1 # use the collision checking cache. default: 1
extended_fmt: 1 # Activates the extended FMT*: adding new samples if planner does not finish successfully. default: 1
PDSTkConfigDefault:
type: geometric::PDST
STRIDEkConfigDefault:
type: geometric::STRIDE
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability. default: 0.05
use_projected_distance: 0 # whether nearest neighbors are computed based on distances in a projection of the state rather distances in the state space itself. default: 0
degree: 16 # desired degree of a node in the Geometric Near-neightbor Access Tree (GNAT). default: 16
max_degree: 18 # max degree of a node in the GNAT. default: 12
min_degree: 12 # min degree of a node in the GNAT. default: 12
max_pts_per_leaf: 6 # max points per leaf in the GNAT. default: 6
estimated_dimension: 0.0 # estimated dimension of the free space. default: 0.0
min_valid_path_fraction: 0.2 # Accept partially valid moves above fraction. default: 0.2
BiTRRTkConfigDefault:
type: geometric::BiTRRT
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
temp_change_factor: 0.1 # how much to increase or decrease temp. default: 0.1
init_temperature: 100 # initial temperature. default: 100
frountier_threshold: 0.0 # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()
frountier_node_ratio: 0.1 # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1
cost_threshold: 1e300 # the cost threshold. Any motion cost that is not better will not be expanded. default: inf
LBTRRTkConfigDefault:
type: geometric::LBTRRT
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability. default: 0.05
epsilon: 0.4 # optimality approximation factor. default: 0.4
BiESTkConfigDefault:
type: geometric::BiEST
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
ProjESTkConfigDefault:
type: geometric::ProjEST
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
goal_bias: 0.05 # When close to goal select goal, with this probability. default: 0.05
LazyPRMkConfigDefault:
type: geometric::LazyPRM
range: 0.0 # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
LazyPRMstarkConfigDefault:
type: geometric::LazyPRMstar
SPARSkConfigDefault:
type: geometric::SPARS
stretch_factor: 3.0 # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0
sparse_delta_fraction: 0.25 # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25
dense_delta_fraction: 0.001 # delta fraction for interface detection. default: 0.001
max_failures: 1000 # maximum consecutive failure limit. default: 1000
SPARStwokConfigDefault:
type: geometric::SPARStwo
stretch_factor: 3.0 # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0
sparse_delta_fraction: 0.25 # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25
dense_delta_fraction: 0.001 # delta fraction for interface detection. default: 0.001
max_failures: 5000 # maximum consecutive failure limit. default: 5000
move_group:
planner_configs:
- SBLkConfigDefault
- ESTkConfigDefault
- LBKPIECEkConfigDefault
- BKPIECEkConfigDefault
- KPIECEkConfigDefault
- RRTkConfigDefault
- RRTConnectkConfigDefault
- RRTstarkConfigDefault
- TRRTkConfigDefault
- PRMkConfigDefault
- PRMstarkConfigDefault
- FMTkConfigDefault
- BFMTkConfigDefault
- PDSTkConfigDefault
- STRIDEkConfigDefault
- BiTRRTkConfigDefault
- LBTRRTkConfigDefault
- BiESTkConfigDefault
- ProjESTkConfigDefault
- LazyPRMkConfigDefault
- LazyPRMstarkConfigDefault
- SPARSkConfigDefault
- SPARStwokConfigDefault
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 93a1a69

Please sign in to comment.