ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

snowman's profile - activity

2021-02-20 10:54:07 -0500 received badge  Famous Question (source)
2020-04-05 08:46:18 -0500 edited question Timer callback function do not working when action server be called?

Timer callback function do not working when action server be called? Timer callback function do not working when action

2020-04-05 08:42:09 -0500 received badge  Notable Question (source)
2020-01-25 04:54:26 -0500 answered a question teleop_twist_joy to control holonomic drive

I didn't use PS3 control my machine, but I used xbox joy to control it. Maybe http://wiki.ros.org/joy/Tutorials http://

2020-01-25 04:54:26 -0500 received badge  Rapid Responder (source)
2020-01-25 04:38:30 -0500 commented question Timer callback function do not working when action server be called?

If you want to get it in detail. Here is. link text

2020-01-21 10:15:46 -0500 received badge  Popular Question (source)
2020-01-21 10:01:09 -0500 received badge  Supporter (source)
2020-01-21 09:56:46 -0500 commented question How to publish a message to a topic while playing rosbag?

It's not clear from your question what you've tried. I guass rosbag should be used for provide data. Just think it like

2020-01-21 09:56:05 -0500 commented question How to publish a message to a topic while playing rosbag?

It's not clear from your question what you've tried. I think rosbag should be used for provide data. Just think it like

2020-01-21 09:40:48 -0500 marked best answer Timer callback function do not working when action server be called?

Timer callback function do not working when action server be called?

Hello, I find a interested problem just now. It was action server callback function may cause timer callback function do not work.

The reason why I put action-server & timer in same class is that it will be convenient to communicate between Arduino&Moveit. So timer callback function is used for reading & writing data, and action server callback function is used for getting way points. Here is a part of my code.

#ifndef LEAFROBOT_H
#define LEAFROBOT_H
#include "leaf_driver/ManipulatorProtocol.h"

class LeafRobot : public hardware_interface::RobotHW
{
public:
    LeafRobot(),
        as_(nh_, "leaf_controller/follow_joint_trajectory", 
           boost::bind(&LeafRobot::executeCB, this, _1), 
           false)
    {
       .......
       clock = 0.02;    //0.02s
       timer = nh_.createTimer(ros::Duration(clock), &LeafRobot::timerCallback, this);
       ......
       as_.start();    //action server start
       ......
    };

    virtual ~LeafRobot()
    {
       ......
    };

    bool read()
    {
       //read data and save in readList
       ......
    };

    int write()
    {
       //write data from writeList
       ......
    };

    void timerCallback(const ros::TimerEvent& e)
    {
       //Update readList and write data to Arduino
       cout << "TimerCallback\n";
       write();
       if(read())
       {
           return;
       }
       usleep(1000);
       if(read())
       {
           return;
       }
    };

    void executeCB(actionlib::ServerGoalHandle<control_msgs::FollowJointTrajectoryAction> goal_)
    {
       //Action server callback function
        cout << "executeCB\n";
        actionlib::ActionServer<control_msgs::FollowJointTrajectoryAction>::Goal goal = *(goal_.getGoal());
        goal_handle_ = goal_;
        addWaypoints(goal.trajectory);
        trackMove();

        goal_handle_.setAccepted();    
        result_.error_code = result_.SUCCESSFUL;
        goal_handle_.setSucceeded(result_);
    };

    void trackMove()
    {
       //Every points will load to writeList(a point). 
       //And If readList(a point) is equal writeList(a point), 
       //the function will load next point to writeList.
       ......
    };
    ......
    ......
private:
    ......
    ......
    ros::NodeHandle nh_;
    ros::Time time_current, time_prev;
    ros::Timer timer;
    double clock;
    actionlib::ActionServer<control_msgs::FollowJointTrajectoryAction>  as_;    ![image description](http://)
    control_msgs::FollowJointTrajectoryResult result_; 
    ......
    ......
};
#endif //LEAFROBOT

The main function just have a LeafRobot Object and other simple code.

When it run, terminal just like this.

TimerCallback
TimerCallback
TimerCallback
executeCB
TrackMoving 
Arrive to 0 th point : 
Arrive to 1 th point : 
Ignore 1 th point : 
Arrive to 2 th point : 
Ignore 2 th point : 
Arrive to 3 th point : 
Ignore 3 th point : 
Arrive to 4 th point :

After TrackMoving display , it always display Arrive to X th point : or Ignore X th point : . It means, timerCallback didn't be called when executeCB running. Maybe I need to use timer in C++, or don't use ROS timer and update readList&writeList in main function , through it could not very accurate.

Welcome to take some advise to me.That all, Thanks for your attention.

2020-01-21 09:40:48 -0500 received badge  Scholar (source)
2020-01-21 09:40:27 -0500 answered a question Timer callback function do not working when action server be called?

All right, I don't know what happened. I just replaced actionlib::ActionServer<control_msgs::followjointtrajectoryact

2020-01-21 09:40:27 -0500 received badge  Rapid Responder (source)
2020-01-21 03:41:36 -0500 received badge  Enthusiast
2020-01-21 02:20:38 -0500 marked best answer roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

Hey, When I set python3.5 as default, I got a error. So, I corrected it to python2.7, However, roscore gave me a Error like this

~$ roscore

... logging to /home/wuxueming/.ros/log/67c4edca-e9fb-11e8-a50a-7c2a314f2b58/roslaunch-wuxueming-n8xejek-28640.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://wuxueming-n8xejek:37377/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

auto-starting new master
process[master]: started with pid [28650]
ROS_MASTER_URI=http://wuxueming-n8xejek:11311/

setting /run_id to 67c4edca-e9fb-11e8-a50a-7c2a314f2b58
'ascii' codec can't decode byte 0xe6 in position 16: ordinal not in range(128)
The traceback for the exception was written to the log file
[master] killing on exit

'ascii' codec can't decode byte 0xe6 in position 16: ordinal not in range(128)

How to solve the problem? Thanks so much.

2020-01-20 10:13:47 -0500 answered a question roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

Sorry for later. A long time ago, I had saved this problem . It just need to open terminal and input this $ sudo updat

2020-01-20 10:02:57 -0500 asked a question Timer callback function do not working when action server be called?

Timer callback function do not working when action server be called? Timer callback function do not working when action

2019-03-17 04:31:21 -0500 received badge  Famous Question (source)
2019-03-17 04:30:32 -0500 received badge  Notable Question (source)
2018-11-17 03:13:25 -0500 received badge  Popular Question (source)
2018-11-16 20:47:55 -0500 edited answer roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

OK,I found the answer. I created a workspace in 文档(file), though I deleted the path in ~/.bashrc. Then I delete the use

2018-11-16 20:47:55 -0500 received badge  Editor (source)
2018-11-16 20:34:58 -0500 answered a question roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

OK,I found the answer. I created a workspace in 文档(file), though I deleted the path in ~/.bashrc. Then I delete the use

2018-11-16 19:26:15 -0500 edited question roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16 Hey, When I set python3.5 as default, I got

2018-11-16 19:05:13 -0500 commented question roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

Thanks.And I will update with the full errror message.

2018-11-16 09:40:06 -0500 asked a question roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16

roscore on python2.7 'ascii' codec can't decode byte 0xe6 in position 16 Hey, When I set python3.5 as default, I got