-
Notifications
You must be signed in to change notification settings - Fork 1
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
Moisture sensors #14
Moisture sensors #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove git, src/moisture_sensors/scripts/talker.py, src/moisture_sensors/src/talker.py files
Fill out src/moisture_sensors/src/test1/package.xml
rename test1 directory to moisture_sensors
Try something like this insted
from gazebo_msgs.srv import GetModelState
import random
model_coordinates = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState)
pots=[(model_coordinates("plant_"+num, "world").pose.position,random.randint(20,500)) for num in range(0,143) ]
pots[50][0] #Point of pot 50
pots[50][0].x #x cord of pot 50
pots[50][0].y #y cord of pot 50
pots[50][0].z #z cord of pot 50
pots[50][1] #mosture of pot 50
or if you want to use
pots=[{pose:model_coordinates("plant_"+num, "world").pose.position,moisture_level:random.randint(20,500)} for num in range(0,143)]
pots[50].pose #Point of pot 50
pots[50].pose.x #x cord of pot 50
pots[50].moisture_level #mosture of pot 50
disclaimer this code is untested, wrote it without the sim running
moisture decay method works and publishes moisture level
Otherwise looks okay, but in the future please verify that it compiles and runs like below catkin clean -y
catkin build
source ./devel/setup.bash
roscore &
rosrun moisture_sensors talker.py &
rostopic echo /moisture
# when done
killall roscore |
renamed temperature to moisture other general update
use list of dictionary to store info of each pot
Cool but could you change to what we've heard the sensors are publishing (besides id that's something I requested)
|
uint32 id | ||
float32 temp | ||
float32 pot_imp | ||
float32 plant_imp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline here would be nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it like "String newLine" in the .msg file and then in talker.py, msg.newLine = " " or is there any specific way to have a new line in .msg file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline as in the \n
character at the end of the file, its fine I've added it in #34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. cool. thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It runs, now my turn to integrate.
initial commit for moisture sensors