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

PatFGarrett's profile - activity

2020-12-18 12:47:05 -0500 marked best answer Accessing a subscribers data at a different rate

Hello, thanks for any and all responses, but simply:

I am running a control loop that generates and publishes new velocities at 100hz, every-time it calculates a new velocity it needs the current motor shaft position data. However, this position data is subscribed To and arriving at a much higher rate than the control is running.

How can I/best method for accessing the current data from this subscribed to topic at the moment I need it in the control loop?

An example:

ros::Subscriber pointSub;
ros::Subscriber posSub;

float phi = 0.0;     /// a global variable that gets updated 


void controlLoop(const geometry_msgs::Point & currentPoint) {
  //RUNS ONCE!!! triggered by arriving x,y,z point data

  ros::Rate rate(100)
  for(int i = 0 ; i < 100; i++)
  {

      //HERE I WANT THE UPDATED, most recent, PHI VALUE

      ros::spinOnce();
      rate.sleep();
  }

} //END OF control loop

void fastPositionCb(const std_msgs::Float64 currPos) {
  //Gets data published faster than 100hz .... say 1kHz

  phi = CurrPos.data;

}

int main(int argc, char * argv[]) {
  ros::init(argc, argv, "example");
  ros::NodeHandle nh;

  pointSub = nh.subscribe("testPoint", 1, controlLoop);  // happens once
  posSub = nh.subscribe("phiPos", 1, fastPositionCb);   // happens very fast

  // Spin
  ros::spin();
}
2020-12-18 12:46:03 -0500 received badge  Famous Question (source)
2020-04-13 22:54:56 -0500 received badge  Famous Question (source)
2020-04-13 22:54:56 -0500 received badge  Notable Question (source)
2020-02-11 05:40:33 -0500 received badge  Famous Question (source)
2020-01-31 03:08:20 -0500 received badge  Notable Question (source)
2020-01-30 15:12:41 -0500 commented answer Accessing a subscribers data at a different rate

Gvdhoorn, Hello and thank you for response. If i understand your answer and what I read about message_filters is that t

2020-01-30 08:45:32 -0500 edited question Accessing a subscribers data at a different rate

Accessing a subscribers data at a different rate Hello, thanks for any and all responses, but simply: I am running a co

2020-01-30 08:39:54 -0500 commented question Accessing a subscribers data at a different rate

Delb, Thanks for the response, and I apologize for not being very clear. But you are basically right... I want To harne

2020-01-30 04:39:59 -0500 received badge  Popular Question (source)
2020-01-29 23:39:02 -0500 asked a question Accessing a subscribers data at a different rate

Accessing a subscribers data at a different rate Hello, thanks for any and all responses, but simply: I am running a co

2019-11-06 06:00:09 -0500 received badge  Notable Question (source)
2019-10-29 11:58:48 -0500 answered a question ROS Package To Capture Stereo Images

The stereo_view node in the image_view package does exactly this

2019-10-29 11:58:48 -0500 received badge  Rapid Responder (source)
2019-10-29 11:54:27 -0500 asked a question ROS Package To Capture Stereo Images

ROS Package To Capture Stereo Images Hello, I was wondering if anyone was aware of a ROS package that would make it easi

2019-10-29 10:10:57 -0500 received badge  Popular Question (source)
2019-10-18 09:15:08 -0500 received badge  Popular Question (source)
2019-09-11 11:08:11 -0500 commented question Simple RRTConnect planning fails

@BryceWilley thank you for the response. I made the changes to ensure no random data is being set and still the same iss

2019-09-09 12:05:40 -0500 edited question Simple RRTConnect planning fails

Simple RRTConnect planning fails Hello, I am trying to use the MoveIt package to generate the joint values for a pose/po

2019-09-09 12:02:13 -0500 asked a question Simple RRTConnect planning fails

Simple RRTConnect planning fails Hello, I am trying to use the MoveIt package to generate the joint values for a pose/po

2019-09-05 10:04:00 -0500 received badge  Notable Question (source)
2019-09-05 10:01:09 -0500 asked a question Simple Matlab Subscriber/Publisher

Simple Matlab Subscriber/Publisher So ill get right to the point: I have a ROS network running and a matlab script suc

2019-08-19 15:02:02 -0500 marked best answer Launching PowerCube on multiple CAN busses

Hello I am working with a Schunk LWA3 (DOF 7) in ROS with the Schunk PowerCube package.

I have success launching the PowerCube and initializing the modules. The issue is that the arm has the modules broken out onto two difference CAN busses which are connected to different ports on a PCI card. The .yaml file that is taken in by the ROS node is:

powercube_chain parameters
can_module: PCAN
can_device: /dev/pcan0 
can_baudrate: 1000
modul_ids: [1,2,3,4] 
joint_names: [arm_1_joint, arm_2_joint, arm_3_joint, arm_4_joint]
max_accelerations: [0.4,0.4,0.4,0.4]
min_publish_duration: 0.01 
horizon: 0.1 
frequency: 100

ptp_vel: 0.4 # rad/sec
ptp_acc: 0.2 # rad/sec^2
max_error: 0.15 # rad

Again, this works fine and modules with Ids 1,2,3,4 are initialized just fine. However when I try to include a new can_device at /dev/pcan1 (to find modules 5,6,7) it will take whatever device is mentioned second and load the corresponding modules.

Ive tried:

devices: ["/dev/pcan0", "/dev/pcan1"]

This method still causes the first device listed to be used and only those modules found. I also attempted to edit my launch file to look for two different .yaml's but only the second is considered in this case.

Does anyone have experience with this or any suggestions?

Thank you !

Kyle

