generalized-intelligence / GAAS

GAAS is an open-source program designed for fully autonomous VTOL(a.k.a flying cars) and drones. GAAS stands for Generalized Autonomy Aviation System.
https://www.gaas.dev
BSD 3-Clause "New" or "Revised" License
1.94k stars 444 forks source link

Stuck on Tutorial #5 #115

Closed atieh-sahraei closed 3 years ago

atieh-sahraei commented 4 years ago

Context

Setup information:

Expected Behavior

I have installed the prerequisites properly, and want to run the vision-based auto-landing example.

Current Behavior

But when I run the python script " px4_mavros_run.py " . It gives the following error:

Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/mavros_msgs/msg/_PositionTarget.py", line 168, in serialize buff.write(_get_struct_BH9d2f().pack(_x.coordinate_frame, _x.type_mask, _x.position.x, _x.position.y, _x.position.z, _x.velocity.x, _x.velocity.y, _x.velocity.z, _x.acceleration_or_force.x, _x.acceleration_or_force.y, _x.acceleration_or_force.z, _x.yaw, _x.yaw_rate)) struct.error: required argument is not a float

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 882, in publish self.impl.publish(data) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 1066, in publish serialize_message(b, self.seq, message) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/msg.py", line 152, in serialize_message msg.serialize(b) File "/opt/ros/melodic/lib/python2.7/dist-packages/mavros_msgs/msg/_PositionTarget.py", line 169, in serialize except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/message.py", line 364, in _check_types raise SerializationError(str(exc)) genpy.message.SerializationError: <class 'struct.error'>: 'required argument is not a float' when writing 'header:

The whole output of the command-line:

Px4 Controller Initialized! Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Waiting for initialization. Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/mavros_msgs/msg/_PositionTarget.py", line 168, in serialize buff.write(_get_struct_BH9d2f().pack(_x.coordinate_frame, _x.type_mask, _x.position.x, _x.position.y, _x.position.z, _x.velocity.x, _x.velocity.y, _x.velocity.z, _x.acceleration_or_force.x, _x.acceleration_or_force.y, _x.acceleration_or_force.z, _x.yaw, _x.yaw_rate)) struct.error: required argument is not a float

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 882, in publish self.impl.publish(data) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 1066, in publish serialize_message(b, self.seq, message) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/msg.py", line 152, in serialize_message msg.serialize(b) File "/opt/ros/melodic/lib/python2.7/dist-packages/mavros_msgs/msg/_PositionTarget.py", line 169, in serialize except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/message.py", line 364, in _check_types raise SerializationError(str(exc)) genpy.message.SerializationError: <class 'struct.error'>: 'required argument is not a float' when writing 'header: seq: 1 stamp: secs: 261 nsecs: 536000000 frame_id: '' coordinate_frame: 9 type_mask: 1016 position: x: 0 y: 0 z: 3.2 velocity: x: 0.0 y: 0.0 z: 0.0 acceleration_or_force: x: 0.0 y: 0.0 z: 0.0 yaw: None yaw_rate: 1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "px4_mavros_run.py", line 308, in con.start() File "px4_mavros_run.py", line 77, in start self.local_target_pub.publish(self.cur_target_pose) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 886, in publish raise ROSSerializationException(str(e)) rospy.exceptions.ROSSerializationException: <class 'struct.error'>: 'required argument is not a float' when writing 'header: seq: 1 stamp: secs: 261 nsecs: 536000000 frame_id: '' coordinate_frame: 9 type_mask: 1016 position: x: 0 y: 0 z: 3.2 velocity: x: 0.0 y: 0.0 z: 0.0 acceleration_or_force: x: 0.0 y: 0.0 z: 0.0 yaw: None yaw_rate: 1'

cyanine-gi commented 3 years ago

I don't know which version of python you are using. In ubuntu 16.04 it seems everything works correctly.

Maybe you should edit the msg content just like: ........position.x = x*1.0

to ensure the type of this variable is float.