class documentation

class LedRingRosWrapper(object):

Constructor: LedRingRosWrapper(hardware_version, service_timeout)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method alternate Several colors are alternated one after the other.
Method breath Variation of the light intensity of the LED ring, similar to human breathing.
Method chase Movie theater light style chaser animation.
Method custom Sends a colour command to all LEDs of the LED ring. The function expects a list of colours for the 30 LEDs of the robot.
Method flashing Flashes a color according to a frequency. The frequency is equal to 1 / period.
Method go_up LEDs turn on like a loading circle, and are then all turned off at once.
Method go_up_down LEDs turn on like a loading circle, and are turned off the same way.
Method rainbow Draws rainbow that fades across all LEDs at once.
Method rainbow_chase Rainbow chase animation, like the led_ring_chase method.
Method rainbow_cycle Draws rainbow that uniformly distributes itself across all LEDs.
Method set_led_color Lights up an LED in one colour. RGB colour between 0 and 255.
Method snake A small coloured snake (certainly a python :D ) runs around the LED ring.
Method solid Sets the whole Led Ring to a fixed color.
Method turn_off Turns off all Leds
Method wipe Wipes a color across the LED Ring, light a LED at a time.
Property hardware_version Undocumented
Static Method __check_result_status Undocumented
Method __call_service Waits for the service called service_name Then calls the service with args
Method __check_ned_2_version Undocumented
Method __classic_return_w_check Undocumented
Instance Variable __hardware_version Undocumented
Instance Variable __service_timeout Undocumented
def __init__(self, hardware_version='ned2', service_timeout=1):

Undocumented

def alternate(self, color_list, period=0, iterations=0, wait=False):

Several colors are alternated one after the other.

Examples:

from std_msgs.msg import ColorRGBA

color_list = [
    ColorRGBA(r=15, g=50, b=255),
    [255, 0, 0],
    [0, 255, 0],
]

led_ring.alternate(color_list)
led_ring.alternate(color_list, 1, 100, True)
led_ring.alternate(color_list, iterations=20, wait=True)
Parameters
color_list:list[list[float] or ColorRGBA]Led color list of lists of size 3[R, G, B] or ColorRGBA objects. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive alternations. If 0, the Led Ring alternates endlessly.
wait:boolThe service wait for the animation to finish all iterations or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def breath(self, color, period=0, iterations=0, wait=False):

