Skip to content

Commit

Permalink
[rtmros_choreonoid] python2, python3 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
kirohy committed Jun 13, 2024
1 parent 509f3f6 commit 76543d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions choreonoid_noetic.patch
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ index 504d56c7..8f22b7cc 100644
list(APPEND OPENRTM_DEFINITIONS -DUSE_BUILTIN_CAMERA_IMAGE_IDL)
else()
diff --git a/package.xml b/package.xml
index 5e1e1e32..a4cc62a4 100644
index 5e1e1e32..693da8e0 100644
--- a/package.xml
+++ b/package.xml
@@ -23,8 +23,9 @@
Expand All @@ -64,14 +64,16 @@ index 5e1e1e32..a4cc62a4 100644
<exec_depend>assimp</exec_depend>

<build_export_depend>qtbast5-dev</build_export_depend>
@@ -37,8 +38,8 @@
@@ -37,8 +38,10 @@
<exec_depend>libqt5-opengl</exec_depend>
<exec_depend>opengl</exec_depend>

- <depend>python</depend>
- <depend>python-numpy</depend>
+ <!-- <depend>python</depend> -->
+ <!-- <depend>python-numpy</depend> -->
+ <depend condition="$ROS_PYTHON_VERSION == 2">python</depend>
+ <depend condition="$ROS_PYTHON_VERSION == 2">python-numpy</depend>
+ <depend condition="$ROS_PYTHON_VERSION == 3">python3</depend>
+ <depend condition="$ROS_PYTHON_VERSION == 3">python3-numpy</depend>

<build_depend>libpulse-dev</build_depend>
<build_depend>libsndfile1-dev</build_depend>
Expand Down
6 changes: 4 additions & 2 deletions hrpsys_choreonoid/launch/add_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ def parse_filename(filestr):
pkgname = ret.group(1)
#packagepath = commands.getoutput('rospack find %s'%(pkgname))
packagepath = subprocess.check_output(['rospack', 'find', pkgname])
packagepath = packagepath.decode().rstrip('\n')
if sys.version_info >= (3,):
packagepath = packagepath.decode()
packagepath = packagepath.rstrip('\n')
filestr = filestr[:ret.start(0)] + packagepath + filestr[ret.end(0):]

return filestr

try:
f = open(objs_yaml, 'r')
dict_objs = yaml.load(f)
dict_objs = yaml.load(f, Loader=yaml.SafeLoader)
f.close()
except:
print("can not read %s"%(objs_yaml), file=sys.stderr)
Expand Down
2 changes: 1 addition & 1 deletion hrpsys_ros_bridge_jvrc/scripts/gait_state_manager_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def add_event(self, cfg):
callbacks = cfg['callbacks'] if 'callbacks' in cfg else {}
tmap = self._map
def add(e):
src = [e['src']] if isinstance(e['src'], str) else e['src']
src = [e['src']] if (isinstance(e['src'], str) or isinstance(e['src'], unicode)) else e['src']
if e['name'] not in tmap:
tmap[e['name']] = {}
for s in src:
Expand Down

0 comments on commit 76543d6

Please sign in to comment.