Commit 1f96d6f8 authored by Larkin Heintzman's avatar Larkin Heintzman

cube testing updates

parent 0f61d212
...@@ -123,14 +123,18 @@ bool stopMotion(); ...@@ -123,14 +123,18 @@ bool stopMotion();
bool goHome(); bool goHome();
void calibratePositionReference(); void calibratePositionReference(std::vector<float> requestedPosition, std::vector<float> actualPosition);
void updateMagnitudeScaler(float newValue);
std::vector<float> applyRotationMatrixScaling(std::vector<float> inputVec); std::vector<float> applyRotationMatrixScaling(std::vector<float> inputVec);
bool overwatchFunction(dji_osdk_ros::Overwatch::Request &req, dji_osdk_ros::Overwatch::Response &res); bool overwatchFunction(dji_osdk_ros::Overwatch::Request &req, dji_osdk_ros::Overwatch::Response &res);
std::vector<float> DoCalibrationMove(std::vector<float> calibrationVec);
void gpsPosCallback(const sensor_msgs::NavSatFix::ConstPtr& msg); void gpsPosCallback(const sensor_msgs::NavSatFix::ConstPtr& msg);
void posFeedbackCallback(const geometry_msgs::Transform::ConstPtr& msg); void posFeedbackCallback(const geometry_msgs::Transform::ConstPtr& msg);
void posTrackingCallback(const geometry_msgs::Transform::ConstPtr& msg);
#endif // MISSION_NODE_H #endif // MISSION_NODE_H
...@@ -16,23 +16,24 @@ ...@@ -16,23 +16,24 @@
<param name="base_speed" type="double" value="0.5"/> <param name="base_speed" type="double" value="0.5"/>
<param name="min_speed" type="double" value="0.1"/> <param name="min_speed" type="double" value="0.1"/>
<param name="speed_scalar" type="double" value="0.01"/> <param name="speed_scalar" type="double" value="0.5"/>
<!-- max yaw rate in deg/s --> <!-- max yaw rate in deg/s -->
<param name="max_yaw_speed" type="double" value="30.0"/> <param name="max_yaw_speed" type="double" value="30.0"/>
<param name="position_playback" type="bool" value="false"/> <param name="position_playback" type="bool" value="false"/>
<param name="drone_id" type="int" value="0"/> <param name="drone_id" type="int" value="0"/>
<param name="camera_type" type="int" value="1"/> <param name="camera_type" type="int" value="1"/>
<!-- <param name="angle_offset" type="double" value="-33"/> --> <param name="std_move_dist" type="double" value="1.0"/>
<node pkg="dji_osdk_ros" type="bus_driver" name="bus_driver" output="screen"/> <node pkg="dji_osdk_ros" type="bus_driver" name="bus_driver" output="screen"/>
<!-- <node pkg="dji_osdk_ros" type="poseFeedbackConversion.py" name="poseFeedbackConversion" output="screen"> <!-- gps feedback node version -->
<rosparam command="load" param="angleOffset"> <node pkg="dji_osdk_ros" type="poseFeedbackConversion.py" name="poseFeedbackConversion" output="screen">
0.0 <rosparam command="load" param="angleOffset"> 0.0 </rosparam>
</rosparam> <rosparam command="load" param="anchorPoint"> [37.196986, -80.578257, 100.0] </rosparam>
</node> -->
<node pkg="dji_osdk_ros" type="qualisysFeedback.py" name="qualisysFeedback" output="screen">
<param name="trackName" type="string" value="M100_CarbonFiber"/>
</node> </node>
<!-- qualisys feedback node version -->
<!-- <node pkg="dji_osdk_ros" type="qualisysFeedback.py" name="qualisysFeedback" output="screen">
<param name="trackName" type="string" value="M100_CarbonFiber"/>
</node> -->
<node name="waypointGenerator" type="waypointGeneratorRemote.py" pkg="dji_osdk_ros"> <node name="waypointGenerator" type="waypointGeneratorRemote.py" pkg="dji_osdk_ros">
<rosparam command="load" param="anchorPoint"> [37.196986, -80.578257] </rosparam> <rosparam command="load" param="anchorPoint"> [37.196986, -80.578257] </rosparam>
......
...@@ -15,10 +15,11 @@ from tools import lat_lon2meters, meters2lat_lon ...@@ -15,10 +15,11 @@ from tools import lat_lon2meters, meters2lat_lon
import math import math
homeSetFlag = False homeSetFlag = False
# homePoint = PointStamped()
homePoint = NavSatFix() homePoint = NavSatFix()
transform = Transform() transform = Transform()
quat = Quaternion() quat = Quaternion()
translation = Vector3()
posePublisher = rospy.Publisher("pose_feedback", Transform, queue_size = 1)
angleOffset = 0.0 angleOffset = 0.0
def point_rotation(origin, pt, ang): def point_rotation(origin, pt, ang):
...@@ -35,51 +36,34 @@ def point_rotation(origin, pt, ang): ...@@ -35,51 +36,34 @@ def point_rotation(origin, pt, ang):
def rotCallback(data): def rotCallback(data):
global quat global quat
quat = data.orientation; quat = data.quaternion;
# # FINE ill DO it MYself all ALONE
def posCallback(data): def posCallback(data):
global homeSetFlag global quat
global homePoint
global transform
if not homeSetFlag: # mildly hacky, depends on position format we're using for feedback. might build into bus driver and pub from there
# set up home point in yee pee es
homePoint = data
homeSetFlag = True
rospy.loginfo("setting home point...")
# convert and compare against home point # convert and compare against home point
translation = Vector3() homePoint = rospy.get_param("~anchorPoint")
rotation = Quaternion() homePointMeters = lat_lon2meters([homePoint[0], homePoint[1]])
# rotate the xy plane by angle
homePointMeters = lat_lon2meters([homePoint.latitude, homePoint.longitude])
currentPointMeters = lat_lon2meters([data.latitude, data.longitude]) currentPointMeters = lat_lon2meters([data.latitude, data.longitude])
currentOffset = [currentPointMeters[0] - homePointMeters[0], currentPointMeters[1] - homePointMeters[1]] currentOffset = [currentPointMeters[0] - homePointMeters[0], currentPointMeters[1] - homePointMeters[1]]
angleOffset = rospy.get_param("~angleOffset") angleOffset = rospy.get_param("~angleOffset")
currentRotatedOffset = point_rotation([0,0], currentOffset, angleOffset) currentRotatedOffset = point_rotation([0,0], currentOffset, angleOffset)
# performing dark magics # performing dark magics
translation = Vector3()
translation.x = currentRotatedOffset[1] translation.x = currentRotatedOffset[1]
translation.y = currentRotatedOffset[0] translation.y = currentRotatedOffset[0]
translation.z = data.altitude - homePoint.altitude translation.z = data.altitude - homePoint[2]
transform.translation = translation transform.translation = translation
transform.rotation = quat transform.rotation = quat
posePublisher.publish(transform)
def main(): def main():
global transform
rospy.init_node("poseFeedbackConversion") rospy.init_node("poseFeedbackConversion")
rospy.Subscriber("dji_osdk_ros/gps_position", NavSatFix, posCallback, queue_size = 1) rospy.Subscriber("dji_osdk_ros/gps_position", NavSatFix, posCallback, queue_size = 1)
rospy.Subscriber("dji_osdk_ros/imu", Imu, rotCallback, queue_size = 1) rospy.Subscriber("dji_osdk_ros/attitude", QuaternionStamped, rotCallback, queue_size = 1)
posePublisher = rospy.Publisher("pose_feedback", Transform, queue_size = 1) rospy.spin()
while not rospy.is_shutdown(): # get anchor point from params
posePublisher.publish(transform)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -10,21 +10,21 @@ def callback(data): ...@@ -10,21 +10,21 @@ def callback(data):
# save the pose date in transform # save the pose date in transform
transform.rotation = data.pose.orientation transform.rotation = data.pose.orientation
# we must remapp # we must remapp
# transform.translation = data.pose.position #transform.translation = data.pose.position
transform.translation.x = data.pose.position.z transform.translation.x = data.pose.position.x
transform.translation.y = data.pose.position.z
transform.translation.z = data.pose.position.y transform.translation.z = data.pose.position.y
transform.translation.y = data.pose.position.x
def main(): def main():
global transform global transform
rospy.init_node("qualisysFeedback") rospy.init_node("qualisysFeedback", anonymous = True)
name = rospy.get_param("~trackName") name = rospy.get_param("~trackName")
namespace = rospy.get_param("~qualisysName")
rospy.loginfo("looking for track of name " + str(name) + " ...") rospy.loginfo("looking for track of name " + str(name) + " ...")
rospy.Subscriber("/qualisys/" + name + "/pose", PoseStamped, callback, queue_size = 1) rospy.Subscriber("/" + namespace + "/qualisys/" + name + "/pose", PoseStamped, callback, queue_size = 1)
pub = rospy.Publisher("pose_feedback", Transform, queue_size = 1) pub = rospy.Publisher(namespace + "/pose_feedback", Transform, queue_size = 1)
while not rospy.is_shutdown(): while not rospy.is_shutdown():
pub.publish(transform) pub.publish(transform)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -20,9 +20,9 @@ def generateWaypoints(): ...@@ -20,9 +20,9 @@ def generateWaypoints():
# musical drones trajectory is convient test case, but general path is possible # musical drones trajectory is convient test case, but general path is possible
# ring sizes # ring sizes
big = 10 big = 5
med = 5 med = 3
sml = 3 sml = 1
apMeters = lat_lon2meters(anchorPoint) apMeters = lat_lon2meters(anchorPoint)
......
...@@ -53,10 +53,10 @@ if __name__ == '__main__': ...@@ -53,10 +53,10 @@ if __name__ == '__main__':
soundhandle = SoundClient() soundhandle = SoundClient()
rospy.sleep(1) #rospy.sleep(1)
rospy.loginfo('Playing "%s".' % argv[1]) rospy.loginfo('Playing "%s".' % argv[1])
volume = float(argv[2]) if len(argv) == 3 else 1.0 volume = float(argv[2]) if len(argv) == 3 else 1.0
soundhandle.playWave(argv[1], volume) soundhandle.playWave(argv[1], volume)
rospy.sleep(1) #rospy.sleep(1)
#!/bin/bash
source ~/.bashrc
echo "trying to play sound"
rosrun sound_play play.py /home/larkin/musical_drones_audio_files/'04-musicaldrones_25 or 6 to 4.wav'
...@@ -182,8 +182,8 @@ class soundtype: ...@@ -182,8 +182,8 @@ class soundtype:
position = 0 position = 0
duration = 0 duration = 0
try: try:
position = self.sound.query_position(Gst.Format.TIME)[0] position = self.sound.query_position(Gst.Format.TIME)[1]
duration = self.sound.query_duration(Gst.Format.TIME)[0] duration = self.sound.query_duration(Gst.Format.TIME)[1]
except Exception as e: except Exception as e:
position = 0 position = 0
duration = 0 duration = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment