Skip to content

Commit 12c5456

Browse files
authored
Add pre-commit hooks and BSD 3-Clause license (#51)
* Add pre-commit and license * Exclude xacro * Remove duplicate license
1 parent 9323099 commit 12c5456

File tree

96 files changed

+480
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+480
-156
lines changed

.codespell-ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ser

.github/LICENSE_HEADER.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Copyright (c) 2024, Personal Robotics Laboratory
2+
License: BSD 3-Clause. See LICENSE.md file in root directory.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Description
2+
3+
\[TODO: describe, in-detail, what issue this PR addresses and how it addresses it. Link to relevant Github Issues.\]
4+
5+
# Testing procedure
6+
7+
\[TODO: describe, in-detail, how you tested this. The procedure must be detailed enough for the reviewer(s) to recreate it.\]
8+
9+
# Before opening a pull request
10+
11+
- \[ \] `pre-commit run --all-files`
12+
- \[ \] Run your code through [pylint](https://pylint.readthedocs.io/en/latest/). `pylint --recursive=y --rcfile=.pylintrc .`. All warnings but `fixme` must be addressed.
13+
14+
# Before Merging
15+
16+
- \[ \] `Squash & Merge`

.github/workflows/pre-commit.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) 2024, Personal Robotics Laboratory
2+
# License: BSD 3-Clause. See LICENSE.md file in root directory.
3+
4+
name: pre-commit
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- master
11+
- ros2-devel
12+
pull_request:
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
17+
cancel-in-progress: true
18+
19+
env:
20+
PYTHON_VERSION: "3.10"
21+
22+
jobs:
23+
pre-commit:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ env.PYTHON_VERSION }}
30+
31+
## Run pre-commit and try to apply fixes
32+
- name: Run pre-commit
33+
uses: pre-commit/[email protected]
34+
- name: Apply fixes from pre-commit
35+
uses: pre-commit-ci/[email protected]
36+
if: always()
37+
# - name: Install dependencies
38+
# run: |
39+
# python -m pip install --upgrade pip
40+
# pip install --force-reinstall pylint==3.1.0
41+
# pip install overrides
42+
# - name: Analysing the code with pylint
43+
# run: |
44+
# pylint --recursive=y --rcfile=.pylintrc . --disable fixme --disable import-error

.pre-commit-config.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.5.0
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-case-conflict
10+
- id: check-executables-have-shebangs
11+
- id: check-merge-conflict
12+
- id: check-shebang-scripts-are-executable
13+
- id: check-symlinks
14+
- id: check-xml
15+
- id: check-yaml
16+
- id: debug-statements
17+
- id: destroyed-symlinks
18+
- id: detect-private-key
19+
- id: end-of-file-fixer
20+
- id: mixed-line-ending
21+
- id: requirements-txt-fixer
22+
- id: trailing-whitespace
23+
24+
- repo: https://github.com/Lucas-C/pre-commit-hooks
25+
rev: v1.5.0
26+
hooks:
27+
- id: insert-license
28+
args:
29+
- --license-file
30+
- .github/LICENSE_HEADER.md
31+
- --use-current-year
32+
types_or: [python, yaml]
33+
34+
- repo: https://github.com/Lucas-C/pre-commit-hooks
35+
rev: v1.5.0
36+
hooks:
37+
- id: insert-license
38+
args:
39+
- --license-file
40+
- .github/LICENSE_HEADER.md
41+
- --use-current-year
42+
- --comment-style
43+
- "<!--| |-->"
44+
types_or: [xml]
45+
exclude: ".*package\\.xml$|.*\\.xacro$"
46+
47+
- repo: https://github.com/psf/black
48+
rev: 23.1.0
49+
hooks:
50+
- id: black
51+
52+
- repo: https://github.com/lovesegfault/beautysh
53+
rev: v6.2.1
54+
hooks:
55+
- id: beautysh
56+
57+
- repo: https://github.com/executablebooks/mdformat
58+
rev: 0.7.16
59+
hooks:
60+
- id: mdformat
61+
args:
62+
- --number
63+
64+
- repo: https://github.com/codespell-project/codespell
65+
rev: v2.2.4
66+
hooks:
67+
- id: codespell
68+
args:
69+
- --ignore-words=.codespell-ignore

.pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,4 +643,3 @@ init-import=no
643643
# List of qualified module names which can have objects that can redefine
644644
# builtins.
645645
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
646-

LICENSE renamed to LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2023, Personal Robotics Laboratory
3+
Copyright (c) 2024, Personal Robotics Laboratory
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
11
# ada_ros2
2+
23
ROS2 Hardware Interface and Description for the ADA Robot
34

45
## Setup
56

