Hacks4ROS / h4r_ev3_ctrl

ROS Node for managing EV3 with ROS Control
GNU General Public License v3.0
21 stars 12 forks source link

failed to run catkin_make #7

Closed teongzhe closed 7 years ago

teongzhe commented 7 years ago

Hi. I am running ROS indigo on ubuntu 14.04. After downloading this package, whenever i run catkin_make i get the following error:

In file included from /home/chua/catkin_ws/src/h4r_ev3_ctrl-develop/h4r_ev3_manager/src/h4r_ev3_manager/Ev3HardwareInterface.h:34:0,
                 from /home/chua/catkin_ws/src/h4r_ev3_ctrl-develop/h4r_ev3_manager/src/h4r_ev3_manager/Ev3HardwareInterface.cpp:23:
/home/chua/catkin_ws/src/h4r_ev3_ctrl-develop/h4r_ev3_manager/include/h4r_ev3_joint_setup/ev3_joint_settings_interface.h: In member function ‘bool ev3_control::Ev3JointInterface::ControllerChange(const std::list<hardware_interface::ControllerInfo>&)’:
/home/chua/catkin_ws/src/h4r_ev3_ctrl-develop/h4r_ev3_manager/include/h4r_ev3_joint_setup/ev3_joint_settings_interface.h:109:57: error: ‘const struct hardware_interface::ControllerInfo’ has no member named ‘resources’
    for (std::set<std::string>::const_iterator res = it->resources.begin(); res != it->resources.end(); res++)
                                                         ^
/home/chua/catkin_ws/src/h4r_ev3_ctrl-develop/h4r_ev3_manager/include/h4r_ev3_joint_setup/ev3_joint_settings_interface.h:109:87: error: ‘const struct hardware_interface::ControllerInfo’ has no member named ‘resources’
    for (std::set<std::string>::const_iterator res = it->resources.begin(); res != it->resources.end(); res++)

i have little experience with cpp and ros. Are there any additional files that i need to download to make running catkin_make possible?

cyborg-x1 commented 7 years ago

Could it be that you haven't installed all the dependencies like ros_control?

try executing rosdep install --from-paths src --ignore-src --rosdistro indigo -y in your workspace, if your ros install is setup correctly, it should install all required packages.

teongzhe commented 7 years ago

Executing rosdep install --from-paths src --ignore-src --rosdistro indigo -y gives #All required rosdeps installed successfully so i assume that all dependencies are already installed.

After trying to execute catkin_make again it gives the same error message as before when

Building CXX object h4r_ev3_ctrl-develop/h4r_ev3_manager/CMakeFiles/ev3_manager_node.dir/src/h4r_ev3_manager/Ev3HardwareInterface.cpp.o

so i assume that nothing has changed after executing rosdep install --from-paths src --ignore-src --rosdistro indigo -y

After going through the error message i decided to look up hardware_interface::ControllerInfo found in ~/catkin_ws/src/ros_control/hardware_interface/include/controller_info.h and the source code looks like this:

#ifndef HARDWARE_INTERFACE_CONTROLLER_INFO_H
#define HARDWARE_INTERFACE_CONTROLLER_INFO_H

#include <string>
#include <vector>

#include <hardware_interface/interface_resources.h>

namespace hardware_interface
{

/** \brief Controller Information
 *
 * This struct contains information about a given controller.
 *
 */
struct ControllerInfo
{
  /** Controller name. */
  std::string name;

  /** Controller type. */
  std::string type;

  /** Claimed resources, grouped by the hardware interface they belong to. */
  std::vector<InterfaceResources> claimed_resources;
};

}

#endif

As mentioned in the error message, i couldn't find any member named 'resources' in the class. Considering the possibility i've been running a different version of the hardware_interface package, i executed rosversion hardware_interface and the terminal returned

0.11.1

am i running the correct version of hardware_interface?

cyborg-x1 commented 7 years ago

Guess the name changed to claimed_resources. But you do not need to compile on your PC, just use the launch files to start the stuff on the EV3

teongzhe commented 7 years ago

i tried using the launch files to start the sensors on EV3. started roscore on my computer and ev3_manager on the ev3. In another terminal(terminal2), i executed chua@hlt5:~$ roslaunch h4r_ev3_launch motors.launch ev3_hostname:=ev3dev which managed to launch without any errors. After connecting my touch sensor into input port 1, in another terminal3, i executed chua@hlt5:~$ roslaunch h4r_ev3_launch touch.launch ev3_hostname:=ev3dev and in terminal3,

 ... logging to /home/chua/.ros/log/1c9fbc32-94f6-11e6-8d78-f0795965c4a0/roslaunch-hlt5-29090.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://hlt5:50539/

SUMMARY
========

PARAMETERS
 * /ev3dev/Ev3Touch/frame_id: touch_link
 * /ev3dev/Ev3Touch/port: in1
 * /ev3dev/Ev3Touch/publish_rate: 10
 * /ev3dev/Ev3Touch/topic_name: /touch
 * /ev3dev/Ev3Touch/type: h4r_ev3_control/E...
 * /rosdistro: indigo
 * /rosversion: 1.11.20

NODES
  /ev3dev/
    ev3_sensor_spawner (controller_manager/spawner)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[ev3dev/ev3_sensor_spawner-1]: started with pid [29108]
[INFO] [WallTime: 1476771355.451635] Controller Spawner: Waiting for service controller_manager/load_controller
[INFO] [WallTime: 1476771355.452890] Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [WallTime: 1476771355.454129] Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [WallTime: 1476771355.455337] Loading controller: Ev3Touch
[ERROR] [WallTime: 1476771356.485048] Failed to load Ev3Touch
[INFO] [WallTime: 1476771356.485943] Controller Spawner: Loaded controllers: 
[INFO] [WallTime: 1476771356.566488] Started controllers: 

and in terminal2,

Port: in1 Publish rate: 10 [ERROR] [1476771355.484063194]: Need touch sensor on port: in1 [ERROR] [1476771355.484101697]: Failed to initialize the controller [ERROR] [1476771355.484229550]: Initializing controller 'Ev3Touch' failed [ INFO] [1476771356.565694866]: Controller Change

gets added on at the end. The same thing happens whenever i try to launch other sensors. Am i missing something?

EDIT The sensor launch problem disappeared after a restart.

By the way may i know how to make the motors move? I tried publishing Float64 to

ev3_hostname/OutPortA/command ev3_hostname/OutPortB/command

but it does not move the motors. Is a different driver/controller required to drive the motors?

teongzhe commented 7 years ago

motors were able to move after editing the /etc/hosts file