Skip to content

Commit 09ba483

Browse files
Merge branch 'moveit:main' into main
2 parents 967f322 + 5a8ef4d commit 09ba483

File tree

30 files changed

+1226
-39
lines changed

30 files changed

+1226
-39
lines changed

.github/mergify.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ pull_request_rules:
88
branches:
99
- humble
1010

11-
- name: backport to iron at reviewers discretion
11+
- name: backport to jazzy at reviewers discretion
1212
conditions:
1313
- base=main
14-
- "label=backport-iron"
14+
- "label=backport-jazzy"
1515
actions:
1616
backport:
1717
branches:
18-
- iron
18+
- jazzy
1919

20-
- name: backport to jazzy at reviewers discretion
20+
- name: backport to kilted at reviewers discretion
2121
conditions:
2222
- base=main
23-
- "label=backport-jazzy"
23+
- "label=backport-kilted"
2424
actions:
2525
backport:
2626
branches:
27-
- jazzy
27+
- kilted
2828

2929
- name: ask to resolve conflict
3030
conditions:

.github/workflows/ci.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
# https://stackoverflow.com/a/41673702
3434
CXXFLAGS: >-
3535
-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-unknown-warning-option
36-
CLANG_TIDY_ARGS: --fix --fix-errors --format-style=file
3736
DOCKER_IMAGE: moveit/moveit2:${{ matrix.env.IMAGE }}
3837
UPSTREAM_WORKSPACE: >
3938
moveit2.repos
@@ -143,7 +142,7 @@ jobs:
143142
run: moveit_kinematics/test/test_ikfast_plugins.sh
144143
- id: ici
145144
name: Run industrial_ci
146-
uses: ros-industrial/industrial_ci@master
145+
uses: ros-industrial/industrial_ci@ba2a3d0f830f8051b356711a8df2fedfc5d256cf
147146
env: ${{ matrix.env }}
148147
# NOTE: Testspace is temporarily disabled and needs to be installed for the MoveIt org
149148
# See: https://github.com/moveit/moveit2/issues/2852

.github/workflows/tutorial_docker.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ jobs:
4646
- name: "Remove .dockerignore"
4747
run: rm .dockerignore # enforce full source context
4848
- name: Cache ccache
49-
uses: actions/cache@v4
49+
uses: actions/cache@v5
5050
with:
5151
path: .ccache
5252
key: docker-tutorial-ccache-${{ matrix.ROS_DISTRO }}-${{ hashFiles( '.docker/tutorial-source/Dockerfile' ) }}
5353
- name: inject ccache into docker
5454
uses: reproducible-containers/[email protected]
5555
with:
56-
cache-source: .ccache
57-
cache-target: /root/.ccache/
56+
cache-map: |
57+
{
58+
".ccache": "/root/.ccache/"
59+
}
5860
- name: Build and Push
5961
uses: docker/build-push-action@v6
6062
with:

moveit_core/robot_model/src/planar_joint_model.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ void PlanarJointModel::computeVariablePositions(const Eigen::Isometry3d& transf,
355355

356356
ASSERT_ISOMETRY(transf) // unsanitized input, could contain a non-isometry
357357
Eigen::Quaterniond q(transf.linear());
358+
if (q.w() < 0.0)
359+
{
360+
q.coeffs() *= -1.0;
361+
}
358362
// taken from Bullet
359363
double s_squared = 1.0 - (q.w() * q.w());
360364
if (s_squared < 10.0 * std::numeric_limits<double>::epsilon())

moveit_core/robot_model/test/test.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,38 @@ TEST(FloatingJointTest, interpolation_test)
172172
}
173173
}
174174

