Forums › Niryo One › Programming Niryo One › Customized node & autolaunch
Tagged: #launch #autolaunch #niryo #api
I made a customised node thanks to your advice using the Python API.
So I created a python file “test_python_api.py” that make Niryo move. This node is located in niryo_one_python_api/src. The problem is that every time I powered on the robot, I had a launch it manually (using SSH connexion, and go to the folder, …).
To resolve this problem:
I want to insert it in a launch file in order to launch it automatically when the Niryo is powered.
I found 6 launch files on the Github :
In the folder niryo_one_bringup/launch, there are controllers.launch, desktop_rviz_simulation.launch, niryo_one_base.launch, robot_commander.launch, rpi_setup.launch and user_interface.launch.
I plan to paste this line in one of the launch files :
<node name=”niryo_one_example_python_api pkg=”niryo_one_python_api type=”test_python_api.py” />
In which file should I place my node?
and where in the launch file selected?
There is a better way to do what you want to do. You can simply remotely execute the Python script from your own computer. We have made a tutorial for that here.
If however, you plan to add a node into an existing launch file, I suggest you put it in user_interface.launch, at the end. And inside the node, add a delay of about 15-20 seconds so that all the other functionalities are correctly started.
In the tutorial provided to remotely execute the Python script, it suggests that I have a Linux OS, isn’t it?
I am currently working with a Windows OS : I launch my node using Putty, I program it using Filezilla. It allows me to acces to the node program on my computer and then I can program it using Visual Studio. That’s why I plan to add a node into an existing launch file. I will try to put it in user_interface.launch.
About the delay, do you mean something like “time.sleep(20)” at the beginning of the main function?
Yes this tutorial is for Linux users, as ssh is not natively supported on Windows (yet?), the command won’t work.
So adding a new node like you proposed seems a good idea.
Yes it should work. If you have some problems when testing don’t hesitate to increase the delay.
You must be logged in to reply to this topic.