Pixhawk Offboard control without Companion computer

Hello !
I was wondering if I can give a desired position setpoint to the quadcopter for SITL on Gazebo without using the companion computer. Can I write a separate ROS node as done here? I do not have pi or odroid right now. I was really intrigued and wanted to perform the tutorial :frowning:
Thank you for your time on this ! Much appreciated !

If you are running SITL, you do not need a seperate companion computer.

You can follow the instructions here

1 Like

Thank you @Jaeyoung-Lim ! The tutorial says to make a ROS package and copy the node in it. CMake file is then modified by including “add_executable…” consisting of my node. When I run it I am getting some errors as shown in the screenshot below,

I am not as familiar with ROS. I will like to receive your guidance regarding this. Additionally is the Firmware folder (Pixhawk’s source code) required to be in my catkin_ws ?
Thank you for your time ! Apologize for inconvenience.

I know I am missing something out. This is my first time. Apologize for these questions.

@Vrinda Are you able to build your pakcages? It seems like there are syntax errors in your source code

Hello @Jaeyoung-Lim, thanks for getting back to me! I got it to work, I had not modified my cmake file correctly. Additionally I wanted to inform you that in the dev guide, “catkin build” is proposed. However I get some errors with it. When I did catkin_make instead of build, I was able to get the simulation.

Now am stuck at a point where I want to plot my setpoint in rqt_plot. I cannot see a topic \mavros\setpoint_position\local in the console. I can only plot my current position. I am aware I can do real time plotting in Q ground control. Just was curious to do it vis rqt_plot.

@Vrinda You should be able to plot your position in rqt_plot.

I didn’t quite get what your question is

This is my rqt_graph. I want to echo \mavros\setpoint_position\local. I get a warning saying that it has not been published yet. Additionally I cannot see any topic named “\mavros\setpoint_position\local” in rqt_plot. I can plot the local position. I just want to plot my setpoint.
Thanks much for you time @Jaeyoung-Lim.

@Vrinda It lookslike your node is not publishing the setpoint

Hello @Jaeyoung-Lim ! As per the code and the rqt graph, the setpoint is published to the topic /mavros/setpoint_position, then why am I getting the warning that this topic has not been published ?

The quadcopter is hovering at the waypoint, however it starts drifting in yaw and in X and Y directions if I run the simulation for longer duration (more than 5 minutes). I believe the altitude is still being maintained. What is the possible reason for this behavior ? Is it battery ?

@Vrinda The graph is constructed when the topic is registered to the rosmaster. It doesn’t neessarily mean that your node is currently publishing the topic.

The drifiting also shows that your node is not publishing the setpoint_position topic

Easy way to check if your topic is publishing is by rostopic echo <topic name> or rostopic hz <topic name>

Thank you very much @Jaeyoung-Lim. I understand the concept of rqt_graph now. I have been following the tutorial presented in the dev guide. I don’t know where I am going wrong. I will take a look and keep you posted.

It is not getting published. However the qaudcopter goes to the waypoint. Additionally I can plot the setpoint in QGroundcontrol

I did roscore and then I performed,

rostopic echo \mavros\setpoint_position\local

It displays the setpoint now.

@Vrinda Good to hear it all worked out. Best of luck

Thanks much @Jaeyoung-Lim ! : )

Hello @Jaeyoung-Lim !
I followed the tutorial given in dev guide for offboard control and also modified the node to perform trajectory tracking. However , after 2 minutes, the quad become unstable. Does this happen normally? Is this due to battery discharge in Gazebo ? I thought of asking you this. Thanks much !

I get these errors in gazebo(left top) and mavros (extreme right bottom). Thanks much for your inputs on this.