175+
TEST(PlanarJointTest, ComputeVariablePositionsNormalizeYaw)
176+
{
177+
// Create a simple planar joint model with some dummy parameters
178+
moveit::core::PlanarJointModel pjm("joint", 0, 0);
179+
180+
// Test various angles for normalization
181+
std::vector<double> test_angles = { 0.0, M_PI / 2, -M_PI / 2, M_PI, -M_PI, 3.0, -3.0, 4.1, -4.1 };
182+
for (double angle : test_angles)
183+
{
184+
// Create a transform with the given yaw angle
185+
Eigen::Isometry3d transform = Eigen::Isometry3d::Identity();
186+
Eigen::AngleAxisd q = Eigen::AngleAxisd(angle, Eigen::Vector3d::UnitZ());
187+
transform.linear() = q.toRotationMatrix();
188+
189+
// Compute the variable positions from the transform
190+
double joint_values[3];
191+
pjm.computeVariablePositions(transform, joint_values);
192+
193+
// Check that the x and y values are zero (since we didn't set any translation)
194+
EXPECT_NEAR(joint_values[0], 0.0, 1e-6);
195+
EXPECT_NEAR(joint_values[1], 0.0, 1e-6);
196+
197+
// The yaw value should be normalized to the range [-pi, pi]
198+
double normalized_angle = angle;
199+
while (normalized_angle > M_PI)
200+
normalized_angle -= 2.0 * M_PI;
201+
while (normalized_angle < -M_PI)
202+
normalized_angle += 2.0 * M_PI;
203+
EXPECT_NEAR(joint_values[2], normalized_angle, 1e-6);
204+
}
205+
}
206+
175207
int main(int argc, char** argv)
176208
{
177209
testing::InitGoogleTest(&argc, argv);

moveit_core/robot_trajectory/include/moveit/robot_trajectory/robot_trajectory.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ class RobotTrajectory
310310
* @param The waypoint index before the supplied duration.
311311
* @param The waypoint index after (or equal to) the supplied duration.
312312
* @param The progress (0 to 1) between the two waypoints, based on time (not based on joint distances).
313+
*
314+
* General Case:
315+
* - Usually after == before + 1, except in the edge cases listed below.
316+
* - blend 0.0 implies being exactly at the before waypoint.
317+
* - blend 1.0 implies being exactly at the after waypoint.
318+
* Edge Cases:
319+
* - Empty Trajectory: before == 0, after == 0, blend == 0.0
320+
* - Negative Duration: before == 0, after == 0, blend == 0.0
321+
* - Duration > Total Duration: before == size() - 1, after == size() - 1, blend == 1.0
322+
* - Single Waypoint Trajectory: before == 0, after == 0, blend == 1.0
313323
*/
314324
void findWayPointIndicesForDurationAfterStart(double duration, int& before, int& after, double& blend) const;
315325

moveit_core/robot_trajectory/src/robot_trajectory.cpp

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,67 @@ RobotTrajectory& RobotTrajectory::setRobotTrajectoryMsg(const moveit::core::Robo
484484
{
485485
for (std::size_t j = 0; j < trajectory.multi_dof_joint_trajectory.joint_names.size(); ++j)
486486
{
487+
const auto& joint_name = trajectory.multi_dof_joint_trajectory.joint_names[j];
487488
Eigen::Isometry3d t = tf2::transformToEigen(trajectory.multi_dof_joint_trajectory.points[i].transforms[j]);
488-
st->setJointPositions(trajectory.multi_dof_joint_trajectory.joint_names[j], t);
489+
st->setJointPositions(joint_name, t);
490+
491+
if (!trajectory.multi_dof_joint_trajectory.points[i].velocities.empty())
492+
{
493+
// Note: angular x and y are not currently supported
494+
const auto names = st->getVariableNames();
495+
496+
for (const auto& name : names)
497+
{
498+
if (name.find("/x") != std::string::npos)
499+
{
500+
st->setVariableVelocity(joint_name + "/x",
501+
trajectory.multi_dof_joint_trajectory.points[i].velocities[j].linear.x);
502+
}
503+
else if (name.find("/y") != std::string::npos)
504+
{
505+
st->setVariableVelocity(joint_name + "/y",
506+
trajectory.multi_dof_joint_trajectory.points[i].velocities[j].linear.y);
507+
}
508+
else if (name.find("/z") != std::string::npos)
509+
{
510+
st->setVariableVelocity(joint_name + "/z",
511+
trajectory.multi_dof_joint_trajectory.points[i].velocities[j].linear.z);
512+
}
513+
else if (name.find("/theta") != std::string::npos)
514+
{
515+
st->setVariableVelocity(joint_name + "/theta",
516+
trajectory.multi_dof_joint_trajectory.points[i].velocities[j].angular.z);
517+
}
518+
}
519+
}
520+
if (!trajectory.multi_dof_joint_trajectory.points[i].accelerations.empty())
521+
{
522+
// Note: angular x and y are not currently supported
523+
const auto names = st->getVariableNames();
524+
for (const auto& name : names)
525+
{
526+
if (name.find("/x") != std::string::npos)
527+
{
528+
st->setVariableAcceleration(joint_name + "/x",
529+
trajectory.multi_dof_joint_trajectory.points[i].accelerations[j].linear.x);
530+
}
531+
else if (name.find("/y") != std::string::npos)
532+
{
533+
st->setVariableAcceleration(joint_name + "/y",
534+
trajectory.multi_dof_joint_trajectory.points[i].accelerations[j].linear.y);
535+
}
536+
else if (name.find("/z") != std::string::npos)
537+
{
538+
st->setVariableAcceleration(joint_name + "/z",
539+
trajectory.multi_dof_joint_trajectory.points[i].accelerations[j].linear.z);
540+
}
541+
else if (name.find("/theta") != std::string::npos)
542+
{
543+
st->setVariableAcceleration(joint_name + "/theta",
544+
trajectory.multi_dof_joint_trajectory.points[i].accelerations[j].angular.z);
545+
}
546+
}
547+
}
489548
}
490549
this_time_stamp = rclcpp::Time(trajectory.multi_dof_joint_trajectory.header.stamp) +
491550
trajectory.multi_dof_joint_trajectory.points[i].time_from_start;
@@ -509,7 +568,7 @@ RobotTrajectory& RobotTrajectory::setRobotTrajectoryMsg(const moveit::core::Robo
509568
void RobotTrajectory::findWayPointIndicesForDurationAfterStart(double duration, int& before, int& after,
510569
double& blend) const
511570
{
512-
if (duration < 0.0)
571+
if (duration < 0.0 || waypoints_.empty())
513572
{
514573
before = 0;
515574
after = 0;
@@ -522,22 +581,22 @@ void RobotTrajectory::findWayPointIndicesForDurationAfterStart(double duration,
522581
double running_duration = 0.0;
523582
for (; index < num_points; ++index)
524583
{
525-
running_duration += duration_from_previous_[index];
584+
running_duration += duration_from_previous_.at(index);
526585
if (running_duration >= duration)
527586
break;
528587
}
529588
before = std::max<int>(index - 1, 0);
530589
after = std::min<int>(index, num_points - 1);
531590

532591
// Compute duration blend
533-
double before_time = running_duration - duration_from_previous_[index];
534592
if (after == before)
535593
{
536594
blend = 1.0;
537595
}
538596
else
539597
{
540-
blend = (duration - before_time) / duration_from_previous_[index];
598+
double before_time = running_duration - duration_from_previous_.at(index);
599+
blend = (duration - before_time) / duration_from_previous_.at(index);
541600
}
542601
}
543602

0 commit comments

Comments
 (0)