position_mockup.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 Technical University of Munich, Chair of Materials Handling,
3  * Material Flow, Logistics – All Rights Reserved
4  *
5  * You may use, distribute and modify this code under the terms of the 3-clause
6  * BSD license. You should have received a copy of that license with this file.
7  * If not, please write to {kontakt.fml@ed.tum.de}.
8  */
9 
10 #include "ros/ros.h"
11 #include "vda5050_msgs/AGVPosition.h"
12 
13 
14 int main(int argc, char **argv)
15 {
16  ros::init(argc, argv, "order_publisher");
17  ros::NodeHandle nh;
18 
19  float start_x = 10.0;
20  float start_y = 10.0;
21  float goal_x = 16.413757;
22  float goal_y = 19.216549;
23 
24  int i = -3;
25  // initialize a publisher
26  ros::Publisher position_pub = nh.advertise<vda5050_msgs::AGVPosition>("agvPosition", 1000);
27 
28  ros::Rate loop_rate(0.5);
29 
30  while (ros::ok())
31  {
32  vda5050_msgs::AGVPosition posMsg;
33  posMsg.x = start_x+(goal_x-start_x)/10*i;
34  posMsg.y = start_y+(goal_y-start_y)/10*i;
35  posMsg.theta = 0;
36  posMsg.deviationRange = 0.1;
37  posMsg.mapId = "6d673fe4-8660-4dec-9b06-8d2b6e4ee8d2";
38  posMsg.mapDescription = "Map Id 6d673fe4-8660-4dec-9b06-8d2b6e4ee8d2";
39 
40  position_pub.publish(posMsg);
41 
42  i++;
43 
44  if (i==11)
45  i = 0;
46 
47  ros::spinOnce();
48  loop_rate.sleep();
49  }
50 }
ros::Publisher
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros.h
ros::spinOnce
ROSCPP_DECL void spinOnce()
main
int main(int argc, char **argv)
Definition: position_mockup.cpp:14
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
ros::ok
ROSCPP_DECL bool ok()
ros::Rate
ros::NodeHandle


vda5050_connector
Author(s): Florian Rothmeyer , Florian Spiegel
autogenerated on Wed Mar 22 2023 02:38:56