Commit 2ae90dd4 authored by phfriedl's avatar phfriedl
Browse files

Launch file added that starts PPSClient and ViconDataPublisher at the moment

studentParams.yaml added that will be used by students to change their crazyflie, etc

PPSClient.cpp changed: gets data from ViconDataPublisher and extracts data according the chosen crazyflie. TODO: connection with controller
parent af27decc
<!-- Might be needed when our CrazyRadio works. There is no CrazyRadio.launch file yet!
<include file="$(find d_fall_pps)/launch/CrazyRadio.launch" />
<node pkg="d_fall_pps" name="ViconDataPublisher" output="screen" type="ViconDataPublisher">
<node pkg="d_fall_pps" name="PPSClient" output="screen" type="PPSClient">
<rosparam command="load" file="$(find d_fall_pps)/launch/studentParams.yaml" />
<!-- We will need something similar for our Control node(s)
<node pkg="d_fall_pps" name="SafeControllerService" output="screen" type="FlightControl">
<!-- When we have a GUI, this has to be adapted and included
<node pkg="d_fall_pps" name="GUI" output="screen" type="GUI">
<rosparam command="load" file="$(find d_fall_pps)/launch/ControlParams.yaml" />
\ No newline at end of file
TeamName: 'Two'
CrazyFlieName: "cfTwo"
#controllertypes to add with adjustable
#motor, angle and rate
\ No newline at end of file
......@@ -17,10 +17,47 @@
#include "ros/ros.h"
#include "d_fall_pps/ViconData.h"
//the teamname and the assigned crazyflie, will be extracted from studentParams.yaml
std::string team; //is this needed?
std::string cflie;
int callbackCalls = 0;
//is called upon every new arrival of data in main
void viconCallback(const d_fall_pps::ViconData& data){
ROS_INFO("Callback called");
//ROS_INFO("Callback called #%d",callbackCalls);
//ROS_INFO("Recived Pitch in this callback: %f", data.pitch);
//ROS_INFO("received data:"); ROS_INFO_STREAM(data);
//ROS_INFO("My teamname is:"); ROS_INFO_STREAM(team);
//ROS_INFO("My crazyflie is:"); ROS_INFO_STREAM(cflie);
//extract data from "data" and publish/add to service for controller
if(data.crazyflieName == cflie){
d_fall_pps::ViconData myDataToPublish;
myDataToPublish.crazyflieName = data.crazyflieName;
myDataToPublish.x = data.x;
myDataToPublish.y = data.y;
myDataToPublish.z = data.z;
myDataToPublish.roll = data.roll;
myDataToPublish.pitch = data.pitch;
myDataToPublish.yaw = data.yaw;
myDataToPublish.acquiringTime = data.acquiringTime;
//ROS_INFO("data to share with right controller:");
//Some way of choosing the correct controller: Safe or Custom
else {
ROS_INFO("ViconData from other crazyflie received");
......@@ -30,8 +67,16 @@ int main(int argc, char* argv[]){
ros::init(argc, argv, "PPSClient");
ros::NodeHandle nodeHandle("~");
//get the params defined in studentParams.yaml
ROS_ERROR("Failed to get TeamName");
ROS_ERROR("Failed to get CrazyFlieName");
ROS_INFO_STREAM("about to subscribe");
//maybe set second argument to 1 (as we only want the most recent data)
ros::Subscriber ViconSubscriber = nodeHandle.subscribe("/ViconDataPublisher/ViconData", 1, viconCallback);
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