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

Joystick teleoperation #133

Open
TSC21 opened this issue Aug 25, 2014 · 72 comments
Open

Joystick teleoperation #133

TSC21 opened this issue Aug 25, 2014 · 72 comments

Comments

@TSC21
Copy link
Member

TSC21 commented Aug 25, 2014

In bound. Will need some help in the RC override part.

@vooon
Copy link
Member

vooon commented Aug 25, 2014

I think better not a plugin, but script node that use rc_io plugin.

@TSC21
Copy link
Member Author

TSC21 commented Aug 25, 2014

Will that include setpoint stuff?

@TSC21
Copy link
Member Author

TSC21 commented Aug 25, 2014

I'm not very used to the scripts as you saw, I would really prefer a plugin. But I can send you this as a plugin and then you can convert it to a script if you want.

@vooon
Copy link
Member

vooon commented Aug 25, 2014

Just i don't want duplicate code that already exists (and works).

I my mind this node should subscribe to joystick topic and produce rc override messages (or setpoint).
Send me please what data i should send to rc/setpoint and i write script (channel map etc).

@TSC21
Copy link
Member Author

TSC21 commented Aug 25, 2014

Ok I would do that right away

@TSC21
Copy link
Member Author

TSC21 commented Aug 25, 2014

@vooon sent you the e-mail now ;)

@vooon
Copy link
Member

vooon commented Aug 25, 2014

Ok, i'll see it tomorrow.

@TSC21
Copy link
Member Author

TSC21 commented Aug 25, 2014

Sure 👍 Thanks!

@tonybaltovski
Copy link
Contributor

I could add a similar node that I have for this if it is needed. @TSC21

@vooon
Copy link
Member

vooon commented Aug 26, 2014

@tonybaltovski please send it to me. I think it useful example, but perhaps it must be in extras.

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

@tonybaltovski I already started a plugin, which I sent to @vooon so it can adapt the way he wants. It was almost ready for setpoint control, but RC override part I left it to @vooon.

@TSC21
Copy link
Member Author

TSC21 commented Aug 26, 2014

What's the status on this? I would really like to get an hand on this so to test setpoints also :)

@vooon
Copy link
Member

vooon commented Aug 26, 2014

Maybe tomorrow...

@vooon vooon added the extras label Aug 26, 2014
vooon added a commit that referenced this issue Aug 26, 2014
Now it's just proof of concept.
Implemented only RC override of RPYT channels.

Issue #133.
@vooon
Copy link
Member

vooon commented Aug 26, 2014

@TSC21 It's just proof of concept, but it should work.

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

I will try it, thanks! :) But my priority is to test the setpoints using the joystick. If you please can add the possibility of position and velocity control I would be grateful.

For velocity, send cmd_vel as TwistStamped to be subscribed by setpoint_velocity;

The position control is simple: instead of cmd_vel it sends position as PoseStamped but this has to be a particular case - it has to do sum the previous position value sent so it can increment or decrement the position (so the values of x,y,z are not limited to -1..1; what's limited is the value that is added to last value; so if the joystick is always sending +1, in each iteration it sums +1 -> the only doubt I have here is if we have to limit the rate in this case, so the iterations don't some up values to fast).
This one is subscribed by setpoint_position.

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

Update: regarding the /joy topic: I'm not able to retrieve any data from my joystick using the mavteleop script. But using the universal_teleop launch I can. So there must be something missing on the script.

@vooon
Copy link
Member

vooon commented Aug 27, 2014

You run the joy_node?

rosrun joy joy_node

2014-08-27 18:17 GMT+04:00 TSC21 notifications@github.com:

Update: regarding the /joy topic: I'm not able to retrieve any data from
my joystick using the mavteleop script. But using the universal_teleop
launch I can. So there must be something missing on the script.


Reply to this email directly or view it on GitHub
#133 (comment).

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

No! Yeah it works now. Forgot the joy_node. Can't that be included on the script to be launched?

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

Ok now regarding the override itself: echoing /mavros/rc/override wasn't getting any data cause you forgot the prefix / here:

override_pub = rospy.Publisher(args.mavros_ns + "/rc/override", OverrideRCIn, queue_size=10)

Need to correct that or I make a PR.
But still there's no RC overriding on the FCU, since the motors don't even change the speed. Will continue to check what's happening.

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

