Ask Your Question
0

Parameter 'joints' is not an array

asked 2012-09-11 20:06:20 -0500

tnduf1144 gravatar image

updated 2012-09-11 22:59:48 -0500

KruseT gravatar image

I see the this code.

and execution.

#include <actuator_array_example/example1_driver.h>



namespace actuator_array_example

{



/* ******************************************************** */

Example1Driver::Example1Driver()

{

  // For normal drivers, you would read custom configuration settings from the parameter

  // server here. Common examples include the port name over which you are communicating,

  // or the baud rate for the serial port. For this very simple example, we don't actually

  // need any additional configuration.



  // For this first, simple example, we will call the convenience init() script of the

  // base class. This sets up the list of joints, subscribes to needed topics, advertises

  // services, and calls the custom init_actuator_ function each actuator

  ActuatorArrayDriver::init();



  // Now create the array of simulated actuators

  for(unsigned int i = 0; i < command_msg_.name.size(); ++i)

  {

    // For this first, simple example we will use the default parameters for joint limits,

    // velocity, etc. provided by the DummyActuator Class

    actuators_[i] = DummyActuator();

  }

}



/* ******************************************************** */

Example1Driver::~Example1Driver()

{

}



/* ******************************************************** */

bool Example1Driver::read_(ros::Time ts)

{

  // Calculate the time from the last update

  double dt = (ts - previous_time_).toSec();



  // Loop through each joint and request the current status

  // Note: The base class functions ensure the same joint order in

  // both the 'command' message and the 'joint_state' message

  for (unsigned int i = 0; i < joint_state_msg_.name.size(); ++i)

  {

    // Update the simulated state of each actuator by dt seconds

    actuators_[i].update(dt);



    // Query the current state of each actuator

    joint_state_msg_.position[i] = actuators_[i].getPosition();

    joint_state_msg_.velocity[i] = actuators_[i].getVelocity();

    joint_state_msg_.effort[i]   = actuators_[i].getMaxTorque();

  }



  joint_state_msg_.header.stamp = ts;

  previous_time_ = ts;



  return true;

}



/* ******************************************************** */

bool Example1Driver::command_()

{

  // Loop through each joint in the command message and send the

  // corresponding servo the desired behavior

  for (unsigned int i = 0; i < command_msg_.name.size(); ++i)

  {

    actuators_[i].setVelocity(command_msg_.velocity[i]);

    actuators_[i].setPosition(command_msg_.position[i]);

  }



  return true;

}



/* ******************************************************** */

bool Example1Driver::stop_()

{

  // Loop through each joint and send the stop command

  for (unsigned int i = 0; i < command_msg_.name.size(); ++i)

  {

    // Update the simulated state of each actuator by dt seconds

    actuators_[i].stop();

  }



  return true;

}



/* ******************************************************** */

bool Example1Driver::home_()

{

  // Loop through each joint and send the home command

  for (unsigned int i = 0; i < command_msg_.name.size(); ++i)

  {

    // Update the simulated state of each actuator by dt seconds

    actuators_[i].home();

  }



  return true;

}



} // end namespace actuator_array_example







/* ******************************************************** */

int main(int argc, char** argv)

{

  ros::init(argc, argv, "example1_driver");



  // Create an Example1 Driver Object

  actuator_array_example::Example1Driver driver;



  // Put the driver in an infinite read-publish loop using the base class's 'spin' function

  driver.spin();



  return 0;

}

but, error

[ WARN] [1347388585.420279693]: Parameter 'joints' is not an array

Parameters. do I need to enter something?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-09-12 01:39:22 -0500

jbohren gravatar image

Please try to follow the instructions in the tutorial. This section explains how to set the parameters your node needs.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-09-11 20:06:20 -0500

Seen: 183 times

Last updated: Sep 12 '12