Output Path for Gazebo World File
Hi Dr. Sprinkle,
I remember that you suggest us to use parameter to set up world file output path. I tried to have a 'get parameter' block in simulink for getting output lcoation parameter when I start the node. However, matlab give me this error: "FID input is not supported for code generation." It seems that fid = fopen(filename, permission) does not accept a variable (input) for filename. In this way, I cannot set parameter for output location.
Sicne I have alomost done with everything in simulink, at this stage, I don't want to change to C++. I am wondering if it is accepted that we don't use parameter, instead I will use a relative path like "~/cvchallenge_task3_ws/src/cvchallenge_task3/worlds/output.world". By using a relative path, the world file will be in our submitted package's worlds folder.
Is this acceptable?
Thanks,
Ju
I suggest having no path at all: this results in two potentially different things happening:
- If you run with rosnode pkgname nodename, then you will generate the file in the directory you run from
- If you run with roslaunch pkgname launchfile.launch, then you will generate the file in ~/.ros
We are currently planning for you to run as a launch file, so this is perfect: can you confirm whether it works in the simulink block you have?
The online validation with CPS-VO does expect to find the world file in ~/.ros/gazebo_output.world - if it isn't there, the world file will not be returned as an output.
I think if you run without the path but have your node started within the launchfile, then everything will work fine. Can you check? I also think that if you try to specify relative paths from ~/.ros/filename.launch within your code, then from the launchfile it will not work: it will only work if called from rosrun pkgname nodename.
Sounds like this is working then. I actually stumbled on this a bit too, it is documented in ROS but a bit confusing. So we picked this location to generate to as it won't need a parameter :)
1. If I don't speicfy a path like this: id = fopen('gazebo_output.world', 'w+'), the output file will be placed in ros workspace.
2. Also, I can specify the path: id = fopen('~/.ros/gazebo_output.world','w+'), the output file will be placed in ~/.ros/.
Both of them work well, the C++ code can be generated successfully, I assume you would prefer the second method. Right?