Simple Question about PX4 mavros offboard

Hello guys, I am making a autonomus project. We are in beginner level.
I tried to add this script to PX4-autopilot, but I couldn’t do it. The instructions are not good enough.


Where do I need to paste the code? Do I need to make a new catkin workspace? If I need to make a new workspace, what should I add to cmakelists.txt?

Here are what I have done:
I tried to add the script to
~/PX4-Autopilot/src/examples/px4_simple_app directory, so it can be run like the previous code here. But I had errors like “ros/ros.cpp” not found. I edited cmakelists file but couldn’t manage.

I tried to make a new catkin workspace, I added the script, and edited cmakelists, I had errors on
target_link_libraries( … , … ) line, whatever I wrote.

I do not know if I am true or not, I am very new. Could you briefly explain?