Skip to content

Commit

Permalink
Merge pull request #9 from UofA-SPEAR/ayden/feature/hardware_arm
Browse files Browse the repository at this point in the history
Ayden/feature/hardware arm
  • Loading branch information
AydenBravender authored Jan 21, 2025
2 parents 0cfc796 + b351482 commit 689d5dd
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 23 deletions.
45 changes: 36 additions & 9 deletions documentation/Arm_Teleop.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
# Guide to Moveit for Teleoperation

## Install Moveit
```sudo apt install ros-humble-moveit```
```
sudo apt install ros-humble-moveit
```

```sudo apt install ros-humble-moveit-servo```
```
sudo apt install ros-humble-moveit-servo
```

## Build and Source
```colcon build```
```
colcon build
```

```source install/setup.bash```
```
source install/setup.bash
```

## Run the code

```ros2 launch teleop teleop.launch.py```
### Short Way

```ros2 launch moveit_spear servo.launch.py```
```
ros2 launch teleop arm.teleop.py
```

```ros2 launch moveit_spear demo.launch.py```

```ros2 service call /arm_servo/start_servo std_srvs/srv/Trigger {}```



Refer to this for control mapping: https://drive.google.com/file/d/1n3aWn4sJ1-WZIfTOjwfjbIYzQQzIuocr/view?usp=drive_link
### Long Way

```
ros2 launch teleop teleop.launch.py
```

```
ros2 launch moveit_spear servo.launch.py
```

```
ros2 launch moveit_spear demo.launch.py
```

```
ros2 service call /arm_servo/start_servo std_srvs/srv/Trigger {}
```



Refer to this for control mapping: https://drive.google.com/file/d/1n3aWn4sJ1-WZIfTOjwfjbIYzQQzIuocr/view?usp=drive_link

29 changes: 15 additions & 14 deletions kipp_arm/src/teleop/launch/arm.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
from launch.substitutions import LaunchConfiguration
import os
from ament_index_python.packages import get_package_share_directory
from launch.actions import TimerAction, DeclareLaunchArgument
from launch.actions import DeclareLaunchArgument, RegisterEventHandler
from launch.event_handlers import OnProcessStart
from moveit_configs_utils import MoveItConfigsBuilder
from moveit_configs_utils.launches import generate_demo_launch
import subprocess
from launch import LaunchDescription
from launch.actions import ExecuteProcess


def generate_launch_description():

param_file = os.path.join(get_package_share_directory("moveit_spear"), "config", "moveit_servo_config.yaml")

joystick_conv = TimerAction(
period=3.0,
actions=[Node(
package='teleop',
executable='SPEAR_Arm_Node',
)]
joystick_conv = Node(
package='teleop',
executable='SPEAR_Arm_Node',
)

joy_input = Node(
Expand All @@ -44,17 +43,19 @@ def generate_launch_description():
output='screen',
)


# Modified ExecuteProcess part
execute_process = ExecuteProcess(
cmd=['kipp_arm/src/teleop/launch/service.sh'],
output='screen'
)

# Initialize the LaunchDescription object
ld = LaunchDescription()
ld.add_action(joy_input)
ld.add_action(joystick_conv)
ld.add_action(demo_launch) # Adding the demo launch, which sets up RViz
ld.add_action(servo_node)

# Call the ROS2 service to start the servo
try:
subprocess.run(['ros2', 'service', 'call', '/arm_servo/start_servo', 'std_srvs/srv/Trigger', '{}'], check=True)
except subprocess.CalledProcessError as e:
print(f"Service call failed: {e}")
ld.add_action(execute_process) # Adding the execute process action

return ld
4 changes: 4 additions & 0 deletions kipp_arm/src/teleop/launch/service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Call the ROS2 service
ros2 service call /arm_servo/start_servo std_srvs/srv/Trigger {}

0 comments on commit 689d5dd

Please sign in to comment.