2019-07-07 17:59:56 -0500 received badge  Famous Question (source)
2019-07-07 17:59:56 -0500 received badge  Notable Question (source)
2019-07-07 17:59:56 -0500 received badge  Popular Question (source)
2019-07-01 05:55:24 -0500 received badge  Famous Question (source)
2019-02-05 09:53:59 -0500 commented question Viewing a .vtk file in rviz

Hello, did you have any success with this?

2018-11-08 13:04:07 -0500 commented question How to get force feedback from PG70 gripper?

Did you have any success with this?

2018-09-18 15:21:28 -0500 received badge  Famous Question (source)
2018-08-02 03:19:14 -0500 marked best answer Help with cob_trajectory_controller

Hello, I am working with cob_trajectory_controller and MoveIt!. Currently I can generate and plan a new trajectory in MoveIt and upon trying to execute the trajectory the cob_controller fails everytime with a out_of_range error.

Here is the error from the cob_trajectory_controller:

core service [/rosout] found
process[arm_controller/joint_trajectory_controller-1]: started with pid [27186]
[ INFO] [1532628301.414878883]: getting JointNames from parameter server: //arm_controller
[ INFO] [1532628301.420821815]: starting controller with DOF: 7 PTPvel: 0.400000 PTPAcc: 0.200000 maxError 0.150000
[ INFO] [1532628301.427403982]: Setting controller frequency to 100.000000 HZ
[ INFO] [1532628416.297625889]: Received new goal trajectory with 20 points
[ INFO] [1532628416.317896242]: Calculated 21 zwischenPunkte
[ INFO] [1532628416.319265583]: Calculated 21 splinepoints
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check
[arm_controller/joint_trajectory_controller-1] process has died [pid 27186, exit code -6, cmd /home/ralab/Documents/ros/devel/lib/cob_trajectory_controller/cob_trajectory_controller __name:=joint_trajectory_controller __log:=/home/ralab/.ros/log/1f275a8e-90fb-11e8-bbfd-7085c274b189/arm_controller-joint_trajectory_controller-1.log].
log file: /home/ralab/.ros/log/1f275a8e-90fb-11e8-bbfd-7085c274b189/arm_controller-joint_trajectory_controller-1*.log

I am using ROS Indigo (cob_trajectory_controller is from indigo-dev), Ubuntu 14.04 32bit, Schunk PowerCube and modular robotics are from Indigo

Any help would be great! Thank you

Kyle

2018-08-01 16:13:29 -0500 answered a question Help with cob_trajectory_controller

SOLVED: The problem was not with the cob trajectory controller but with the /arm_controller/joint_trajectory_controller/

2018-07-30 20:07:42 -0500 commented question IK controlling library for Schunk 7-DOF manipulator

Hello, I am working with a similar arm. I am having trouble with connecting MoveIt! to the COB software. Did you have is

2018-07-26 15:42:23 -0500 asked a question Help with cob_trajectory_controller

Help with cob_trajectory_controller Hello, I am working with cob_trajectory_controller and MoveIt!. Currently I can gene

2018-07-24 08:45:08 -0500 answered a question Launching PowerCube on multiple CAN busses

I was able to fix the issue with a CAN y-cable and connecting them to the same bus on one PCAN device. Im not sure how

2018-07-23 10:36:14 -0500 commented question How to make the PG70 gripper in the Schunk Lwa4p work?

Jorgelu, Hello, thank you for the link below that code helps alot. However I use the Schunk LWA3 and with the yaml file

2018-07-17 15:32:17 -0500 edited question Generated Schunk .urdf has incorrect orientations

Generated Schunk .urdf has incorrect orientations Hello, I am working with a Schunk LWA 3 (dof 7) arm and controlling i

2018-07-17 15:31:51 -0500 received badge  Notable Question (source)
2018-07-17 15:28:48 -0500 answered a question Generated Schunk .urdf has incorrect orientations

I fixed this issue by cloning the older groovy-dev branch of schunk_robots, then used the lwa.urdf.xacro in schunk_hardw

2018-07-17 15:24:44 -0500 received badge  Popular Question (source)
2018-07-17 15:24:35 -0500 asked a question Launching PowerCube on multiple CAN busses

Launching PowerCube on multiple CAN busses Hello I am working with a Schunk LWA3 (DOF 7) in ROS with the Schunk PowerCub

2018-07-17 13:37:04 -0500 received badge  Notable Question (source)
2018-07-16 12:37:10 -0500 commented question follow_joint_trajectory action client not connected

Chris, Hello, I am currently trying to solve the exact same error. Where you able to get this to launch properly? Kyl

2018-07-16 12:37:10 -0500 received badge  Commentator
2018-07-12 09:06:04 -0500 received badge  Popular Question (source)
2018-07-11 14:58:37 -0500 edited question MoveIt and Schunk PowerCube

MoveIt and Schunk PowerCube Hello I am trying to move a physical Schunk LWA3 DOF 7, Schunks PowerCube drivers, and Movei

2018-07-11 14:48:02 -0500 asked a question MoveIt and Schunk PowerCube

MoveIt and Schunk PowerCube Hello I am trying to move a physical Schunk LWA3 DOF 7, Schunks PowerCube drivers, and Movei

2018-07-08 10:37:26 -0500 edited question Generated Schunk .urdf has incorrect orientations

Generated Schunk .urdf has incorrect orientations Hello, I am working with a Schunk LWA 3 (dof 7) arm and controlling i

2018-07-08 10:37:05 -0500 edited question Generated Schunk .urdf has incorrect orientations

Generated Schunk .urdf has incorrect orientations Hello, I am working with a Schunk LWA 3 (dof 7) arm and controlling i

2018-07-08 10:36:46 -0500 edited question Generated Schunk .urdf has incorrect orientations

Generated Schunk .urdf has incorrect orientations Hello, I am working with a Schunk LWA 3 (dof 7) arm and controlling i