Commit 820cce94 authored by bucyril's avatar bucyril
Browse files

client not uses most of the CrazyflieContext, except for area

parent 170bad39
......@@ -37,8 +37,6 @@ CONTROLLER_ANGLE = 1
CONTROLLER_RATE = 0
RAD_TO_DEG = 57.296
bag = rosbag.Bag('/home/d-fall/D-FaLL-System/pps_ws/src/d_fall_pps/test.bag', 'w')
class PPSRadioClient:
"""
CrazyRadio client that recieves the commands from the controller and
......@@ -147,24 +145,25 @@ if __name__ == '__main__':
# Initialize the low-level drivers (don't list the debug drivers)
cflib.crtp.init_drivers(enable_debug_driver=False)
if rospy.has_param("~crazyFlieAddress"):
radio_address = rospy.get_param("~crazyFlieAddress")
rospy.loginfo("Crazyradio connecting to %s" % radio_address)
global cf_client
while not rospy.has_param("~crazyFlieAddress"):
time.sleep(0.05)
#wait until address parameter is set by PPSClient
radio_address = "radio://" + rospy.get_param("~crazyFlieAddress")
rospy.loginfo("Crazyradio connecting to %s" % radio_address)
global cf_client
cf_client = PPSRadioClient(radio_address)
time.sleep(1.0)
cf_client = PPSRadioClient(radio_address)
time.sleep(1.0)
rospy.Subscriber("PPSClient/ControlCommand", ControlCommand, controlCommandCallback)
rospy.Subscriber("PPSClient/ControlCommand", ControlCommand, controlCommandCallback)
rospy.spin()
rospy.loginfo("Turning off crazyflie")
rospy.spin()
rospy.loginfo("Turning off crazyflie")
cf_client._send_to_commander(0, 0, 0, 0, 0, 0, 0, 0, CONTROLLER_MOTOR)
#wait for client to send its commands
time.sleep(1.0)
cf_client._send_to_commander(0, 0, 0, 0, 0, 0, 0, 0, CONTROLLER_MOTOR)
#wait for client to send its commands
time.sleep(1.0)
cf_client._cf.close_link()
rospy.loginfo("Link closed")
else:
rospy.logerr("No radio address provided")
cf_client._cf.close_link()
rospy.loginfo("Link closed")
teamName: "Two"
crazyFlieName: "cfTwo"
crazyFlieAddress: "radio://0/69/2M"
safeController: "SafeControllerService/RateController"
customController: ""
......@@ -150,10 +150,13 @@ void loadCrazyflieContext() {
if(centralManager.call(contextCall)) {
context = contextCall.response.crazyflieContext;
ROS_INFO_STREAM("CrazyflieContext:" << context);
ROS_INFO_STREAM("CrazyflieContext:\n" << context);
} else {
ROS_ERROR("Failed to load context");
}
ros::NodeHandle nh("CrazyRadio");
nh.setParam("crazyFlieAddress", context.crazyflieAddress);
}
void loadSafeController() {
......
Supports Markdown
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