brian2ros package

Module contents

class brian2ros.LaserScanSubscriber(name, output, header=None)

Bases: Subscriber

class brian2ros.Publisher(topic, topic_type, input, rate=500, reset_values={}, name=None, header=None)

Bases: object

Create and configure a ROS publisher.

Parameters

namestr,

Name of the publisher.

topicstr,

Name of the ROS topic to publish to.

topic_typestr,

Path of the ROS topic to publish to.

inputdict,

Should be : {“name”: value, “name”: value,…} List of input variables to publish. Ex : {“linear.x”: 0.26, “angular.z”: 1.82}

rateint, optional

Rate at which to publish messages (default is 500 Hz).

reset_valuesdict, optional

Should be : {“name”: value, “name”: value,…} List of reset values for the input variables. Ex : {“linear.x”: 0., “angular.z”: 0.}

headerstr, optional

Path of the header file to include (default is None). It has to be add if the topic is not in the HEADER_FILES list.

class brian2ros.ROSStandaloneDevice

Bases: CPPStandaloneDevice

add_publisher(*args, **kwargs)
add_subscriber(*args, **kwargs)
build(directory='output', compile=True, run=True, debug=False, clean=False, with_output=True, additional_source_files=None, run_args=None, direct_call=True, **kwds)

Build the project

TODO: more details

Parameters

directorystr, optional

The output directory to write the project to, any existing files will be overwritten. If the given directory name is None, then a temporary directory will be used (used in the test suite to avoid problems when running several tests in parallel). Defaults to 'output'.

compilebool, optional

Whether or not to attempt to compile the project. Defaults to True.

runbool, optional

Whether or not to attempt to run the built project if it successfully builds. Defaults to True.

debugbool, optional

Whether to compile in debug mode. Defaults to False.

with_outputbool, optional

Whether or not to show the stdout of the built program when run. Output will be shown in case of compilation or runtime error. Defaults to True.

cleanbool, optional

Whether or not to clean the project before building. Defaults to False.

additional_source_fileslist of str, optional

A list of additional .cpp files to include in the build.

direct_callbool, optional

Whether this function was called directly. Is used internally to distinguish an automatic build due to the build_on_run option from a manual device.build call.

compile_source(directory, compiler, debug, clean)
detect()
generate_main_source(writer)
generate_makefile(writer, compiler, compiler_flags, linker_flags, nb_threads, debug)
generate_objects_source(writer, arange_arrays, synapses, static_array_specs, networks, timed_arrays)
network_run(net, duration, report=None, report_period=Ellipsis, namespace=None, profile=None, level=0, **kwds)
run(directory, results_directory, with_output, run_args)
class brian2ros.Subscriber(name, topic, topic_type, output, header=None)

Bases: Function

Create and configure a ROS subscriber.

Parameters

namestr

Name of the subscriber.

topicstr,

Name of the ROS topic to subscribe to.

topic_typestr,

Path of the ROS topic to subscribe to.

outputdict,

Should be : {“name”: value, “name”: value,…} List of output variables to subscribe. Ex : {“ranges”: [0,…]} or {“ranges”: None} or {“ranges”: []} or {“ranges”: [None]} or {“ranges”: 0}

headerstr, optional

Path of the header file to include (default is None). It has to be add if the topic is not in the HEADER_FILES list.

Returns

Function

A function that returns the value of the subscribed topic.

create_code()
class brian2ros.TwistPublisher(input, rate=500, reset_values={}, name=None, header=None)

Bases: Publisher