Variation of the light intensity of the LED ring, similar to human breathing.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.breath(ColorRGBA(r=15, g=50, b=255))
led_ring.breath([15, 50, 255], 1, 100, True)
led_ring.breath(ColorRGBA(r=15, g=50, b=255), iterations=20, wait=True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive turns around the Led Ring. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def chase(self, color, period=0, iterations=0, wait=False):

Movie theater light style chaser animation.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.chase(ColorRGBA(r=15, g=50, b=255))
led_ring.chase([15, 50, 255], 1, 100, True)
led_ring.chase(ColorRGBA(r=15, g=50, b=255), iterations=20, wait=True)
Parameters
color:list or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive chase. If 0, the animation continues endlessly. One chase just lights one Led every 3 Leds.
wait:boolThe service wait for the animation to finish all iterations or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def custom(self, led_colors):

Sends a colour command to all LEDs of the LED ring. The function expects a list of colours for the 30 LEDs of the robot.

Example:

led_list = [[i / 30. * 255 , 0, 255 - i / 30.] for i in range(30)]
led_ring.custom(led_list)
Parameters
led_colors:list[list[float] or ColorRGBA]List of size 30 of led color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
Returns
(int, str)status, message
def flashing(self, color, period=0, iterations=0, wait=False):

Flashes a color according to a frequency. The frequency is equal to 1 / period.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.flashing([15, 50, 255])
led_ring.flashing([15, 50, 255], 1, 100, True)
led_ring.flashing([15, 50, 255], iterations=20, wait=True)

frequency = 20  # Hz
total_duration = 10 # seconds
led_ring.flashing(ColorRGBA(r=15, g=50, b=255), 1./frequency, total_duration * frequency , True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive flashes. If 0, the Led Ring flashes endlessly.
wait:boolThe service wait for the animation to finish all iterations or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def go_up(self, color, period=0, iterations=0, wait=False):

LEDs turn on like a loading circle, and are then all turned off at once.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.go_up(ColorRGBA(r=15, g=50, b=255))
led_ring.go_up([15, 50, 255], 1, 100, True)
led_ring.go_up(ColorRGBA(r=15, g=50, b=255), iterations=20, wait=True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive turns around the Led Ring. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def go_up_down(self, color, period=0, iterations=0, wait=False):

LEDs turn on like a loading circle, and are turned off the same way.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.go_up_down(ColorRGBA(r=15, g=50, b=255))
led_ring.go_up_down([15, 50, 255], 1, 100, True)
led_ring.go_up_down(ColorRGBA(r=15, g=50, b=255), iterations=20, wait=True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive turns around the Led Ring. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def rainbow(self, period=0, iterations=0, wait=False):

Draws rainbow that fades across all LEDs at once.

Examples:

led_ring.rainbow()
led_ring.rainbow(5, 2, True)
led_ring.rainbow(wait=True)
Parameters
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive rainbows. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def rainbow_chase(self, period=0, iterations=0, wait=False):

Rainbow chase animation, like the led_ring_chase method.

Examples:

led_ring.rainbow_chase()
led_ring.rainbow_chase(5, 2, True)
led_ring.rainbow_chase(wait=True)
Parameters
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive rainbow cycles. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def rainbow_cycle(self, period=0, iterations=0, wait=False):

Draws rainbow that uniformly distributes itself across all LEDs.

Examples:

led_ring.rainbow_cycle()
led_ring.rainbow_cycle(5, 2, True)
led_ring.rainbow_cycle(wait=True)
Parameters
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
iterations:intNumber of consecutive rainbow cycles. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def set_led_color(self, led_id, color):

Lights up an LED in one colour. RGB colour between 0 and 255.

Example:

from std_msgs.msg import ColorRGBA

led_ring.set_led_color(5, [15, 50, 255])
led_ring.set_led_color(5, ColorRGBA(r=15, g=50, b=255))
Parameters
led_id:intId of the led: between 0 and 29
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
Returns
(int, str)status, message
def snake(self, color, period=0, iterations=0, wait=False):

A small coloured snake (certainly a python :D ) runs around the LED ring.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.snake(ColorRGBA(r=15, g=50, b=255))
led_ring.snake([15, 50, 255], 1, 100, True)
led_ring.snake(ColorRGBA(r=15, g=50, b=255), iterations=20, wait=True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default duration will be used.
iterations:intNumber of consecutive turns around the Led Ring. If 0, the animation continues endlessly.
wait:boolThe service wait for the animation to finish or not to answer. If iterations is 0, the service answers immediately.
Returns
(int, str)status, message
def solid(self, color, wait=False):

Sets the whole Led Ring to a fixed color.

Example:

from std_msgs.msg import ColorRGBA

led_ring.solid([15, 50, 255])
led_ring.solid(ColorRGBA(r=15, g=50, b=255), True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
wait:boolThe service wait for the animation to finish or not to answer. For this method, the action is quickly done, so waiting doesn't take a lot of time.
Returns
(int, str)status, message
def turn_off(self, wait=False):

Turns off all Leds

Example:

led_ring.turn_off()
Parameters
wait:boolThe service wait for the animation to finish or not to answer. For this method, the action is quickly done, so waiting doesn't take a lot of time.
Returns
(int, str)status, message
def wipe(self, color, period=0, wait=False):

Wipes a color across the LED Ring, light a LED at a time.

Examples:

from std_msgs.msg import ColorRGBA

led_ring.wipe(ColorRGBA(r=15, g=50, b=255))
led_ring.wipe([15, 50, 255], 1, True)
led_ring.wipe(ColorRGBA(r=15, g=50, b=255), wait=True)
Parameters
color:list[float] or ColorRGBALed color in a list of size 3[R, G, B] or in an ColorRGBA object. RGB channels from 0 to 255.
period:floatExecution time for a pattern in seconds. If 0, the default time will be used.
wait:boolThe service wait for the animation to finish or not to answer.
Returns
(int, str)status, message
@property
hardware_version =

Undocumented

@staticmethod
def __check_result_status(result):

Undocumented

def __call_service(self, service_name, service_msg_type, *args):

Waits for the service called service_name Then calls the service with args

Parameters
service_name
service_msg_type
*argsTuple of arguments
Returns
Response
Raises
NiryoRosWrapperExceptionTimeout during waiting of services
def __check_ned_2_version(self):

Undocumented

def __classic_return_w_check(self, result):

Undocumented

__hardware_version =

Undocumented

__service_timeout =

Undocumented