67
See the [`ada_feeding` top-level README for setup instructions](https://github.com/personalrobotics/ada_feeding/blob/ros2-devel/README.md).
78

89
## Running ADA MoveIt
10+
911
### RVIZ
12+
1013
1. Run `ros2 launch ada_moveit demo.launch.py sim:=mock` command from your ROS2 workspace.
1114
2. See here for a [brief guide to using RVIZ to interact with MoveIt](https://moveit.picknik.ai/humble/doc/tutorials/quickstart_in_rviz/quickstart_in_rviz_tutorial.html).
1215

1316
### Real
17+
1418
1. Run `ros2 launch ada_moveit demo.launch.py` command from your ROS2 workspace. If running for feeding specifically (i.e., where the watchdog dying kills the controllers) run `ros2 launch ada_moveit demo_feeding.launch.py`. Make sure the watchdog is running before you launch this node.
1519

1620
### MoveIt Servo
1721

18-
MoveIt Servo allows [real-time arm servoing](https://moveit.picknik.ai/humble/doc/examples/realtime_servo/realtime_servo_tutorial.html) in cartesian space by sending twist commands to the end effector.
22+
MoveIt Servo allows [real-time arm servoing](https://moveit.picknik.ai/humble/doc/examples/realtime_servo/realtime_servo_tutorial.html) in cartesian space by sending twist commands to the end effector.
1923

2024
To use Servo with keyboard teleop:
25+
2126
1. Launch the force-torque sensor:
22-
1. Sim: `ros2 run ada_feeding dummy_ft_sensor.py`
23-
2. Real: `ros2 run forque_sensor_hardware forque_sensor_hardware`
27+
1. Sim: `ros2 run ada_feeding dummy_ft_sensor.py`
28+
2. Real: `ros2 run forque_sensor_hardware forque_sensor_hardware`
2429
2. Launch MoveIt:
25-
1. Sim:`ros2 launch ada_moveit demo.launch.py sim:=mock`
26-
2. Real: `ros2 launch ada_moveit demo.launch.py`
30+
1. Sim:`ros2 launch ada_moveit demo.launch.py sim:=mock`
31+
2. Real: `ros2 launch ada_moveit demo.launch.py`
2732
3. Re-tare the F/T sensor: `ros2 service call /wireless_ft/set_bias std_srvs/srv/SetBool "{data: true}"`
2833
4. Enable MoveIt Servo:
29-
1. Switch Controllers: `ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: [\"jaco_arm_servo_controller\"], deactivate_controllers: [\"jaco_arm_controller\"], start_controllers: [], stop_controllers: [], strictness: 0, start_asap: false, activate_asap: false, timeout: {sec: 0, nanosec: 0}}"`
30-
2. Toggle Servo On: `ros2 service call /servo_node/start_servo std_srvs/srv/Trigger "{}"`
34+
1. Switch Controllers: `ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: [\"jaco_arm_servo_controller\"], deactivate_controllers: [\"jaco_arm_controller\"], start_controllers: [], stop_controllers: [], strictness: 0, start_asap: false, activate_asap: false, timeout: {sec: 0, nanosec: 0}}"`
35+
2. Toggle Servo On: `ros2 service call /servo_node/start_servo std_srvs/srv/Trigger "{}"`
3136
5. Run the keyboard teleop script: `ros2 run ada_moveit ada_keyboard_teleop.py`
3237
6. Follow the on-screen instructions to teleoperate the robot. Note that although cartesian control avoids obstacles in the planning scene, joint control does not.
3338
7. Toggle Servo Off: `ros2 service call /servo_node/stop_servo std_srvs/srv/Trigger "{}"`
3439

3540
To create your own Servo client:
41+
3642
1. Follow steps 1-4 above.
3743
2. Have your client publish Twist commands to `/servo_node/delta_twist_cmds`. Note the following:
38-
1. For reliable cartesian control when sending angular velocities on the real robot and `lovelace`, ensure the angular velocity is <= 0.3 rad/s in magnitude. Greater angular velocities might change the end effector's position in addition to its orientation. We believe this is because of latencies with MoveIt Servo getting the robot's joint states via the joint state publisher.
39-
2. Be sure to send 0-velocity Twist messages at the end to stop the robot.
44+
1. For reliable cartesian control when sending angular velocities on the real robot and `lovelace`, ensure the angular velocity is \<= 0.3 rad/s in magnitude. Greater angular velocities might change the end effector's position in addition to its orientation. We believe this is because of latencies with MoveIt Servo getting the robot's joint states via the joint state publisher.
45+
2. Be sure to send 0-velocity Twist messages at the end to stop the robot.
4046

4147
## Camera Calibration
4248

ada_calibrate_camera/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# ada_camera_calibration
22

33
This file contains a nodes to do the following:
4+
45
1. Calibrate ADA's eye-in-hand system's extrinsics (run every time the eye-in-hand system changes);
56
2. Publish the transform between ADA's end-effector and the camera (run every time the robot is used with perception).
67

78
## Calibrating the Camera's Extrinsics
9+
810
1. Be in the `src` directory of your workspace.
911
2. `python3 src/ada_ros2/ada_calibrate_camera/calibrate_camera_start.py`
1012
3. `screen -r calibrate`
11-
1. (See here for relevant [`screen`` commands](https://gist.github.com/jctosta/af918e1618682638aa82))
13+
1. (See here for relevant [\`screen\`\` commands](https://gist.github.com/jctosta/af918e1618682638aa82))
1214
4. Follow the instructions on-screen. (Motions are expected to take ~6 mins and collect up to 30 samples)
1315
5. Once it is done, verify it:
14-
1. Re-build your workspace.
15-
2. Run `ros2 launch ada_moveit demo.launch.py sim:=mock`
16-
3. In RVIZ, add an axis for `camera_color_optical_frame`
17-
4. Verify it looks like the frame is correct.
16+
1. Re-build your workspace.
17+
2. Run `ros2 launch ada_moveit demo.launch.py sim:=mock`
18+
3. In RVIZ, add an axis for `camera_color_optical_frame`
19+
4. Verify it looks like the frame is correct.
1820

1921
## Publishing the Transform
22+
2023
1. `ros2 launch ada_calibrate_camera publish_camera_extrinsics_launch.xml` (this is done by default in the `ada_moveit` launchfile).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Copyright (c) 2024, Personal Robotics Laboratory
2+
# License: BSD 3-Clause. See LICENSE.md file in root directory.

0 commit comments

Comments
 (0)