Check Drone status


#1

Hello Srv,

Is there any way to check drone is in take of state or landing state.
In flytconsole there is some log to monitoring the status.

is any api available for it.

Thanks


#2

Can you please explain this in detail? a screenshot should suffice.

You have to subscribe to /flytsim/flyt/state rostopic. In your installed version of FlytSIM, i guess you would have to add this topic in the rostful launch file.
During takeoff, the value would be API|TAKEOFF
During land, the value would be API|LAND

Run this command in terminal to check it:
rostopic echo /flytsim/flyt/state


#3

Hello Srv,

Here is the status :

How do i know in android, the drone is take off or land.

rostopic echo /flytsim/flyt/state
shows me in drone status in terminal,

Is there any api to check the drone status in android.


#4

Hi Trilok,

Have you made any websocket call for a rostopic before? Say for HUD or attitude or global position. If yes, then write similar code for /flytsim/flyt/state[quote=“Trilok_Singh, post:3, topic:182”]
Here is the status :
[/quote]

could you encircle in the picture, its a map and a drone, no status!


#5

Hello Srv,

Please check the pic again.

let me try your given code.

/flytsim/flyt/state

can you please tell us the complete structure like this

batteryTopic = new Topic(ros, “/” + prefs.getDroinmodels() + “/mavros/battery”, “mavros_msgs/BatteryStatus”, 1000);
batteryTopic.subscribe(batteryCallbackros = new CallbackRos() {
public void handleMessage(final JSONObject message){
voltage = round(message.getDouble(“voltage”), 2);
current = round(message.getDouble(“current”), 2);



Some thing like this…


#6

Hi ,

The encircled data that you see, is the console log data. To get that data you have to subscribe to /rosout. For the structure of both /rosout and /flytsim/flyt/state , I am asking @vallabh to help you out.


#7

Hi Trilok,
The structure for flyt/state would look something like this

    stateTopic=new Topic(ros,"/"+namespace+"/flyt/state" , "mavros_msgs/State",200);
    stateTopic.subscribe(new CallbackRos(){
        //callback method- what to do when messages recieved.
        @Override
        public void handleMessage(JSONObject message){
            status=message.getString("mode");
        }
    });

And similarly for /rosout

    logTopic=new Topic(ros,"/rosout" , "rosgraph_msgs/Log",10);
    logTopic.subscribe(new CallbackRos(){
        //callback method- what to do when messages recieved.
        @Override
        public void handleMessage(JSONObject message){
            logMessage=message.getString("msg");
        }
    });

#8

Hello Vallabh,

I tried this code and got response from drone.

But mostly it shown API|POSCTL

i want to know the current status of drone. like
Drone is in the air or not.

In flight console the message box show the status
FREEFALL DETECTED
LANDING DETECTED

I want same like this.

When i open the application. then i got the drone current status. it is in landing position or take off.

I think you got my point.

Your given code show all api responce and status. but i want to know the current status of drone only.


#9

Hi Trilok,
In flytconsole those messages are shown from subscribing to /rosout topic. An addtional filter is also applied in flytconsole that allows messages with FCU keyword in the messages. Hence all the messages that are recieved are not shown.


#10

Hello Vallabh,

So flytconsole /rosout topic can filter only the current activity happened in the drone status.

What i do if i want to check the drone is flying or not.

i starts the android / flytconsole and not given any command.

how i get the drone is flying or not.


#11

Hi trilok,
From what i understand if the drone is already in air flying and you just started your app then you need to know whether the drone is currently in air or on ground with no access to previous messages.

For this you can use a different topic mavros/extended_state
You also need to add an entry in the list of topics in rostful launch file as '/$(arg global_namespace)/mavros/extended_state',. in directory `/flyt/flytos/flytcore/share/rostful/launch/rostful.launch

extendedStateTopic=new Topic(ros,"/"+namespace+"/mavros/extended_state" , "mavros_msgs/ExtendedState",200);
extendedStateTopic.subscribe(new CallbackRos(){
    //callback method- what to do when messages recieved.
    @Override
    public void handleMessage(JSONObject message){
        status=message.getInt("landed_state");
    }
});

landed_state will give you values 1 meaning on ground and 2 meaning in air/flying.


#12

Hello Vallabh,

Thanks for getting me,

But the given code will be working for me only correct ?
It will be available in new version of flysim or flytpod.

This is also an important api to check drone status and change the mobile application or website automatically.


#13

Hello Vallabh,

Can you please tell us the correct position where i use this statement.
Example < arg name=“topics” default="[‘turtle1/pose’]" / >"

And it will be :

< arg name=“topics” default="[‘turtle1/pose’, /$(arg global_namespace)/mavros/extended_state ]" />

Thanks Again