Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set modes with the current mavros code? #134

Closed
TSC21 opened this issue Aug 25, 2014 · 10 comments
Closed

How to set modes with the current mavros code? #134

TSC21 opened this issue Aug 25, 2014 · 10 comments

Comments

@TSC21
Copy link
Member

TSC21 commented Aug 25, 2014

I'm trying to set modes using the command line. Searching in the current scripts I haven't found any which can be used to set modes, which can be only sent by rosservice call /mavros/cmd/set_mode "mode:xxx". Can be a good thing to add to mavcmd some alias like

$ rosrun mavros mavcmd -set_mode <mode_name/MAV_MODE_num>

Anyway, the thing I want to know is how can I set modes beyond the ones of MAV_MODE ENUM available in https://github.com/vooon/mavros/blob/master/mavros/srv/CommandMode.srv? I see there's also the px4_custom_mode.h in src but how can it be used as to set the those modes via terminal, like for example POSCTL or OFFBOARD?

Thanks in advance!

@vooon
Copy link
Member

vooon commented Aug 26, 2014

I do not like that there is more than one way to change the mode (command or SET_MODE).
And I have not decided which interface is easy to use. Also what plugin should do it? Maybe sys_status, but i think i must rename it to system (because now it not only status).

And implementation deference:

  • APM: SET_MODE can change custom modes, while cmd only predefined MAV_MODE
  • PX4: SET_MODE translated to command

Perhaps i remove this shortcut and add set_mode service that will use SET_MODE message.
Also more useful use strings for modes, not numbers.

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

Also what plugin should do it? Maybe sys_status, but i think i must rename it to system (because now it not only status).

That seems to be a good option to me :)

set_mode service that will use SET_MODE message.

This set_mode srv will allow set modes for both PX4 and APM simple and custom modes right?

vooon added a commit that referenced this issue Aug 26, 2014
Previous command shortcut removed.

Issue #136, #134.
vooon added a commit that referenced this issue Aug 26, 2014
Implented only `mode` operation.
Issue #134.
@vooon
Copy link
Member

vooon commented Aug 26, 2014

@TSC21 check new tool - mavsys.

It sets any mode via SET_MODE message.

rosrun mavros mavsys mode -b <ENUM VALUE>
rosrun mavros mavsys mode -c ALTCTL

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

Will do it 👍 just updating mavlink now!

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

It's working! 👍 When adding info to wiki, can you please add a list of all possible base and custom modes available? It can be helpful to users.

@vooon
Copy link
Member

vooon commented Aug 26, 2014

Ok. Now you can find all supported strings here: https://github.com/vooon/mavros/blob/master/mavros/src/lib/uas.cpp#L64

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

Do you know why the PX4 FCU gets to AUTO.LAND when we arm it using the mavsafety arm cmd?

@vooon
Copy link
Member

vooon commented Aug 26, 2014

No idea.

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

I suppose it's the state machine behaviour when receiving that command. Probably ask on the PX4 Firmware side.

@TSC21
Copy link
Member Author

TSC21 commented Aug 29, 2014

Do you know why the PX4 FCU gets to AUTO.LAND when we arm it using the mavsafety arm cmd?

Already know the answer. It's a failsafe measure. If you don't have a RC connected, it goes to AUTO.LAND.

I think I can close this now 👍

@TSC21 TSC21 closed this as completed Aug 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants