Main Page
Namespaces
Classes
Files
File List
File Members
src
xarm_combined_control_node.cpp
Go to the documentation of this file.
1
/* Copyright 2020 UFACTORY Inc. All Rights Reserved.
2
*
3
* Software License Agreement (BSD License)
4
*
5
* Author: Jason Peng <jason@ufactory.cc>
6
============================================================================*/
7
8
#include "
xarm_combined_hw.h
"
9
10
int
main
(
int
argc,
char
**argv)
11
{
12
ros::init
(argc, argv,
"xarm_controller"
);
13
ros::NodeHandle
nh;
14
double
ctrl_rate = 100;
15
ros::Rate
r(ctrl_rate);
16
17
ros::Duration
(1.0).
sleep
();
18
19
xarm_control::XArmCombinedHW
xarm_hw;
20
if
(!xarm_hw.
init
(nh, nh)) exit(-1);
21
22
controller_manager::ControllerManager
cm(&xarm_hw, nh);
23
24
ros::AsyncSpinner
spinner
(4);
25
spinner.
start
();
26
27
// IMPORTANT: DO NOT REMOVE THIS DELAY !!!
28
/* Wait for correct initial position to be updated to ros_controller */
29
ros::Duration
(2.0).
sleep
();
30
31
ros::Time
ts =
ros::Time::now
();
32
while
(
ros::ok
())
33
{
34
ros::Duration
elapsed =
ros::Time::now
() - ts;
35
ts =
ros::Time::now
();
36
// xarm_hw.read(ts, elapsed);
37
cm.
update
(ts, elapsed, xarm_hw.
need_reset
());
// reset_controllers=true: preempt and cancel current goal
38
39
xarm_hw.
write
(ts, elapsed);
40
r.
sleep
();
41
}
42
spinner.
stop
();
43
return
0;
44
}
controller_manager::ControllerManager
ros::NodeHandle
ros::Time
ros::Duration::sleep
bool sleep() const
ros::init
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
combined_robot_hw::CombinedRobotHW::init
virtual bool init(ros::NodeHandle &root_nh, ros::NodeHandle &robot_hw_nh)
xarm_combined_hw.h
ros::Rate
spinner
void spinner()
main
int main(int argc, char **argv)
Definition:
xarm_combined_control_node.cpp:10
ros::AsyncSpinner::start
void start()
ros::ok
ROSCPP_DECL bool ok()
ros::Rate::sleep
bool sleep()
ros::Duration
ros::Time::now
static Time now()
xarm_control::XArmCombinedHW::need_reset
bool need_reset()
Definition:
xarm_combined_hw.cpp:12
combined_robot_hw::CombinedRobotHW::write
virtual void write(const ros::Time &time, const ros::Duration &period)
controller_manager::ControllerManager::update
void update(const ros::Time &time, const ros::Duration &period, bool reset_controllers=false)
ros::AsyncSpinner::stop
void stop()
ros::AsyncSpinner
xarm_control::XArmCombinedHW
Definition:
xarm_combined_hw.h:14
xarm_controller
Author(s):
autogenerated on Sat May 8 2021 02:51:38