How to turn on ROS/Gazebo

There is almost 100% a better way to do this, but here is the process we followed.
Adapted from the email I wrote to Greg Hatfield in March 2022 Turning on simulation:


In a terminal Be in your firmware directory Google: px4 ros gazebo, find a large box of instructions.
Here's what the commands say

DONT_RUN=1 make px4_sitl_default gazebo
source ~/catkin_ws/devel/setup.bash # (optional)
source Tools/simulation/gazebo/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/simulation/gazebo/sitl_gazebo
roslaunch px4 mavros_posix_sitl.launch

Common Problems, if you dont get a quadcopter in there, is because you did the source ~/catkin_ws step on accident.

In a second terminal: to launch whatever roslaunch files youre going to use. The general format is
$roslaunch [package_name] [specific_launch_file] [arguments]
$roslaunch waypoint_tester Flight_only.launch id:=2 altitude:=4

In a third terminal:
$rosservice call /mavros/cmd/arming true
This will arm the quadcopter and you should be able to see it take off

In a fourth terminal:
if you want to record information about your simulation, you do $rosbag record -a -o my_dataset_bag_file.bag Makes the ros bag file you can see whats good here. Can use bagpy_gui.py to make csvs from there.

Other stuff You can change parameters of the firmware by using a command called mavparam. The general idea is that you do

$rosrun [package name] [program you want to run] [whatever arguments you want to do]
$rosrun mavros mavparam get CBRK_USB_CHK Should output 197848 (meaning that the usb check is disabled for flight)

Github
$git config --global user.name “Elon Musk”
$git config --global user.email “elon@spacex.com”
You should be able to see our git repositories by the github website, i.e. github.com/fsbr/src should show the flight code $git clone https://github.com/fsbr/acl-quadcopter Should give you the utils for breaking bag files into csv (its called bagpy_gui.py)