2 #include "crazyflie_driver/AddCrazyflie.h" 3 #include "crazyflie_driver/LogBlock.h" 5 int main(
int argc,
char **argv)
12 std::string tf_prefix;
16 bool enable_parameters;
18 bool enable_logging_imu;
19 bool enable_logging_temperature;
20 bool enable_logging_magnetic_field;
21 bool enable_logging_pressure;
22 bool enable_logging_battery;
23 bool enable_logging_pose;
24 bool enable_logging_packets;
28 n.
param(
"roll_trim", roll_trim, 0.0);
29 n.
param(
"pitch_trim", pitch_trim, 0.0);
30 n.
param(
"enable_logging", enable_logging,
true);
31 n.
param(
"enable_parameters", enable_parameters,
true);
32 n.
param(
"use_ros_time", use_ros_time,
true);
33 n.
param(
"enable_logging_imu", enable_logging_imu,
true);
34 n.
param(
"enable_logging_temperature", enable_logging_temperature,
true);
35 n.
param(
"enable_logging_magnetic_field", enable_logging_magnetic_field,
true);
36 n.
param(
"enable_logging_pressure", enable_logging_pressure,
true);
37 n.
param(
"enable_logging_battery", enable_logging_battery,
true);
38 n.
param(
"enable_logging_pose", enable_logging_pose,
false);
39 n.
param(
"enable_logging_packets", enable_logging_packets,
true);
42 ROS_INFO(
"wait_for_service /add_crazyflie");
46 crazyflie_driver::AddCrazyflie addCrazyflie;
47 addCrazyflie.request.uri = uri;
48 addCrazyflie.request.tf_prefix = tf_prefix;
49 addCrazyflie.request.roll_trim = roll_trim;
50 addCrazyflie.request.pitch_trim = pitch_trim;
51 addCrazyflie.request.enable_logging = enable_logging;
52 addCrazyflie.request.enable_parameters = enable_parameters;
53 addCrazyflie.request.use_ros_time = use_ros_time;
54 addCrazyflie.request.enable_logging_imu = enable_logging_imu;
55 addCrazyflie.request.enable_logging_temperature = enable_logging_temperature;
56 addCrazyflie.request.enable_logging_magnetic_field = enable_logging_magnetic_field;
57 addCrazyflie.request.enable_logging_pressure = enable_logging_pressure;
58 addCrazyflie.request.enable_logging_battery = enable_logging_battery;
59 addCrazyflie.request.enable_logging_pose = enable_logging_pose;
60 addCrazyflie.request.enable_logging_packets = enable_logging_packets;
62 std::vector<std::string> genericLogTopics;
63 n.
param(
"genericLogTopics", genericLogTopics, std::vector<std::string>());
64 std::vector<int> genericLogTopicFrequencies;
65 n.
param(
"genericLogTopicFrequencies", genericLogTopicFrequencies, std::vector<int>());
67 if (genericLogTopics.size() == genericLogTopicFrequencies.size())
70 for (
auto&
topic : genericLogTopics)
72 crazyflie_driver::LogBlock logBlock;
73 logBlock.topic_name =
topic;
74 logBlock.frequency = genericLogTopicFrequencies[i];
75 n.
getParam(
"genericLogTopic_" +
topic +
"_Variables", logBlock.variables);
76 addCrazyflie.request.log_blocks.push_back(logBlock);
82 ROS_ERROR(
"Cardinality of genericLogTopics and genericLogTopicFrequencies does not match!");
86 addCrazyflieService.
call(addCrazyflie);
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
int main(int argc, char **argv)
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
bool getParam(const std::string &key, std::string &s) const