ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Changing parameters with Python

asked 2017-06-01 08:27:29 -0500

Tagga gravatar image

Hi

I am trying to change 1 parameter on the launch of my scripts to avoid doing this every time before launching it. The parameter I am trying to change is the "SYSID_MYGCS" which has to be 1.

My current code is:

    rospy.wait_for_service('/mavros/param/set')
try:
    change_mode = rospy.ServiceProxy('/mavros/param/set', SetMode)
    resp = change_mode("SYSID_MYGCS", 1)
    print "setmode send ok %s" % resp.success
except rospy.ServiceException, e:
    print "Failed SetMode: %s" % e

but it says "Failed SetMode: unable to connect to service: remote error reported: client wants service /mavros/param/set to have md5sum 48ecf639e39052f8856a839dcddf826a, but it has c423cafb898fff374cbe8530ecd4d285. Dropping connection."

I am also not sure if the code is correct because I can't find any decent tutorial for python for changing parameters. The AddInts tutorial on ROS isn't able to help me in this case. My geuss is that my code is incorrect. Does anyone know what the correct way is to change the parameter through Python?

Many thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-01 12:51:14 -0500

NEngelhard gravatar image

You call the service with the wrong type. If you look at this list, it looks like the service type is mavros_msgs/ParamSet, but you try to send a mavros_msgs/SetMode.

edit flag offensive delete link more

Comments

Hi, do you know if this still holds for the current mavros version? Thanks!

fabbro gravatar image fabbro  ( 2020-11-05 03:11:30 -0500 )edit

Question Tools

Stats

Asked: 2017-06-01 08:27:29 -0500

Seen: 957 times

Last updated: Jun 01 '17