Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controlling motors and using multiple sensors #2

Closed
inhok996 opened this issue Apr 18, 2016 · 6 comments
Closed

controlling motors and using multiple sensors #2

inhok996 opened this issue Apr 18, 2016 · 6 comments

Comments

@inhok996
Copy link

inhok996 commented Apr 18, 2016

Hello again!

I've tried to operate your pkgs and I have a couple of questions.

I roslaunched ultrasonic.launch, motor.launch successfully but I have a problem with using topics.

I could manage to subscribe the topic "/ultrasonic" but I don't know how to publish topic "/ev3dev/OutportA/command"

I googled for days but I still no have idea to make the motors work.

I found the type of topic "command" is "std_msg/Float64".

Q1) Does that mean I should publish just velocity of motors??? or something more than that?

Because topic "joint_states" publishes multiple values, I don't think I should publish just velocity of motors.

Please give me a hint or show me your source code of publisher node (the one used on your Youtube demo) if you are ok..

Q2) Can I launch multiple sensors??

Because I launched ultrasonic sensor and again launched color sensor and the formal one died..

I'm gonna try to modify launch files but before that, I want to ask you about it first.

Thanks a lot.


My topic lists are below

Published topics:

  • /ev3dev/joint_states [sensor_msgs/JointState] 1 publisher
  • /rosout [rosgraph_msgs/Log] 4 publishers
  • /ultrasonic [sensor_msgs/Range] 1 publisher
  • /rosout_agg [rosgraph_msgs/Log] 1 publisher

Subscribed topics:

  • /ev3dev/OutPortB/command [std_msgs/Float64] 1 subscriber
  • /ev3dev/OutPortA/command [std_msgs/Float64] 1 subscriber
  • /rosout [rosgraph_msgs/Log] 1 subscriber
@inhok996
Copy link
Author

I tried to rostopic pub /ev3dev/OutPortA/command std_msgs/Float64 5.0 but nothing happend

@cyborg-x1
Copy link
Member

rostopic pub /ev3dev/OutPortA/command std_msgs/Float64 "data: 5.0"
Should actually do the trick to make it turn.

@inhok996
Copy link
Author

inhok996 commented Apr 19, 2016

I tired once again. but the same.. the motor doesn't work.

I unpluged cables of motors from my ev3 brick and tried

roslaunch h4r_ev3_launch motor.launch

but no error occurred and it seemed that all controllers of the motors loaded successfully. ( when I tried to do the same thing in ultrasonic sensor, some errors occurred and I had to pluged in the cable of ultrasonic sensor to exactly "in2" / This is specified in ultrasonic.yaml )

So I wonder if the controllers work properly.

Can you check this out?..

ps) I checked motors working when I ev3_ev3dev-lang demo.


root@ev3dev:~# ev3_manager
getFilePTR opening: /sys/class/tacho-motor/motor3/position 0x66390
getFilePTR opening: /sys/class/tacho-motor/motor3/speed 0x681b8
getFilePTR opening: /sys/class/tacho-motor/motor2/position 0x68320
getFilePTR opening: /sys/class/tacho-motor/motor2/speed 0x66710

inho@ubuntu:~/catkin_ws/src/beginner_tutorials$ roslaunch h4r_ev3_launch motors.launch
... logging to /home/inho/.ros/log/07ca6d4a-05ed-11e6-9c4e-000c2944140a/roslaunch-ubuntu-6170.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://ubuntu:34882/

SUMMARY