@vooon RC override it's not working. The script is publishing to /rc/override, which is being subscribed by rc_io.cpp. Echoing /mavros/rc/override gives me channel values changing but nothing happens on the FCU side (no motor spinning changes).

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

My priority isn't the RC override, even though I would like to set it up. But I can't seem to find what's the problem. In the mean time, can you get the setpoint velocity and position control implemented please? (based on the above comment I did regarding the specs of this kind of control)
Thanks!

@tonybaltovski
Copy link
Contributor

I have the same issue with the RC override. The FCU does not use it.

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

@tonybaltovski can you try to debug the reason? I'm occupied with some other stuff regarding POSCTL.

@vooon
Copy link
Member

vooon commented Aug 27, 2014

When i test overrides with APM i found, that it silently drops if override message comes from system_id != SYSID_MYGCS (default: 255).

So i change it to 1 (mavros defaults) and it works. Or we could change mavros system_id.

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

So what is wrong? system_id or comp_id? What it's needed in case of PX4?

@vooon
Copy link
Member

vooon commented Aug 27, 2014

Perhaps PX4 don't handle RC override messages, i can't find handler for MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE message.

@TSC21
Copy link
Member Author

TSC21 commented Aug 27, 2014

Perhaps PX4 don't handle RC override messages, i can't find handler for MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE message.

Yes it seems not. Well too bad, I think we can ask implementation, but I would prefer to get setpoints working. Can you give a hand @vooon please?
Thanks in advance!

@tonybaltovski
Copy link
Contributor

@vooon I will give it another try on my APM tomorrow and let you know.

@vooon
Copy link
Member

vooon commented Aug 29, 2014

289fa6c

(Started before your PR).

@TSC21
Copy link
Member Author

TSC21 commented Aug 29, 2014

You apply parameters to wrong node. I plainly did startup script.

Yes now I understand! Thanks! Will cancel PR then.

@vooon
Copy link
Member

vooon commented Aug 29, 2014

Usage:

  1. start FCU connection: roslaunch mavros px4.launch
  2. start teleoperation: roslaunch mavros_extras teleop.launch

Or create your own launch with <include file="..."> for both files.

@TSC21
Copy link
Member Author

TSC21 commented Aug 29, 2014

Usage:
start FCU connection: roslaunch mavros px4.launch
start teleoperation: roslaunch mavros_extras teleop.launch

Thanks! Will try then!

@TSC21
Copy link
Member Author

TSC21 commented Aug 29, 2014

Working fine now :) just had to change the yaml and done (check 289fa6c - should be rollbot poll). Now I'll be testing this on GCS HIL to see how it goes. What has to be done on the position part @vooon?

@vooon
Copy link
Member

vooon commented Aug 29, 2014

I'm preparing to weekend flights, so it in todo..

@TSC21
Copy link
Member Author

TSC21 commented Aug 29, 2014

I'm preparing to weekend flights, so it in todo..

If you point out myabe I can give a try

@vooon
Copy link
Member

vooon commented Aug 29, 2014

I'll fix typo.
Also need add loading RC limits from FCU params.

@vooon
Copy link
Member

vooon commented Aug 29, 2014

By the way, just noticed that the PX4\Firmware has 500 forks!

@TSC21
Copy link
Member Author

TSC21 commented Aug 29, 2014

By the way, just noticed that the PX4\Firmware has 500 forks!

:D Doesn't surprise given the huge community using Pixhawk and PX4 derivative projects.

@pmukherj
Copy link

Just wanted to comment on this. I was about to write something like just as I saw this issue. Its like the community read my mind :D. Tested it, works like a charm.

@mhkabir
Copy link
Member

mhkabir commented Dec 24, 2014

@pmukherj Can you please outline brief steps on how you got this working on a clean system. I will expand, test and adapt to get this into the wiki.
Thanks.

@vooon
Copy link
Member

vooon commented Dec 24, 2014

@mhkabir I think best place in wiki - tutorial pages (currently not exist in mavros space).

@mhkabir
Copy link
Member

mhkabir commented Dec 24, 2014

@vooon I meant PX4 wiki :) I can add a note to README.

@pmukherj
Copy link

Sure thing! I wanna make sure I didn't take any redundant steps (upgrading the firmware to the dev version may have been not required etc.). I'll write something up today.

@pmukherj
Copy link

@mhkabir I couldn't fly today due to bad weather in Canada, but while bench testing I noticed that when a non-zero r,p,y command is sent (using the joystick) there is no audible change in the motor power. When I control the thrust (through the f710 joystick), I can hear the motors whine up and down. When I swing the body of the quadrotor around, I can hear the motors whine and try and compensate. However, when I give it large a r,p,y command to target through the setpoint/attitude command there is no such compensation heard. Are there any feedback messages implemented as part of mavros, something that acknowledges a command being implemented (maybe the individual motor powers or something?).
I do wanna make sure this is working before I document it, and would rather prove it on a bench then through a crash :P.

@mhkabir
Copy link
Member

mhkabir commented Dec 25, 2014

@pmukherj Can you please IM me on Gitter or Hangouts (mhkabir98@gmail.com). Lets walk through with this. I need more info about your setup.
There is a LOCAL_POSITION_TARGET_NED message and ATTITUDE_TARGET message which aren't in mavros. I'll patch it through as a part of the code refactoring we want to do for the setpoint plugins. Also for these controller target streams, you need to explicitly stream them on PX4 side.
Offboard control is experimental, and this plugin untested, so I am not sure where things go wrong yet. I need more data.

@pmukherj
Copy link

Sorry, Right, I was busy doing some DAQ flights.
So, ATTITUDE_TARGET sounds like exactly what I need to make sure the pixhawk is trying to attain the joystick commands I'm sending it. I have a 3DR, pixhawk with a larger computer mounted onboard (px4 stack works fabulously btw, just missing some flight modes).

I can look into that or do you have a fork with this implemented?

@mhkabir
Copy link
Member

mhkabir commented Dec 29, 2014

@pmukherj I'm looking into getting attitude and position targets into my visualiser plugin. There are some tf issues, so I'm solving those.
What onboard companion computer are you using?
Regarding the targets, you don't really need to implement anything. Just use the UDP bridge we have on mavros and patch a link through to QGC on your development computer. You can view and plot everything there.

@pmukherj
Copy link

pmukherj commented Jan 4, 2015

Sorry! Moving offices over new years.
I'm testing with all sorts of computers (odroids, TK1's etc.). I'll take a crack at using a UDP bridge.
I'm guessing I can use any of the telemetry connections into the pixhawk? In addition to the companion computer, I also have a wireless connection into one of the telemetry ports (as is standard with 3DR pixhawk).

@pmukherj
Copy link

pmukherj commented Jan 4, 2015

Yup. Verified that the setpoints are actually working! The internal setpoints are accepting it, and the controller outputs are also visible. Now for flight tests :). Wish me luck.

@mhkabir
Copy link
Member

mhkabir commented Jan 4, 2015

@pmukherj You can connect the companion to your TELEM2 port and start it via extras.txt in your microSD card.
Good that the setpoints are working. Best of luck with the flights.
Please check : http://www.pixhawk.org/dev/ros/mavros_offboard
At the bottom there is blank code line, where you should add the mavros command you used to change to offboard mode ( as an option for people if they want to )

Also, can you please add the order for flight testing here : http://www.pixhawk.org/dev/offboard_control/testing

Just put in the points, and I'll clean it up.

@mhkabir
Copy link
Member

mhkabir commented Jan 29, 2015

@vooon The joystick plugin works fine, but crashes too badly if one of the axes aren't found or out of range, etc.

@vooon
Copy link
Member

vooon commented Jan 29, 2015

We can add min/max limitting.

Note that was not a plugin, node.

@vooon vooon changed the title Joystick plugin Joystick teleoperation Jan 29, 2015
@mhkabir
Copy link
Member

mhkabir commented Jan 29, 2015

True ;)
I think I'll do it as a plugin, as the script/python seems rather confusing + unreliable.

@vooon
Copy link
Member

vooon commented Jan 29, 2015

I don't want plugin because it's reinventing the wheel. Maximum rewrite from python to C++.
But really not needed when mavteleop runs on desctop and controls OBC's mavros.

@TSC21
Copy link
Member Author

TSC21 commented Jun 11, 2015

@vooon have you thought in a way of solving this?

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

5 participants