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

Lauran's profile - activity

2020-11-07 14:05:46 -0500 received badge  Famous Question (source)
2020-11-07 14:05:46 -0500 received badge  Notable Question (source)
2020-04-30 07:34:51 -0500 received badge  Famous Question (source)
2020-04-30 07:34:51 -0500 received badge  Notable Question (source)
2019-08-22 10:22:06 -0500 received badge  Student (source)
2018-04-03 20:07:20 -0500 received badge  Famous Question (source)
2018-04-03 20:07:20 -0500 received badge  Notable Question (source)
2018-01-30 08:09:23 -0500 received badge  Popular Question (source)
2018-01-30 03:52:03 -0500 commented answer Read variable from PoseStamped C++

Thank you. I just managed to find that as well :)

2018-01-30 03:51:36 -0500 marked best answer Read variable from PoseStamped C++

Hello,

I am having some issues with reading a variable from the message PoseStamped. I can call the callback function and when I write something to read out the message I get the following error.

'const_pose_type' has no member named 'pose'
x_current = msg->pose.pose.position.x;

I get the message from another computer which is connected with an UTP cable as a slave to my computer which is the master. In the terminal I can echo the message and see that it is sending coordinates. The code that is running is as following.

#include "ros/ros.h"
#include <sstream>
#include "geometry_msgs/PoseStamped.h"

#include <vector>

std::vector<geometry_msgs::PoseStamped::ConstPtr> pose;

double x_current = 0;

void tf_callback(const geometry_msgs::PoseStamped::ConstPtr& msg) {
    ROS_INFO_STREAM("Received pose: " << msg);
    x_current = msg->pose.pose.position.x;
    ROS_INFO_STREAM(x_current);
    pose.push_back(msg);
}

int main(int argc, char **argv) {
    ros::init(argc, argv, "subscriberTF");
    ros::NodeHandle nh;
    ros::Subscriber subscribetf = nh.subscribe("/visp_auto_tracker1/object_position", 1000, tf_callback);
    ros::spin();
    return(0);
}

Could someone please have a look at my code to see what I do wrong so that I can import the variables from the function the proper way. I want to publish the coordinates to the tf afterwards.

Thank you.

2018-01-30 03:38:53 -0500 asked a question Read variable from PoseStamped C++

Read variable from PoseStamped C++ Hello, I am having some issues with reading a variable from the message PoseStamped.

2018-01-25 12:52:06 -0500 commented answer MoveIt stop command usage

I have also managed to implement stopping the UR5 while it moves when the stop void is within the same script as where t

2018-01-25 06:07:47 -0500 received badge  Famous Question (source)
2018-01-25 06:07:26 -0500 marked best answer MoveIt stop command usage

Hello,

I want to stop a UR5 while it is executing a movement. Now, I have three different scripts. One which sends information like coordinates and variables. One which makes the UR5 execute a movement and the third script should stop the robot. My question is now, how can I stop the robot. I found a command which should stop it. I've read on some forum that it should work with some delay.

void moveit::planning_interface::MoveGroup::stop (void)

So my question basically is: How do I implement this void in my code in such a way that I can make the UR5 stop. This is what I currently have.

#include <iostream>
#include <ros/ros.h>
#include <moveit/move_group_interface/move_group.h>
#include <sstream>
#include <ur5_inf3480/Coor.h>

class StopRobot {
public:
    int a;
    int counter;
    void stop(void);
    void PublishCoordinatesCallback(const ur5_inf3480::Coor msg);
};

void StopRobot::PublishCoordinatesCallback(const ur5_inf3480::Coor msg) {
    a = msg.a;
    counter = msg.counter;
}

void StopRobot::stop(void) {
    moveit::planning_interface::MoveGroup::stop();
  }

int main(int argc, char **argv) {
    ros::init(argc, argv, "coordinates");
    ros::NodeHandle nh;
    ros::Rate loop_rate(30);
    StopRobot sr;
    ros::Subscriber sub = nh.subscribe<ur5_inf3480::Coor>("coordinates", 1000, &StopRobot::PublishCoordinatesCallback, &sr);
    int a = sr.a;
    int counter = sr.counter;
    while (ros::ok()) {
        a = sr.a;
        loop_rate.sleep();
        ros::spinOnce();
        if (a == 0) {
            sr.stop();
        }
    }
return 0;
}

When I catkin_make the code like this it gives the following error.

/home/lauran/ur5robot_ws/src/ur5_inf3480/src/stop_robot.cpp: In member function ‘void StopRobot::stop()’:
/home/lauran/ur5robot_ws/src/ur5_inf3480/src/stop_robot.cpp:22:46: error: cannot call member function ‘void moveit::planning_interface::MoveGroup::stop()’ without object
  moveit::planning_interface::MoveGroup::stop();

I have tried to do different sorts of code but every code gives another error. So I'm a bit stuck now on how the usage of this certain command is. Could someone please help me on this.

Thank you.

2018-01-25 06:07:16 -0500 commented answer MoveIt stop command usage

