Fix python3
This commit is contained in:
parent
eea9359527
commit
c64472b40f
|
@ -53,6 +53,7 @@ def get_libcarla_extensions():
|
||||||
if 'BUILD_RSS_VARIANT' in os.environ and os.environ['BUILD_RSS_VARIANT'] == 'true':
|
if 'BUILD_RSS_VARIANT' in os.environ and os.environ['BUILD_RSS_VARIANT'] == 'true':
|
||||||
print('Building AD RSS variant.')
|
print('Building AD RSS variant.')
|
||||||
extra_compile_args += ['-DLIBCARLA_RSS_ENABLED']
|
extra_compile_args += ['-DLIBCARLA_RSS_ENABLED']
|
||||||
|
extra_compile_args += ['-DLIBCARLA_PYTHON_MAJOR_' + str(sys.version_info[0])]
|
||||||
extra_link_args += [os.path.join(pwd, 'dependencies/lib/libad_rss_map_integration_python' + str(sys.version_info[0]) + '.a')]
|
extra_link_args += [os.path.join(pwd, 'dependencies/lib/libad_rss_map_integration_python' + str(sys.version_info[0]) + '.a')]
|
||||||
extra_link_args += [os.path.join(pwd, 'dependencies/lib/libad_rss_map_integration.a')]
|
extra_link_args += [os.path.join(pwd, 'dependencies/lib/libad_rss_map_integration.a')]
|
||||||
extra_link_args += [os.path.join(pwd, 'dependencies/lib/libad_map_access_python' + str(sys.version_info[0]) + '.a')]
|
extra_link_args += [os.path.join(pwd, 'dependencies/lib/libad_map_access_python' + str(sys.version_info[0]) + '.a')]
|
||||||
|
|
|
@ -10,6 +10,24 @@
|
||||||
#include <ad/rss/world/RssDynamics.hpp>
|
#include <ad/rss/world/RssDynamics.hpp>
|
||||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||||
|
|
||||||
|
#ifdef LIBCARLA_PYTHON_MAJOR_2
|
||||||
|
extern "C" {
|
||||||
|
void initlibad_physics_python();
|
||||||
|
void initlibad_rss_python();
|
||||||
|
void initlibad_map_access_python();
|
||||||
|
void initlibad_rss_map_integration_python();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LIBCARLA_PYTHON_MAJOR_3
|
||||||
|
extern "C" {
|
||||||
|
void PyInit_libad_physics_python();
|
||||||
|
void PyInit_libad_rss_python();
|
||||||
|
void PyInit_libad_map_access_python();
|
||||||
|
void PyInit_libad_rss_map_integration_python();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
namespace rss {
|
namespace rss {
|
||||||
|
|
||||||
|
@ -61,6 +79,22 @@ static auto GetVisualizationMode(const carla::client::RssSensor &self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void export_ad_rss() {
|
void export_ad_rss() {
|
||||||
|
|
||||||
|
#ifdef LIBCARLA_PYTHON_MAJOR_2
|
||||||
|
initlibad_physics_python();
|
||||||
|
initlibad_rss_python();
|
||||||
|
initlibad_map_access_python();
|
||||||
|
initlibad_rss_map_integration_python();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LIBCARLA_PYTHON_MAJOR_3
|
||||||
|
PyInit_libad_physics_python();
|
||||||
|
PyInit_libad_rss_python();
|
||||||
|
PyInit_libad_map_access_python();
|
||||||
|
PyInit_libad_rss_map_integration_python();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
namespace cc = carla::client;
|
namespace cc = carla::client;
|
||||||
namespace cs = carla::sensor;
|
namespace cs = carla::sensor;
|
||||||
|
|
|
@ -198,12 +198,6 @@ static auto MakeCallback(boost::python::object callback) {
|
||||||
|
|
||||||
#ifdef LIBCARLA_RSS_ENABLED
|
#ifdef LIBCARLA_RSS_ENABLED
|
||||||
#include "AdRss.cpp"
|
#include "AdRss.cpp"
|
||||||
extern "C" {
|
|
||||||
void initlibad_physics_python();
|
|
||||||
void initlibad_rss_python();
|
|
||||||
void initlibad_map_access_python();
|
|
||||||
void initlibad_rss_map_integration_python();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,10 +220,6 @@ BOOST_PYTHON_MODULE(libcarla) {
|
||||||
export_commands();
|
export_commands();
|
||||||
export_trafficmanager();
|
export_trafficmanager();
|
||||||
# ifdef LIBCARLA_RSS_ENABLED
|
# ifdef LIBCARLA_RSS_ENABLED
|
||||||
initlibad_physics_python();
|
|
||||||
initlibad_rss_python();
|
|
||||||
initlibad_map_access_python();
|
|
||||||
initlibad_rss_map_integration_python();
|
|
||||||
export_ad_rss();
|
export_ad_rss();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,7 +595,7 @@ class HUD(object):
|
||||||
pygame.draw.rect(display, (255, 0, 0), rect)
|
pygame.draw.rect(display, (255, 0, 0), rect)
|
||||||
text_color = (255, 0, 0)
|
text_color = (255, 0, 0)
|
||||||
item = item[0]
|
item = item[0]
|
||||||
if isinstance(item, basestring) and len(item) > 0: # At this point has to be a str.
|
if len(item) > 0: # At this point has to be a str.
|
||||||
surface = self._font_mono.render(item, True, text_color)
|
surface = self._font_mono.render(item, True, text_color)
|
||||||
display.blit(surface, (8, v_offset))
|
display.blit(surface, (8, v_offset))
|
||||||
v_offset += 18
|
v_offset += 18
|
||||||
|
|
Loading…
Reference in New Issue