Skip to content

Commit

Permalink
core: Raise an Exception when no ROS package is found
Browse files Browse the repository at this point in the history
  • Loading branch information
jara001 committed Apr 22, 2024
1 parent 0642982 commit 4794b10
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Unreleased
### Changed
- `unicode`:
- Raise an `ImportError` exception when no suitable ROS package is found.

## 0.10.5 - 2024-04-19
### Added
- `reconfigure`
Expand Down
21 changes: 12 additions & 9 deletions autopsy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,25 @@
######################

# Figure out ROS version
ROS_VERSION = 0

try:
import rospy

ROS_VERSION = 1

import autopsy.ros1_duration as duration
except:
except ImportError:
try:
import rclpy

except ImportError:
raise ImportError(
"No ROS package detected. Install 'rospy' or 'rclpy' first."
)
else:
ROS_VERSION = 2

import rclpy.duration as duration
except:
print ("No ROS package detected.")
ROS_VERSION = 0
else:
ROS_VERSION = 1

import autopsy.ros1_duration as duration


######################
Expand Down

0 comments on commit 4794b10

Please sign in to comment.