There still seems to be some delay before it actually stops though, this might be because I ros::init twice. In the move

2018-01-25 06:03:49 -0500 commented answer MoveIt stop command usage

The error is solved! I gave the movegroup the wrong name. Now I have given it the same name as the movegroup that moves

2018-01-25 06:03:49 -0500 received badge  Commentator
2018-01-24 02:26:06 -0500 commented answer MoveIt stop command usage

I had tried earlier to see what happens in my script that moves the UR5 whenever I move the UR5. I see that my script th

2018-01-24 02:25:13 -0500 commented answer MoveIt stop command usage

note: candidate expects 3 arguments, 0 provided And then all four follow with this or something like this: moveit::p

2018-01-24 02:24:48 -0500 commented answer MoveIt stop command usage

note: candidate expects 3 arguments, 0 provided And then all four follow with this or something like this: moveit::p

2018-01-24 02:24:32 -0500 commented answer MoveIt stop command usage

note: candidate expects 3 arguments, 0 provided And then all four follow with this or something like this: moveit::p

2018-01-24 02:23:45 -0500 commented answer MoveIt stop command usage

I had tried earlier to see what happens in my script whenever I try to move the UR5. I see that my script waits until th

2018-01-24 02:22:43 -0500 commented answer MoveIt stop command usage

note: candidate expects 3 arguments, 0 provided And then all four follow with this or something like this: moveit::pl

2018-01-24 02:21:38 -0500 commented answer MoveIt stop command usage

When I catkin_make the adjustment I get many errors starting with: error: no matching function for call to ‘moveit::pl

2018-01-23 02:53:09 -0500 received badge  Notable Question (source)
2018-01-22 11:45:02 -0500 edited question MoveIt stop command usage

MoveIt stop command usage Hello, I want to stop a UR5 while it is executing a movement. Now, I have three different sc

2018-01-22 11:45:02 -0500 received badge  Editor (source)
2018-01-22 11:41:47 -0500 commented question MoveIt stop command usage

Yes of course, sorry for that.

2018-01-22 11:12:34 -0500 received badge  Popular Question (source)
2018-01-22 03:34:51 -0500 asked a question MoveIt stop command usage

MoveIt stop command usage Hello, I want to stop a UR5 while it is executing a movement. Now, I have three different sc

2018-01-17 03:25:05 -0500 received badge  Enthusiast
2018-01-16 16:56:34 -0500 commented answer Use variables in main from callback

Okay, I wasn't sure if I had to start a new question. Thank you

2018-01-16 10:36:33 -0500 received badge  Popular Question (source)
2018-01-16 07:48:27 -0500 marked best answer Import variables from a message

Hello,

In my code I would like to get a variable from my message and use this in my main. Whenever I run this code "x" is said to be 0.00. This should be a different number. In my message I declare my variables as float32. I feel like I don't use x = msg.x the proper way. I know that my message is being send the right way. Because in a different code I was able to ROS_INFO_STREAM(x). This showed that it receives the right x value. Could someone please look at my code and hopefully see where I make a mistake?

#include <iostream>
#include <ros/ros.h>
#include <moveit/move_group_interface/move_group.h>
#include <sstream>
#include <ur5_inf3480/Coor.h>

using namespace std;

class MoveRobot {
    public:
        double x;
    double y;
    double z;
    double roll;
    double pitch;
    double yaw;
    double a;
    void PublishCoordinatesCallback(const ur5_inf3480::Coor msg);
};

void MoveRobot::PublishCoordinatesCallback(const ur5_inf3480::Coor msg) {
    x = msg.x;
    y = msg.y;
    z = msg.z;
    roll = msg.roll;
    pitch = msg.pitch;
yaw = msg.yaw;
a = msg.a;
}

int main(int argc, char **argv) {
    ros::init(argc, argv, "coordinates");
    ros::NodeHandle nh;
    ros::Rate loop_rate(30);
    MoveRobot moverobot;
    ros::Subscriber sub = nh.subscribe<ur5_inf3480::Coor>("topic_subscribed", 1, &MoveRobot::PublishCoordinatesCallback, &moverobot);
    while (ros::ok())
    {
        ROS_INFO("This is x: %.2f", moverobot.x);
    }
    loop_rate.sleep();
    ros::spin();
    return 0;
}

I hope I won't ask a question which has been asked already. I tried to search the forum and the internet first but I can't find a solution. Thank you for your answers!

2018-01-16 07:48:24 -0500 received badge  Supporter (source)
2018-01-16 07:48:21 -0500 commented answer Import variables from a message

Okay, I will just make it publish fast then. Thank you for your help and the link. This forum really makes me learn more

2018-01-16 07:31:25 -0500 commented answer Import variables from a message

I am on the right track! Whenever I set my ros::Rate loop_rate(); faster. x goes from 0.00 to the value faster. Is there

2018-01-16 07:28:18 -0500 commented answer Import variables from a message

Thank you for your answer! The change in code didn't show any difference. It still just said x was 0.00. But when I star