Visible to the public Output Path for Gazebo World FileConflict Detection Enabled

6 replies [Last post]
jupan
jupan's picture
Offline
Established Community Member
Joined: Jan 14 2017

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

Jonathan Sprinkle
sprinkle's picture
Offline
AdministratorEstablished Community Member
Joined: Aug 11 2010
I suggest having no path at

I suggest having no path at all: this results in two potentially different things happening:

  1. If you run with rosnode pkgname nodename, then you will generate the file in the directory you run from
  2. 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?

jupan
jupan's picture
Offline
Established Community Member
Joined: Jan 14 2017
SImulink

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?

srees
srees's picture
Offline
AdministratorEstablished Community Member
Joined: Jul 10 2012
The online validation with

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.

Jonathan Sprinkle
sprinkle's picture
Offline
AdministratorEstablished Community Member
Joined: Aug 11 2010
I think if you run without

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.

jupan
jupan's picture
Offline
Established Community Member
Joined: Jan 14 2017
Exactly

Exactly! I tried to set a relative path, then started all nodes in a launch file, the world generator did not work, but when I started a single world generator simulink file, it could produce world file correctly.

Finally, I only put a file name (ie. gazebo_output.world) into 'filepath' argurment and the launch file worked well. The output file was placed in ~/.ros/ directory.

Jonathan Sprinkle
sprinkle's picture
Offline
AdministratorEstablished Community Member
Joined: Aug 11 2010
Sounds like this is working

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 :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.