Skip to content

Commit

Permalink
CI (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvluu authored Nov 30, 2023
1 parent 7198b96 commit 4826444
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/.pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[MESSAGES CONTROL]

disable=all

enable=
bad-indentation,
trailing-whitespace,
wrong-import-order,
unused-variable,
unused-import
35 changes: 35 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Getting changed Python files and Analysing the code with pylint
run: |
git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
echo CI_COMMIT_SHA=${GITHUB_SHA}
tmp_files=$(git diff --name-only origin/main ${CI_COMMIT_SHA})
echo "Changed files are $tmp_files"
if [ -z "$(echo "$tmp_files" | grep "\.py")" ]; then exit 0; else echo "Python files are found"; fi
tmp_pfiles=$(echo "$tmp_files" | grep "\.py")
echo "Python files are $tmp_pfiles"
if [[ -z "$tmp_pfiles" ]]; then
echo "No files to lint"
else
echo "Running Linter!"
pylint --rc-file=/home/runner/work/RoboBuggy2/RoboBuggy2/.github/workflows/.pylintrc $tmp_pfiles
fi
25 changes: 10 additions & 15 deletions rb_ws/src/buggy/scripts/visualization/telematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ def __init__(self):
self.gnss1_fixinfo_publisher = rospy.Publisher("/gnss1/fix_info_republished", String, queue_size=10)
self.gnss1_fixinfo_int_publisher = rospy.Publisher("/gnss1/fix_info_republished_int", Int8, queue_size=10)
self.gnss1_fixinfo_subscriber = rospy.Subscriber("/gnss1/fix_info", GNSSFixInfo, self.republish_fixinfo, (self.gnss1_fixinfo_publisher, self.gnss1_fixinfo_int_publisher))

self.gnss2_fixinfo_publisher = rospy.Publisher("/gnss2/fix_info_republished", String, queue_size=10)
self.gnss2_fixinfo_int_publisher = rospy.Publisher("/gnss2/fix_info_republished_int", Int8, queue_size=10)
self.gnss2_fixinfo_subscriber = rospy.Subscriber("/gnss2/fix_info", GNSSFixInfo, self.republish_fixinfo, (self.gnss2_fixinfo_publisher, self.gnss2_fixinfo_int_publisher))

def convert_odometry_to_navsatfix(self, msg):
"""Convert Odometry-type to NavSatFix-type for plotting on Foxglove
x`
Args:
msg (Odometry): odometry as per INS
"""
Expand All @@ -48,7 +47,7 @@ def convert_odometry_to_navsatfix(self, msg):
new_msg.longitude = long
new_msg.altitude = down
self.odom_publisher.publish(new_msg)

def convert_navsatfix_to_pose_covariance(self, msg, publishers):
"""Convert NavSatFix-type and related covariance matrix to Pose-type and array
respectively for easy visualization in Foxglove.
Expand All @@ -70,14 +69,14 @@ def convert_navsatfix_to_pose_covariance(self, msg, publishers):
round(msg.position_covariance[4], 4),
round(msg.position_covariance[8], 4)]
publishers[1].publish(covariance)

def republish_fixinfo(self, msg, publishers):
"""
convert gnss/fixinfo to a string for visualization in foxglove
"""
fix_type = msg.fix_type
fix_string = "fix type: "

if (fix_type == 0):
fix_string += "FIX_3D"
elif (fix_type == 1):
Expand All @@ -92,17 +91,13 @@ def republish_fixinfo(self, msg, publishers):
fix_string += "FIX_RTK_FLOAT"
else:
fix_string += "FIX_RTK_FIXED"
fix_string += "\nsbas_used: " + str(msg.sbas_used)

fix_string += "\nsbas_used: " + str(msg.sbas_used)
fix_string += "\ndngss_used: " + str(msg.dngss_used)
publishers[0].publish(fix_string)
publishers[1].publish(fix_type)




if __name__ == "__main__":
rospy.init_node("telematics")
telem = Telematics()
rospy.spin()

rospy.init_node("telematics")
telem = Telematics()
rospy.spin()

0 comments on commit 4826444

Please sign in to comment.