Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sciurus17_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ install(
# Build and install node executables
set(executable_list
gripper_control
pose_groupstate
neck_control
waist_control
pick_and_place_right_arm_waist
Expand Down
18 changes: 18 additions & 0 deletions sciurus17_examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Gazeboでサンプルプログラムを実行する場合](#gazeboでサンプルプログラムを実行する場合)
- [Examples](#examples)
- [gripper\_control](#gripper_control)
- [pose\_groustate](#pose_groupstate)
- [neck\_control](#neck_control)
- [waist\_control](#waist_control)
- [pick\_and\_place\_right\_arm\_waist](#pick_and_place_right_arm_waist)
Expand Down Expand Up @@ -103,6 +104,7 @@ ros2 launch sciurus17_examples example.launch.py example:='gripper_control' use_
`demo.launch`を実行している状態で各サンプルを実行できます。

- [gripper\_control](#gripper_control)
- [pose\_groustate](#pose_groupstate)
- [neck\_control](#neck_control)
- [waist\_control](#waist_control)
- [pick\_and\_place\_right\_arm\_waist](#pick_and_place_right_arm_waist)
Expand Down Expand Up @@ -131,6 +133,22 @@ ros2 launch sciurus17_examples example.launch.py example:='gripper_control'

---

### pose_groupstate

group_stateを使うコード例です。

SRDFファイル[sciurus17_moveit_config/config/sciurus17.srdf](../sciurus17_moveit_config/config/sciurus17.srdf)に記載されている`two_arm_init_pose`と`two_arm_push_forward_pose`の姿勢に移行します。

次のコマンドを実行します。

```sh
ros2 launch sciurus17_examples example.launch.py example:='pose_groupstate'
```

[back to example list](#examples)

---

### neck_control

首を上下左右へ動かすコード例です。
Expand Down
2 changes: 1 addition & 1 deletion sciurus17_examples/launch/example.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def generate_launch_description():
declare_example_name = DeclareLaunchArgument(
'example', default_value='gripper_control',
description=('Set an example executable name: '
'[gripper_control, neck_control, waist_control,'
'[gripper_control, pose_groupstate, neck_control, waist_control,'
'pick_and_place_right_arm_waist, pick_and_place_left_arm]')
)

Expand Down
53 changes: 53 additions & 0 deletions sciurus17_examples/src/pose_groupstate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2025 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Reference:
// https://github.com/ros-planning/moveit2_tutorials/blob
// /5c15da709e9ea8529b54b313dc570f164f9a713e/doc/examples/subframes
// /src/subframes_tutorial.cpp

#include "moveit/move_group_interface/move_group_interface.hpp"
#include "rclcpp/rclcpp.hpp"

using MoveGroupInterface = moveit::planning_interface::MoveGroupInterface;

static const rclcpp::Logger LOGGER = rclcpp::get_logger("pose_groupstate");

int main(int argc, char ** argv)
{
rclcpp::init(argc, argv);
rclcpp::NodeOptions node_options;
node_options.automatically_declare_parameters_from_overrides(true);
auto move_group_arm_node = rclcpp::Node::make_shared("move_group_arm_node", node_options);
// For current state monitor
rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(move_group_arm_node);
std::thread([&executor]() {executor.spin();}).detach();

MoveGroupInterface move_group_arm(move_group_arm_node, "two_arm_group");
move_group_arm.setMaxVelocityScalingFactor(1.0); // Set 0.0 ~ 1.0
move_group_arm.setMaxAccelerationScalingFactor(1.0); // Set 0.0 ~ 1.0

move_group_arm.setNamedTarget("two_arm_init_pose");
move_group_arm.move();

move_group_arm.setNamedTarget("two_arm_push_forward_pose");
move_group_arm.move();

move_group_arm.setNamedTarget("two_arm_init_pose");
move_group_arm.move();

rclcpp::shutdown();
return 0;
}
18 changes: 18 additions & 0 deletions sciurus17_examples_py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Gazeboでサンプルプログラムを実行する場合](#gazeboでサンプルプログラムを実行する場合)
- [Examples](#examples)
- [gripper\_control](#gripper_control)
- [pose\_groustate](#pose_groupstate)
- [neck\_control](#neck_control)
- [waist\_control](#waist_control)
- [pick\_and\_place\_right\_arm\_waist](#pick_and_place_right_arm_waist)
Expand Down Expand Up @@ -40,6 +41,7 @@ ros2 launch sciurus17_examples_py example.launch.py example:='gripper_control' u
`demo.launch`を実行している状態で各サンプルを実行できます。

- [gripper\_control](#gripper_control)
- [pose\_groustate](#pose_groupstate)
- [neck\_control](#neck_control)
- [waist\_control](#waist_control)
- [pick\_and\_place\_right\_arm\_waist](#pick_and_place_right_arm_waist)
Expand All @@ -65,6 +67,22 @@ ros2 launch sciurus17_examples_py example.launch.py example:='gripper_control'

---

### pose_groupstate

group_stateを使うコード例です。

SRDFファイル[sciurus17_moveit_config/config/sciurus17.srdf](../sciurus17_moveit_config/config/sciurus17.srdf)に記載されている`two_arm_init_pose`と`two_arm_push_forward_pose`の姿勢に移行します。

次のコマンドを実行します。

```sh
ros2 launch sciurus17_examples_py example.launch.py example:='pose_groupstate'
```

[back to example list](#examples)

---

### neck_control

首を上下左右へ動かすコード例です。
Expand Down
2 changes: 1 addition & 1 deletion sciurus17_examples_py/launch/example.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def generate_launch_description():
'example',
default_value='gripper_control',
description=('Set an example executable name: '
'[gripper_control, neck_control, waist_control, '
'[gripper_control, pose_groupstate, neck_control, waist_control, '
'pick_and_place_right_arm_waist, pick_and_place_left_arm]'))

declare_use_sim_time = DeclareLaunchArgument(
Expand Down
81 changes: 81 additions & 0 deletions sciurus17_examples_py/sciurus17_examples_py/pose_groupstate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright 2025 RT Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from moveit.planning import MoveItPy
from moveit.planning import PlanRequestParameters

import rclpy
from rclpy.logging import get_logger

from sciurus17_examples_py.utils import plan_and_execute


def main(args=None):
rclpy.init(args=args)
logger = get_logger('pose_groupstate')

# instantiate MoveItPy instance and get planning component
sciurus17 = MoveItPy(node_name='pose_groupstate')
logger.info('MoveItPy instance created')

# アーム制御用 planning component
arm = sciurus17.get_planning_component('two_arm_group')

arm_plan_request_params = PlanRequestParameters(
sciurus17,
'ompl_rrtc_default',
)

# 動作速度の調整
# Set 0.0 ~ 1.0
arm_plan_request_params.max_acceleration_scaling_factor = 1.0
arm_plan_request_params.max_velocity_scaling_factor = 1.0

# SRDFに定義されている'two_arm_init_pose'の姿勢にする
arm.set_start_state_to_current_state()
arm.set_goal_state(configuration_name='two_arm_init_pose')
plan_and_execute(
sciurus17,
arm,
logger,
single_plan_parameters=arm_plan_request_params,
)

# SRDFに定義されている'two_arm_push_forward_pose'の姿勢にする
arm.set_start_state_to_current_state()
arm.set_goal_state(configuration_name='two_arm_push_forward_pose')
plan_and_execute(
sciurus17,
arm,
logger,
single_plan_parameters=arm_plan_request_params,
)

# SRDFに定義されている'two_arm_init_pose'の姿勢にする
arm.set_start_state_to_current_state()
arm.set_goal_state(configuration_name='two_arm_init_pose')
plan_and_execute(
sciurus17,
arm,
logger,
single_plan_parameters=arm_plan_request_params,
)

# Finish with error. Related Issue
# https://github.com/moveit/moveit2/issues/2693
rclpy.shutdown()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions sciurus17_examples_py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
'pick_and_place_right_arm_waist = \
sciurus17_examples_py.pick_and_place_right_arm_waist:main',
'pick_and_place_left_arm = sciurus17_examples_py.pick_and_place_left_arm:main',
'pose_groupstate = sciurus17_examples_py.pose_groupstate:main',
],
},
)
16 changes: 16 additions & 0 deletions sciurus17_moveit_config/config/sciurus17.srdf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@
<joint name="r_arm_joint6" value="-2.0943"/>
<joint name="r_arm_joint7" value="0"/>
</group_state>
<group_state name="two_arm_push_forward_pose" group="two_arm_group">
<joint name="l_arm_joint1" value="-0.5236"/>
<joint name="l_arm_joint2" value="1.5707"/>
<joint name="l_arm_joint3" value="0"/>
<joint name="l_arm_joint4" value="-2.0944"/>
<joint name="l_arm_joint5" value="0"/>
<joint name="l_arm_joint6" value="1.0472"/>
<joint name="l_arm_joint7" value="0"/>
<joint name="r_arm_joint1" value="0.5236"/>
<joint name="r_arm_joint2" value="-1.5707"/>
<joint name="r_arm_joint3" value="0"/>
<joint name="r_arm_joint4" value="2.0944"/>
<joint name="r_arm_joint5" value="0"/>
<joint name="r_arm_joint6" value="-1.0472"/>
<joint name="r_arm_joint7" value="0"/>
</group_state>
<group_state name="neck_init_pose" group="neck_group">
<joint name="neck_pitch_joint" value="0"/>
<joint name="neck_yaw_joint" value="0"/>
Expand Down