Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using instance of Robot() in a separate node #76

Open
mjohannessen opened this issue Mar 9, 2024 · 3 comments
Open

Using instance of Robot() in a separate node #76

mjohannessen opened this issue Mar 9, 2024 · 3 comments

Comments

@mjohannessen
Copy link

mjohannessen commented Mar 9, 2024

After starting the robot instance using

from rae_sdk.robot import Robot robot = Robot()

Can that instance of robot be called from another node to, for example stop that instance or add a publisher, nav command or make another api call to Robot? Creating a second instance of Robot() disrupts the first instance.

@Serafadam
Copy link
Collaborator

Hi, do you mean if it's possible to create ROS interfaces (subscriptions, timers) etc. via some external service call? That is currently not available. I also did not test it yet but I think it should be possible to create a ROS node that has Robot class in it. Regarding multiple 'Robot' class instances, you can use RobotOptions to indicate whether new instance should start the hardware controllers and/or controllers, is that more in line of what you need?

@mjohannessen
Copy link
Author

Here's an example: robot_test_1.py brings up rae, and robot_test_2.py seems to have no effect. This would be the same if a new Robot object is instantiated in a node, for example to add a publisher or test the audio using the python api:

robot_test_1.py:

from rae_sdk.robot import Robot
from rae_sdk.robot.robot_options import RobotOptions

## brigup rae
options = RobotOptions(
    name='rae_sdk_1', 
    namespace='', 
    launch_controllers=True, 
    start_hardware=True, 
    launch_mock=False
)
robot = Robot(options)
robot.led.set_leds('#FF0000', 100, 'solid', 1)  # set color to red

and

robot_test_2.py:

from rae_sdk.robot import Robot
from rae_sdk.robot.robot_options import RobotOptions

options = RobotOptions(
    name='rae_sdk_2', 
    namespace='', 
    launch_controllers=False, 
    start_hardware=False, 
    launch_mock=False
)
robot = Robot(options)
robot.led.set_leds('#0000FF', 100, 'solid', 1)  # set color to blue

@Serafadam
Copy link
Collaborator

Hi, sorry for the delay, I didn't get the notification. If you set launch_controllers to true in robot_test_2.py you should be able to use the interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants