-
Notifications
You must be signed in to change notification settings - Fork 986
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
Define setpoints also as a service #126
Comments
@vooon how can I add two arguments like Update: Ok i found out that I can add multiple |
First commit at #127. |
Sent you an e-mail regarding this issue. Can redo it and send a new PR with some inputs from you. Thanks! |
@vooon did you receive my e-mail regarding this issue? |
@vooon no problem ;) Yes there's no difference cause I sent them when I created th PR. What I want to do is send setpoints through the terminal, using cmds similar to this: $ rosrun mavros mavsetp local pos <x> <y> <z> to send a local position setpoint; $ rosrun mavros mavsetp global vel <vx> <vy> <vz> to send a global velocity setpoint (then I can create the global setpoints plugins); $ rosrun mavros mavsetp attitude quat <x> <y> <z> <w> to send a attitude setpoint (with quaternion in this case). But I don't know how to do this using the By the way, I found that with firmware developers that this to work we have to send a Mavlink msg to change the FCU mode to
As you can see on the code of the setpoints plugins, I added the option to send the setpoints through cmd srv, besides the topic listening they were already doing. |
Only local setpoint for now. Issue #126.
@TSC21 check that example. |
It enable PX4 OFFBOARD mode. Issue #126.
@vooon isn't there missing modifications in Note: I sent you already the modifications I did on those so it's easier for you to add. |
@TSC21 I think topic duplicate not needed. If you mean ROS Service, that you should define it as a service, not topic. See service advertise: https://github.com/vooon/mavros/blob/master/mavros/src/plugins/command.cpp#L79 But i think it not needed, simple topic publisher + already implemented topics is enough. |
Ok I understand now. I misjudged the |
It's turning to be difficult to change to I already left some discussion open in the firmware side so this could be solved. |
Update: the firmware accepts the |
@vooon some corrections have to be made: since the FCU enters in def publish_once(args, pub, msg):
pub.publish(msg)
# stick around long enough for others to grab
timeout_t = rospy.get_time() + _ONCE_DELAY
while not rospy.is_shutdown() and rospy.get_time() < timeout_t:
rospy.sleep(0.2)
enable_offboard(args)
print_if(pub.get_num_connections() < 1,
"Mavros not started, nobody subcsribes to", pub.name) and def do_local_pos(args):
pub = rospy.Publisher(args.mavros_ns + "/setpoint/local_position", PoseStamped,
queue_size=10, latch=True)
rospy.init_node("mavsetp", anonymous=True)
pos = PoseStamped(header=Header(frame_id='mavsetp', stamp=rospy.get_rostime()))
pos.pose.position = Point(x=args.position[0], y=args.position[1], z=args.position[2])
publish_once(args, pub, pos)
def do_local_vel(args):
pub = rospy.Publisher(args.mavros_ns + "/setpoint/cmd_vel", TwistStamped,
queue_size=10, latch=True)
rospy.init_node("mavsetp", anonymous=True)
vel = TwistStamped(header=Header(frame_id='mavsetp', stamp=rospy.get_rostime()))
vel.twist.linear = Vector3(x=args.velocity[0], y=args.velocity[1], z=args.velocity[2])
publish_once(args, pub, vel) That way it will activate |
Hi Guys, I can see it is closed, however I have problems with this issue. I can see that in the newest mavros the code is completely different and I am not sure howe are these issues solved there. What would be your suggestion for us? Keep old version without offboard mode? Kind regards Witold |
This offers two possibilities:
I can advance by creating a new script called
mavsetp
. This one will be divided in 3:local
,global
andattitude
(we still have the possibility of creating a setpoint global plugin). First two offer the services to controlpos
,vel
andaccel
, while the second one offers control overquat
andrpy
.So the command can be issued like:
The text was updated successfully, but these errors were encountered: