Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Refactoring code to be more modular #125

Closed
wants to merge 90 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
b1eb4c0
Add unit tests (#1)
jeremysee2 Feb 24, 2023
0757fd7
Add unit tests (#1)
jeremysee2 Feb 24, 2023
bade44f
Merge branch 'master' of github.com:jeremysee2/spot_ros
jeremysee2 Feb 24, 2023
b602674
Ros module tests (#2)
jeremysee2 Mar 6, 2023
2ff4d31
spot_check service (#6)
jeremysee2 Mar 8, 2023
0bd58d8
Add VLP-16 LIDAR Support (#7)
jeremysee2 Mar 10, 2023
a8ee254
Merge branch 'master' of https://github.com/heuristicus/spot_ros into…
jeremysee2 Mar 10, 2023
8b95cf9
remove repeated merge pointcloud
jeremysee2 Mar 10, 2023
453ca78
remove repeated imports
jeremysee2 Mar 10, 2023
bdeb22e
Merge pull request #9 from jeremysee2/sync-with-upstream
jeremysee2 Mar 10, 2023
1b6e5a5
Merge branch 'feature/grasp_service' into feature/pick-service
jeremysee2 Mar 10, 2023
e1324ce
Merge branch 'master' of https://github.com/heuristicus/spot_ros into…
jeremysee2 Mar 10, 2023
c49067d
cleanup
jeremysee2 Mar 10, 2023
92239d0
added typing
jeremysee2 Mar 10, 2023
0ea15ed
point to spot_arm project
jeremysee2 Mar 10, 2023
21f0d5f
added grasp_3d service ros unit testing
jeremysee2 Mar 12, 2023
82642f1
Merge pull request #11 from jeremysee2/feature/pick-service
jeremysee2 Mar 13, 2023
0fde641
Add docker export (#12)
jeremysee2 Mar 15, 2023
4c365e6
Merge branch 'master' of https://github.com/heuristicus/spot_ros into…
jeremysee2 Mar 15, 2023
25f8d87
add tests for Dock Action
jeremysee2 Mar 15, 2023
8b63482
black formatter
jeremysee2 Mar 15, 2023
857a32c
Merge pull request #14 from jeremysee2/sync-with-upstream
jeremysee2 Mar 15, 2023
02e3ee7
Added WorldObjectService to retrieve world objects (e.g. fiducials)
jeremysee2 Mar 16, 2023
68f0321
run docker build only on push to master
jeremysee2 Mar 16, 2023
99dd2f6
WorldObjectClient ROS unit testing
jeremysee2 Mar 16, 2023
0234280
add worldobjecttask to async tasks
jeremysee2 Mar 17, 2023
2a5d7f2
testing with real data blob
jeremysee2 Mar 18, 2023
c90d82a
remove pkl test
jeremysee2 Mar 18, 2023
8f320b5
changed secs
jeremysee2 Mar 18, 2023
24ba451
increase test timeout
jeremysee2 Mar 18, 2023
cae091a
update CI pipeline
jeremysee2 Mar 19, 2023
7e0eac6
update doc
jeremysee2 Mar 19, 2023
2e3fe50
Merge pull request #15 from jeremysee2/add-worldobject-client
jeremysee2 Mar 20, 2023
50939cf
Merge branch 'master' of https://github.com/heuristicus/spot_ros into…
jeremysee2 Mar 20, 2023
49b8836
Merge pull request #17 from jeremysee2/heuristicus-master
jeremysee2 Mar 20, 2023
6f16994
graphnav fixes, tested on hardware
jeremysee2 Mar 20, 2023
14ebffc
cleanup logging
jeremysee2 Mar 20, 2023
c7d15ea
added downloadgraph, navigate_to, navigate_init
jeremysee2 Mar 21, 2023
08b893a
added loop closure and anchor optimization
jeremysee2 Mar 21, 2023
cae8ee2
added navigate_route support
jeremysee2 Mar 21, 2023
49d5976
cleanup unused code
jeremysee2 Mar 21, 2023
d31523a
Add arm_gaze as a service from the SDK demo, to showcase arm usage
jeremysee2 Mar 21, 2023
c790319
added unit tests
jeremysee2 Mar 21, 2023
26e744e
Merge pull request #18 from jeremysee2/graphnav-fixes
jeremysee2 Mar 21, 2023
2aca768
Merge branch 'master' into arm-gaze-service
jeremysee2 Mar 21, 2023
6d80eb0
added unit tests for arm_gaze
jeremysee2 Mar 22, 2023
5d654f1
Merge pull request #19 from jeremysee2/arm-gaze-service
jeremysee2 Mar 22, 2023
3caf2aa
remoe unused file
jeremysee2 Mar 22, 2023
e881f0a
Merge pull request #20 from jeremysee2/cleanup-unused
jeremysee2 Mar 23, 2023
3b64ab2
Add rosparam for switching depth and depth_in_visual images, build Do…
jeremysee2 Mar 31, 2023
fbf80f1
build spot_driver first
Apr 2, 2023
af065bf
entrypoint as script
jeremysee2 Apr 3, 2023
2fcd017
chmod +x entrypoint
jeremysee2 Apr 3, 2023
e8ee045
tested cmd_vel
jeremysee2 Apr 3, 2023
410e41a
use vision
jeremysee2 Apr 7, 2023
bd904d3
Merge branch 'master' of https://github.com/heuristicus/spot_ros into…
jeremysee2 Apr 18, 2023
7d145ce
cleanup from merging upstream
jeremysee2 Apr 18, 2023
54efa3e
change navigate_init to a srv not action
jeremysee2 Apr 18, 2023
9e259d2
remove graph_nav_util
jeremysee2 Apr 18, 2023
4df288a
update package path
jeremysee2 Apr 18, 2023
cb4fca2
navigate_init srv
jeremysee2 Apr 18, 2023
60f8426
add another method of publishing images, from spot_ros2
jeremysee2 Apr 18, 2023
648271c
use synchronous calls for Spot robot images
jeremysee2 Apr 18, 2023
4f89773
docker build every branch
jeremysee2 Apr 18, 2023
930d99f
remove graph_nav_util
jeremysee2 Apr 18, 2023
37795a2
filter branch name
jeremysee2 Apr 18, 2023
3c62024
fix branch name
jeremysee2 Apr 18, 2023
178bef5
fix branch name
jeremysee2 Apr 18, 2023
c4e48b4
fix branch name
jeremysee2 Apr 18, 2023
5e80649
install spot_wrapper
jeremysee2 Apr 18, 2023
c53d082
fix branch name
jeremysee2 Apr 18, 2023
20fb162
fix branch name
jeremysee2 Apr 18, 2023
0a2a281
install spotwrapper
jeremysee2 Apr 18, 2023
ae7ea3d
fix branch name
jeremysee2 Apr 18, 2023
b5ca25b
install spot wrapper
jeremysee2 Apr 18, 2023
3395895
extract branch name for docker hub
jeremysee2 Apr 18, 2023
7120c60
remove submodules
jeremysee2 Apr 18, 2023
09d17d9
fix branch name
jeremysee2 Apr 18, 2023
f343666
clone spot wrapper
jeremysee2 Apr 18, 2023
77b8199
branch name
jeremysee2 Apr 18, 2023
657e02e
print branch name
jeremysee2 Apr 18, 2023
26c8f76
fix branch name
jeremysee2 Apr 18, 2023
ef89dfd
install pip first
jeremysee2 Apr 18, 2023
f0deab9
fix branch name
jeremysee2 Apr 18, 2023
014e58b
fix branch name
jeremysee2 Apr 18, 2023
6b786e7
install spot wrapper
jeremysee2 Apr 18, 2023
d876c74
iterate over world objects
jeremysee2 Apr 18, 2023
a3de55b
remove check for subscriber, always publishing
jeremysee2 Apr 18, 2023
fb3c272
fixed library unit tests
jeremysee2 Apr 18, 2023
06608f8
removed unused image async callback tests
jeremysee2 Apr 18, 2023
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
34 changes: 34 additions & 0 deletions .github/workflows/spot_ros_docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker image upload

on: [push]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract branch name
run: echo "::set-output name=branch::${GITHUB_REF##*/}"
id: extract_branch
- name: Print branch name for Docker Hub
run: echo "${{ steps.extract_branch.outputs.branch }}"
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./deploy/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/spot_ros:${{ steps.extract_branch.outputs.branch }}
secrets: |
"SPOTROS_GIT_BRANCH=${{ github.ref_name }}"
79 changes: 79 additions & 0 deletions .github/workflows/spot_ros_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: spot_driver unit tests

# Run on every push
on: [push]

# Environmental variables
env:
SPOT_ARM: 1

jobs:
spot_driver-unit-tests:
# All steps inside this job will run inside the ROS Noetic container
container: public.ecr.aws/docker/library/ros:noetic
runs-on: ubuntu-latest
# Let's ensure we use bash, and work within our catkin worksapce
defaults:
run:
shell: bash
steps:
# Create directory to check out the code to
- name: Create catkin_ws directory
run: |
mkdir -p $GITHUB_WORKSPACE/catkin_ws/src

# Check out the Spot ROS code
- name: Checkout SpotROS
uses: actions/checkout@v3
with:
path: catkin_ws/src/spot_ros

- name: Checkout Spot Wrapper
uses: actions/checkout@v3
with:
repository: jeremysee2/spot_wrapper
path: catkin_ws/src/spot_ros/spot_wrapper

# Install the required packages
- name: Install dependencies (minus qttools)
run: |
sudo apt-get update && \
sudo apt-get install -y \
python3-pip \
ros-noetic-tf2-bullet
pip install cython \
bosdyn-client \
bosdyn-mission \
bosdyn-api \
bosdyn-core \
empy
working-directory: catkin_ws/

# Install SpotWrapper
- name: Install SpotWrapper
run: |
cd $GITHUB_WORKSPACE/catkin_ws/src/spot_ros
pip install -r spot_wrapper/requirements.txt
pip install -e spot_wrapper

- name: Check that code has been downloaded correctly
run: |
ls $GITHUB_WORKSPACE/catkin_ws/src
ls $GITHUB_WORKSPACE/catkin_ws/src/spot_ros

# Build our workspace
- name: Build workspace for spot_driver
run: |
source /opt/ros/noetic/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y
ls $GITHUB_WORKSPACE/catkin_ws
catkin_make --only-pkg-with-deps spot_driver
working-directory: catkin_ws/

# Run our ROS test!
- name: Run tests
run: |
source devel/setup.bash &&
rostest spot_driver run_tests.test --text
working-directory: catkin_ws/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
*.DS_Store
53 changes: 53 additions & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ros:noetic

RUN DEBIAN_FRONTEND=noninteractive apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y git

# Download the Spot ROS packages
RUN mkdir -p /ros/catkin_ws/src
WORKDIR /ros/catkin_ws/src
# Get the secrets from Github Actions
RUN --mount=type=secret,id=SPOTROS_GIT_BRANCH \
export SPOTROS_GIT_BRANCH=$(cat /run/secrets/SPOTROS_GIT_BRANCH) && \
echo $SPOTROS_GIT_BRANCH && \
git clone -b $SPOTROS_GIT_BRANCH https://github.com/jeremysee2/spot_ros.git /ros/catkin_ws/src/spot_ros

RUN DEBIAN_FRONTEND=noninteractive apt install -y python3-pip git qttools5-dev \
ros-noetic-tf2-bullet ros-noetic-roslint ros-noetic-pcl-ros ros-noetic-catkin \
python3-catkin-pkg nano vim ufw net-tools
RUN python3 -m pip install cython bosdyn-client bosdyn-mission bosdyn-api bosdyn-core empy numpy
RUN chmod +x /opt/ros/noetic/setup.sh
RUN /opt/ros/noetic/setup.sh

# Git clone Spot Wrapper
WORKDIR /ros/catkin_ws/src/spot_ros
RUN git clone https://github.com/jeremysee2/spot_wrapper.git /ros/catkin_ws/src/spot_ros/spot_wrapper
RUN pip install -r /ros/catkin_ws/src/spot_ros/spot_wrapper/requirements.txt
RUN pip install -e /ros/catkin_ws/src/spot_ros/spot_wrapper

# Install ROS dependencies
WORKDIR /ros/catkin_ws/

RUN rosdep install --from-paths /ros/catkin_ws/src --ignore-src -y

# Build ROS packages, remember to source the setup.bash file in the same command
WORKDIR /ros/catkin_ws/
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && \
catkin_make --only-pkg-with-deps spot_driver"
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && \
catkin_make"

# Source the new packages
RUN chmod +x /ros/catkin_ws/devel/setup.sh && /ros/catkin_ws/devel/setup.sh

# Setup the environmental variables for including these in the URDF
ARG SPOT_ARM=1
ARG SPOT_PACK=1
ARG SPOT_LIDAR_MOUNT=1
ARG SPOT_VELODYNE=1
ARG SPOT_USERNAME=admin
ARG SPOT_PASSWORD=dummypassword

ARG ROS_MASTER_URI=http://localhost:21311

ENTRYPOINT /bin/bash -c "/ros/catkin_ws/src/spot_ros/deploy/entrypoint.sh"
3 changes: 3 additions & 0 deletions deploy/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /ros/catkin_ws/devel/setup.sh && \
roslaunch spot_driver driver.launch username:=admin password:=$SPOT_PASSWORD
4 changes: 4 additions & 0 deletions spot_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ include_directories(

catkin_install_python(PROGRAMS
scripts/spot_ros
test/ros_helpers_test.py
test/spot_ros_test.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY doc DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY config DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

catkin_add_nosetests(test/run_tests.py)
9 changes: 5 additions & 4 deletions spot_driver/config/spot_ros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ rates:
robot_state: 20.0
metrics: 0.04
lease: 1.0
front_image: 10.0
side_image: 10.0
rear_image: 10.0
camera_images: 10.0
point_cloud: 10.0
hand_image: 10.0
feedback: 10.0
mobility_params: 10.0
mobility_params: 20.0
check_subscribers: 10.0
world_objects: 10.0

# If true, automatically claim the lease when the driver starts
auto_claim: False
# If true, automatically power on when the driver starts (requires auto_claim)
auto_power_on: False
# If true, automatically stand when the driver starts (requires auto_power_on)
auto_stand: False
depth_in_visual: True
mode_parent_odom_tf: vision

claim:
# If true, forcefully take the lease, instead of acquiring it, which can fail if someone else has it
Expand Down
4 changes: 2 additions & 2 deletions spot_driver/launch/driver.launch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<launch>
<arg name="username" default="dummyusername" />
<arg name="password" default="dummypassword" />
<arg name="hostname" default="192.168.50.3" />
<arg name="hostname" default="192.168.80.3" />
<arg name="estop_timeout" default="9.0"/>
<arg name="autonomy_enabled" default="true"/>
<!-- In m/s. 0 applies spot's internal limits -->
Expand Down Expand Up @@ -35,5 +35,5 @@
<rosparam command="load" file="$(find spot_driver)/config/twist_mux.yaml" />
<remap from="cmd_vel_out" to="spot/cmd_vel"/>
</node>

</launch>
3 changes: 3 additions & 0 deletions spot_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<exec_depend>velodyne_pointcloud</exec_depend>
<exec_depend>python-transforms3d-pip</exec_depend>

<test_depend>rostest</test_depend>
<test_depend>rosunit</test_depend>

<export>
<rosdoc config="rosdoc.yaml" />
</export>
Expand Down
8 changes: 7 additions & 1 deletion spot_driver/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup(
packages=["spot_driver"], scripts=["scripts/spot_ros"], package_dir={"": "src"}
packages=["spot_driver"],
scripts=[
"scripts/spot_ros",
"test/ros_helpers_test.py",
"test/spot_ros_test.py",
],
package_dir={"": "src"},
)

setup(**d)
Loading