PARAMETERS

  • /ev3dev/Ev3devJoints/Joint_A/mode: velocity
  • /ev3dev/Ev3devJoints/Joint_A/speed_pid: [1001, 61, 1]
  • /ev3dev/Ev3devJoints/Joint_B/mode: velocity
  • /ev3dev/Ev3devJoints/Joint_B/speed_pid: [1002, 62, 2]
  • /ev3dev/Ev3devJoints/Joint_C/mode: velocity
  • /ev3dev/Ev3devJoints/Joint_C/speed_pid: [1003, 63, 3]
  • /ev3dev/Ev3devJoints/Joint_D/mode: velocity
  • /ev3dev/Ev3devJoints/Joint_D/speed_pid: [1004, 64, 4]
  • /ev3dev/OutPortA/joint: Joint_A
  • /ev3dev/OutPortA/type: velocity_controll...
  • /ev3dev/OutPortB/joint: Joint_B
  • /ev3dev/OutPortB/type: velocity_controll...
  • /ev3dev/OutPortState/publish_rate: 10
  • /ev3dev/OutPortState/type: joint_state_contr...
  • /ev3dev/diffDrv/angular/z/has_acceleration_limits: True
  • /ev3dev/diffDrv/angular/z/has_velocity_limits: True
  • /ev3dev/diffDrv/angular/z/max_acceleration: 1.5
  • /ev3dev/diffDrv/angular/z/max_velocity: 1.7
  • /ev3dev/diffDrv/base_frame_id: base_footprint
  • /ev3dev/diffDrv/cmd_vel_timeout: 0.5
  • /ev3dev/diffDrv/left_wheel: Joint_C
  • /ev3dev/diffDrv/linear/x/has_acceleration_limits: True
  • /ev3dev/diffDrv/linear/x/has_velocity_limits: True
  • /ev3dev/diffDrv/linear/x/max_acceleration: 0.8
  • /ev3dev/diffDrv/linear/x/max_velocity: 1.0
  • /ev3dev/diffDrv/linear/x/min_acceleration: 0.2# m/s^2
  • /ev3dev/diffDrv/linear/x/min_velocity: -1.0
  • /ev3dev/diffDrv/pose_covariance_diagonal: [0.0, 0.0, 0.0, 0...
  • /ev3dev/diffDrv/publish_rate: 10.0
  • /ev3dev/diffDrv/right_wheel: Joint_D
  • /ev3dev/diffDrv/twist_covariance_diagonal: [0.0, 0.0, 0.0, 0...
  • /ev3dev/diffDrv/type: diff_drive_contro...
  • /ev3dev/diffDrv/wheel_radius: 0.15
  • /ev3dev/diffDrv/wheel_radius_multiplier: 1.0
  • /ev3dev/diffDrv/wheel_separation: 1.0
  • /ev3dev/diffDrv/wheel_separation_multiplier: 1.0
  • /ev3dev/ev3_manager_node/InPorts: ['in1', 'in2', 'i...
  • /ev3dev/ev3_manager_node/OutPorts: ['outA', 'outB', ...
  • /rosdistro: indigo
  • /rosversion: 1.11.16

NODES
/ev3dev/
controller_spawner (controller_manager/spawner)
ev3_manager_node (h4r_ev3_manager/ev3_manager_node)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[ev3dev/ev3_manager_node-1]: started with pid [6188]
process[ev3dev/controller_spawner-2]: started with pid [6189]
[INFO] [WallTime: 1461042642.402335] Controller Spawner: Waiting for service controller_manager/load_controller
[INFO] [WallTime: 1461042642.408167] Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [WallTime: 1461042642.411062] Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [WallTime: 1461042642.419903] Loading controller: OutPortState
[INFO] [WallTime: 1461042642.553937] Loading controller: OutPortA
[INFO] [WallTime: 1461042642.647706] Loading controller: OutPortB
[INFO] [WallTime: 1461042642.753752] Controller Spawner: Loaded controllers: OutPortState, OutPortA, OutPortB
[ INFO] [1461042642.763800006]: Controller Change
[ INFO] [1461042642.765381678]: velocity_controllers/JointVelocityController requests Joint OutPortA Joint_A
[ INFO] [1461042642.777606933]: <--------------EV3 Joint Joint_A---------------->
[ INFO] [1461042642.792417002]: Joint control mode: velocity
[ INFO] [1461042642.802080273]: P: 1001 I: 61 D: 1
[ INFO] [1461042642.802165909]: </-------------EV3 Joint Joint_A---------------->
[ INFO] [1461042642.802415446]: ----------------------------------------------<
[ INFO] [1461042642.802864933]: PID 1001 61 1
[ INFO] [1461042642.803315802]: velocity_controllers/JointVelocityController requests Joint OutPortB Joint_B
[ INFO] [1461042642.807096057]: <--------------EV3 Joint Joint_B---------------->
[ INFO] [1461042642.808576030]: Joint control mode: velocity
[ INFO] [1461042642.811388622]: P: 1002 I: 62 D: 2
[ INFO] [1461042642.811543573]: </-------------EV3 Joint Joint_B---------------->
[ INFO] [1461042642.811837925]: ----------------------------------------------<
[ INFO] [1461042642.812131619]: PID 1002 62 2
[INFO] [WallTime: 1461042642.847636] Started controllers: OutPortState, OutPortA, OutPortB

@inhok996
Copy link
Author

inhok996 commented Apr 19, 2016

my ev3 motors now work. I found out that motor.launch should be launched on ev3dev because the device files of motors and sensors are located in ev3dev file system and ev3_manager node only can be associated with the files in ev3dev if I'm right.

Because I "roslaunch motor.launch" in host linux(the one where I run roscore), I prevented running ev3_manager_node from motor.launch by deleting two lines about it. I use ev3_manager in yocto ev3dev instead.

@cyborg-x1
Copy link
Member

Ah - you launched it on your PC... Well it would work if you build serial adapters for your PC and compile and install the drivers...

@inhok996
Copy link
Author

Oh! That is good tip for me. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants